From patchwork Fri Dec 17 22:16:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 49073 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 87DC2385802A for ; Fri, 17 Dec 2021 22:16:58 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from smtprelay07.ispgateway.de (smtprelay07.ispgateway.de [134.119.228.101]) by sourceware.org (Postfix) with ESMTPS id AADFB3858420 for ; Fri, 17 Dec 2021 22:16:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AADFB3858420 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=schwinge.name Received: from [192.94.31.2] (helo=dem-tschwing-1.ger.mentorg.com) by smtprelay07.ispgateway.de with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1myLWI-00007M-A0; Fri, 17 Dec 2021 23:16:06 +0100 Received: (nullmailer pid 2541007 invoked by uid 1000); Fri, 17 Dec 2021 22:16:48 -0000 From: Thomas Schwinge To: libabigail@sourceware.org Subject: [PATCH] fedabipkgdiff: Enable testing without proper Koji installation Date: Fri, 17 Dec 2021 23:16:26 +0100 Message-Id: <20211217221626.2540912-1-thomas@codesourcery.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Df-Sender: b3V0Z29pbmdAc2Nod2luZ2UubmFtZQ== X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , Cc: Mark Wielaard , Dodji Seketeli , Thomas Schwinge Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libabigail" ... 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