Better handle fedabipkgdiff dependencies detection
authorDodji Seketeli <dodji@redhat.com>
Mon, 12 Sep 2016 10:09:59 +0000 (12:09 +0200)
committerDodji Seketeli <dodji@redhat.com>
Wed, 21 Sep 2016 17:08:22 +0000 (19:08 +0200)
Even when the configure script is executed without the
--enable-fedabipkgdiff switch, if one of the dependencies of
fedabipkgdiff is missing (e.g, python), it fails with a fatal error.

It should rather just disable fedabipkgdiff in that case.

This patch fixes this behaviour.  It makes it so that it's only when
the --enable-fedabipkgdiff switch provided that a missing dependency
results in a fatal hard error.

* configure.ac: It's only when --enable-fedabipkgdiff is provided
that a missing dependency of the fedabipkgdiff program results in
a fatal error.  Otherwise, building fedabipkgdiff is just
disabled.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
configure.ac

index eb9caebc946a22b69f14c1b8c7e5fa86f1fb2996..fdfcbf69990a0c347d3ac68fe08dff22a5a269dc 100644 (file)
@@ -296,14 +296,22 @@ else
 fi
 
 if test x$CHECK_DEPS_FOR_FEDABIPKGDIFF = xyes; then
+  MISSING_FEDABIPKGDIFF_DEP=no
+
   if test x$ENABLE_FEDABIPKGDIFF = xyes; then
-     FATAL=yes
+     MISSING_FEDABIPKGDIFF_DEP_FATAL=yes
+  else
+     MISSING_FEDABIPKGDIFF_DEP_FATAL=no
   fi
 
   AC_PATH_PROG(WGET, wget, no)
 
-  if test x$WGET = x$no; then
-    AC_MSG_ERROR(could not find the wget program)
+  if test x$WGET = xno; then
+    if test x$MISSING_FEDABIPKGDIFF_DEP_FATAL = xyes; then
+      AC_MSG_ERROR(could not find the wget program)
+    else
+      MISSING_FEDABIPKGDIFF_DEP=yes
+    fi
   fi
 
   # The minimal python version we want to support is 2.6.6 because EL6
@@ -316,25 +324,35 @@ if test x$CHECK_DEPS_FOR_FEDABIPKGDIFF = xyes; then
                         [MINIMAL_PYTHON_VERSION_FOUND=no])
 
   if test x$MINIMAL_PYTHON_VERSION_FOUND = xno; then
-    AC_MSG_ERROR([could not find a python program of version at least $MINIMAL_PYTHON_VERSION])
+    MISSING_FEDABIPKGDIFF_DEP=yes
+    if test x$MISSING_FEDABIPKGDIFF_DEP_FATAL = xyes; then
+      AC_MSG_ERROR([could not find a python program of version at least $MINIMAL_PYTHON_VERSION])
+    fi
   fi
 
   REQUIRED_PYTHON_MODULES_FOR_FEDABIPKGDIFF="\
    argparse logging os re subprocess sys urlparse \
    xdg koji mock rpm imp tempfile"
 
-  if test -x$ENABLE_FEDABIPKGDIFF != xno; then
+  if test x$ENABLE_FEDABIPKGDIFF != xno; then
     AX_CHECK_PYTHON_MODULES([$REQUIRED_PYTHON_MODULES_FOR_FEDABIPKGDIFF],
                            [python2],
                            [FOUND_ALL_PYTHON_MODULES=yes],
                            [FOUND_ALL_PYTHON_MODULES=no])
 
     if test x$FOUND_ALL_PYTHON_MODULES = xno; then
-       AC_MSG_NOTICE([missing python modules: $MISSING_PYTHON_MODULES])
-       AC_MSG_NOTICE([disabling fedabipkgdiff as a result])
+       MISSING_FEDABIPKGDIFF_DEP=yes
+       if test x$MISSING_FEDABIPKGDIFF_DEP_FATAL = xyes; then
+         AC_MSG_ERROR([missing python modules: $MISSING_PYTHON_MODULES]);
+       else
+         AC_MSG_NOTICE([missing python modules: $MISSING_PYTHON_MODULES])
+         AC_MSG_NOTICE([disabling fedabipkgdiff as a result])
+       fi
        ENABLE_FEDABIPKGDIFF=no
     else
-       ENABLE_FEDABIPKGDIFF=yes
+       if test x$MISSING_FEDABIPKGDIFF_DEP = xno; then
+         ENABLE_FEDABIPKGDIFF=yes
+       fi
     fi
   fi
 fi