configure: Tune fedabipkgdiff dependencies detection

Message ID 20211211181852.959428-1-thomas@codesourcery.com
State Committed
Headers
Series configure: Tune fedabipkgdiff dependencies detection |

Commit Message

Thomas Schwinge Dec. 11, 2021, 6:18 p.m. UTC
  If 'configure' finds some Python koji module, but it's "insufficient" per
the testing once added in commit 90d236a03343d75ea504d53c73270e50b9000e75
"Bug 22076 - Disable fedabipkgdiff for old koji clients", we currently get,
for example:

    [...]
    checking python3 module: koji... yes
    [...]
    checking checking if koji client is recent enough ...... Traceback (most recent call last):
      File "<string>", line 3, in <module>
      File "[...]/koji/__init__.py", line 2016, in read_config
        raise ConfigurationError("no configuration for profile name: %s"
    koji.ConfigurationError: no configuration for profile name: koji
    no, disabling fedpkgdiff
    [...]
                    Here is the configuration of the package:
    [...]
        Enable fedabipkgdiff                           : auto
    [...]

Note repeated 'checking' and '...', intermixed error output, 'fedpkgdiff'
typo, final 'auto' result.

Changing that to:

    [...]
    checking if koji client is recent enough... no
    configure: WARNING: disabling fedabipkgdiff
    [...]
                    Here is the configuration of the package:
    [...]
        Enable fedabipkgdiff                           : no
    [...]

... with 'config.log':

    [...]
    configure:13774: checking if koji client is recent enough
    configure:13784: result: no
    Traceback (most recent call last):
      File "<string>", line 3, in <module>
      File "[...]/koji/__init__.py", line 2016, in read_config
        raise ConfigurationError("no configuration for profile name: %s"
    koji.ConfigurationError: no configuration for profile name: koji
    configure:13792: WARNING: disabling fedabipkgdiff
    [...]

Similarly, with explicit '--enable-fedabipkgdiff', we currently get:

    [...]
    checking checking if koji client is recent enough ...... Traceback (most recent call last):
      File "<string>", line 3, in <module>
      File "[...]/koji/__init__.py", line 2016, in read_config
        raise ConfigurationError("no configuration for profile name: %s"
    koji.ConfigurationError: no configuration for profile name: koji
    no, disabling fedpkgdiff
    [...]
                    Here is the configuration of the package:
    [...]
        Enable fedabipkgdiff                           : yes
    [...]

... instead of a fatal error.

Changing that to:

    [...]
    checking if koji client is recent enough... no
    configure: error: unsuitable koji client

	* configure.ac: Tune fedabipkgdiff dependencies detection.

Signed-off-by: Thomas Schwinge <thomas@codesourcery.com>
---
 configure.ac | 79 ++++++++++++++++++++++++++--------------------------
 1 file changed, 40 insertions(+), 39 deletions(-)
  

Comments

Dodji Seketeli Dec. 17, 2021, 7:10 p.m. UTC | #1
Thomas Schwinge <thomas@codesourcery.com> a écrit:

[...]

> Signed-off-by: Thomas Schwinge <thomas@codesourcery.com>

Applied to master using "git am -p0", thanks!

Cheers,

[...]
  

Patch

diff --git configure.ac configure.ac
index a77ab4d8..40f57ed9 100644
--- configure.ac
+++ configure.ac
@@ -533,11 +533,10 @@  if test x$CHECK_DEPS_FOR_FEDABIPKGDIFF = xyes; then
   AC_PATH_PROG(WGET, wget, no)
 
   if test x$WGET = xno; then
-    ENABLE_FEDABIPKGDIFF=no
+    MISSING_FEDABIPKGDIFF_DEP=yes
     if test x$MISSING_FEDABIPKGDIFF_DEP_FATAL = xyes; then
       AC_MSG_ERROR(could not find the wget program)
     else
-      MISSING_FEDABIPKGDIFF_DEP=yes
       AC_MSG_NOTICE([could not find the wget program])
       AC_MSG_NOTICE([disabling fedabipkgdiff as a result])
     fi
@@ -567,48 +566,50 @@  if test x$CHECK_DEPS_FOR_FEDABIPKGDIFF = xyes; then
    argparse logging os re subprocess sys $URLPARSE_MODULE \
    xdg koji mock rpm imp tempfile mimetypes shutil six"
 
-  if test x$ENABLE_FEDABIPKGDIFF != xno; then
-    AX_CHECK_PYTHON_MODULES([$REQUIRED_PYTHON_MODULES_FOR_FEDABIPKGDIFF],
-			    [$PYTHON],
-			    [FOUND_ALL_PYTHON_MODULES=yes],
-			    [FOUND_ALL_PYTHON_MODULES=no])
-
-    if test x$FOUND_ALL_PYTHON_MODULES = xno; then
-       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
+  AX_CHECK_PYTHON_MODULES([$REQUIRED_PYTHON_MODULES_FOR_FEDABIPKGDIFF],
+			  [$PYTHON],
+			  [FOUND_ALL_PYTHON_MODULES=yes],
+			  [FOUND_ALL_PYTHON_MODULES=no])
+
+  if test x$FOUND_ALL_PYTHON_MODULES = xno; then
+    MISSING_FEDABIPKGDIFF_DEP=yes
+    if test x$MISSING_FEDABIPKGDIFF_DEP_FATAL = xyes; then
+      AC_MSG_ERROR([missing python modules: $MISSING_PYTHON_MODULES]);
     else
-	# On some old platforms, the koji client object doesn't have
-	# the required .read_config method.  Alas, that module doesn't
-	# have any __version__ string either.  So we do as well as we
-	# can to try and detect that case and disable fedabipkgdiff if
-	# necessary.
-        AC_MSG_CHECKING([checking if koji client is recent enough ...])
-	$PYTHON -c "
+      AC_MSG_NOTICE([missing python modules: $MISSING_PYTHON_MODULES])
+      AC_MSG_NOTICE([disabling fedabipkgdiff as a result])
+    fi
+  else
+    # On some old platforms, the koji client object doesn't have
+    # the required .read_config method.  Alas, that module doesn't
+    # have any __version__ string either.  So we do as well as we
+    # can to try and detect that case and disable fedabipkgdiff if
+    # necessary.
+    AC_MSG_CHECKING([if koji client is recent enough])
+    $PYTHON 2>&AS_MESSAGE_LOG_FD -c "
 import koji
 koji.read_config('koji')"
-	if test $? -eq 0; then
-	   koji_version_check_ok=yes
-	else
-	   koji_version_check_ok=no
-	fi
-
-	if test x$koji_version_check_ok = xno; then
-	  AC_MSG_RESULT([no, disabling fedpkgdiff])
-	  MISSING_FEDABIPKGDIFF_DEP=yes
-	else
-          AC_MSG_RESULT(yes)
-       fi
-       if test x$MISSING_FEDABIPKGDIFF_DEP = xno; then
-         ENABLE_FEDABIPKGDIFF=yes
-       fi
+    if test $? -eq 0; then
+      koji_version_check_ok=yes
+    else
+      koji_version_check_ok=no
+    fi
+    AC_MSG_RESULT([$koji_version_check_ok])
+    if test x$koji_version_check_ok = xno; then
+      MISSING_FEDABIPKGDIFF_DEP=yes
+      if test x$MISSING_FEDABIPKGDIFF_DEP_FATAL = xyes; then
+        AC_MSG_ERROR([unsuitable koji client])
+      else
+	AC_MSG_WARN([disabling fedabipkgdiff])
+      fi
     fi
   fi
+
+  if test x$MISSING_FEDABIPKGDIFF_DEP = xno; then
+    ENABLE_FEDABIPKGDIFF=yes
+  else
+    ENABLE_FEDABIPKGDIFF=no
+  fi
 fi
 
 AM_CONDITIONAL(ENABLE_FEDABIPKGDIFF, test x$ENABLE_FEDABIPKGDIFF = xyes)