From feb441e284a03f3ff86fd0962cfaf5a9efedf28d Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Fri, 17 Dec 2021 23:16:26 +0100 Subject: [PATCH] fedabipkgdiff: Enable testing without proper Koji installation ... as is now documented in 'CONTRIBUTING'. * tools/fedabipkgdiff: Handle 'koji.ConfigurationError'. * configure.ac: Likewise. * CONTRIBUTING: Document "fedabipkgdiff testing". Documenting/providing a way to enable such testing, this commit can be considered a sequel to commit 90d236a03343d75ea504d53c73270e50b9000e75 "Bug 22076 - Disable fedabipkgdiff for old koji clients", for Mark Wielaard's PR22076 "runtestfedabipkgdiff.py fails on debian-amd64". Signed-off-by: Thomas Schwinge --- CONTRIBUTING | 20 ++++++++++++++++++++ configure.ac | 6 +++++- tools/fedabipkgdiff | 17 ++++++++++++++--- 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING b/CONTRIBUTING index 24a483b2..5ab7bcce 100644 --- a/CONTRIBUTING +++ b/CONTRIBUTING @@ -174,6 +174,26 @@ make sure to add your new test input files to the tests/data/Makefile.am file, in the EXTRA_DIST variable. Look at how things are organized in that file, and please do things similarly. +fedabipkgdiff testing +--------------------- + +This depends on the Python koji and a few support modules. If these are +not available, 'configure' disables fedabipkgdiff and its 'make check' +testing. + +Debian and Ubuntu, for example, don't provide packages for the Python +koji module. If you'd like to run fedabipkgdiff testing without manually +doing a proper Koji installation, you may simply download Koji sources +(, releases, or Git clone) and point to these via +the Python search path. For example, tested 2021-12-11: + + wget https://pagure.io/koji/archive/koji-1.27.0/koji-koji-1.27.0.tar.gz + tar -xzf koji-koji-1.27.0.tar.gz + export PYTHONPATH="$PWD"/koji-koji-1.27.0 + +A libabigail 'configure' run then enables fedabipkgdiff and its +'make check' testing. + Coding language and style ========================== diff --git a/configure.ac b/configure.ac index 40f57ed9..29130175 100644 --- a/configure.ac +++ b/configure.ac @@ -588,7 +588,11 @@ if test x$CHECK_DEPS_FOR_FEDABIPKGDIFF = xyes; then AC_MSG_CHECKING([if koji client is recent enough]) $PYTHON 2>&AS_MESSAGE_LOG_FD -c " import koji -koji.read_config('koji')" +try: + koji.read_config('koji') +except koji.ConfigurationError: + # See 'tools/fedabipkgdiff'. + pass" if test $? -eq 0; then koji_version_check_ok=yes else diff --git a/tools/fedabipkgdiff b/tools/fedabipkgdiff index 89cbd15c..be4182b2 100755 --- a/tools/fedabipkgdiff +++ b/tools/fedabipkgdiff @@ -46,9 +46,20 @@ import koji # something wrong. -koji_config = koji.read_config('koji') -DEFAULT_KOJI_SERVER = koji_config['server'] -DEFAULT_KOJI_TOPURL = koji_config['topurl'] +# First, try proper Koji initialization. +try: + koji_config = koji.read_config('koji') + DEFAULT_KOJI_SERVER = koji_config['server'] + DEFAULT_KOJI_TOPURL = koji_config['topurl'] +except koji.ConfigurationError: + # ..., but if that fails because of a rather strict interpretation where + # 'read_config' looks for configuration files, just use dummy values. + # These fail upon use unless overridden, which for libabigail test suite + # usage they always are (all relevant artifacts are shipped in the + # libabigail distribution). + DEFAULT_KOJI_SERVER = 'dummy_DEFAULT_KOJI_SERVER' + DEFAULT_KOJI_TOPURL = 'dummy_DEFAULT_KOJI_TOPURL' + # The working directory where to hold all data including downloaded RPM # packages Currently, it's not configurable and hardcode here. In the future -- 2.43.5