From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by sourceware.org (Postfix) with ESMTPS id 9D73C3858402; Fri, 26 Apr 2024 13:59:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9D73C3858402 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=seketeli.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9D73C3858402 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714139997; cv=none; b=Yx8bDeRZYlhIOYgCpQq3c79yapcvv/ewrI29T6V9i2Uk5kGn/g4LgDK+4d2796UK2lw7vr7VRsNrjsV6TBZXlSKAMb/yLzqvfhOVtCHAf/YEXDZ4pbs+3Ndd+OmItyFilZhbJGj7+Jo80JovG4zs2b3oR3MGeZGEUTZgvz5rexc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714139997; c=relaxed/simple; bh=UUYGWYOscQ0ZbmLeRsZ1nVUpcPcTTbYrRER96GOJXz8=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=UTU0HDTkCDZzhP8wrm27uj3uLYfSNxT04Jg4CbzjR+awu5U5CJTws+ILYzeQQN/c7U51ewZZsr94q9WlVKXODxe20MJLMb7wrZOf4VKgXVKfWGidsramC8LhSVWsylB6CHd5SeRD/oIT3JTuCFxLbDZalgmY4+hTLmhyPrzU2WE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail.gandi.net (Postfix) with ESMTPSA id 0F9CF1BF20B; Fri, 26 Apr 2024 13:59:52 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id 3BFCA507A631; Fri, 26 Apr 2024 15:59:52 +0200 (CEST) From: Dodji Seketeli To: "fche at redhat dot com" Cc: libabigail@sourceware.org, fche@redhat.com, dodji@redhat.com Subject: Re: [RFC] [PATCH] Make libarchive python module optional. Was Re: [Bug default/31672] abidb: make libarchive a soft dependency Organization: Me, myself and I References: <87wmokfr7o.fsf_-_@seketeli.org> X-Operating-System: AlmaLinux 9.3 X-URL: http://www.seketeli.net/~dodji Date: Fri, 26 Apr 2024 15:59:52 +0200 In-Reply-To: <87wmokfr7o.fsf_-_@seketeli.org> (Dodji Seketeli's message of "Fri, 26 Apr 2024 10:44:43 +0200") Message-ID: <87sez8fcmf.fsf@seketeli.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-GND-Sasl: dodj@seketeli.org X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Dodji Seketeli a =C3=A9crit: [...] > I came up with the potential commit below that is currently running > through the build bots. OK to apply if it passes tests? Actually, the previous patch failed some tests on some platform where the libarchive python module is missing. This is because some code in the main() function was still referencing the archive even though it is not supported. Adjusted thus. Now, the updated patch below actually passes the test on all the tested platforms. OK to apply to the master branch? >From f41d17301f75fab61366bd7b568418d2a9c30567 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Fri, 26 Apr 2024 10:30:42 +0200 Subject: [PATCH] configure,abidb: Make the libarchive python module optiona= l for abidb Some distributions don't have the libarchive python module packaged. This patch makes that module optional and enables abidb to function without it, as it's only necessary for the support of the '--archive' command line option of the abidb program. * configure.ac: Detect the libarchive python module as an optional dependency for the abidb program. So far, only the git python module remains a hard dependency. * tools/abidb (main): Do not support the '--archive' command line option if the libarchive python module is not present. Signed-off-by: Dodji Seketeli --- configure.ac | 15 +++++++++++++-- tools/abidb | 31 +++++++++++++++++++------------ 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index a86f81d0..c6e1ad64 100644 --- a/configure.ac +++ b/configure.ac @@ -824,16 +824,27 @@ fi =20 dnl abidb checks if test x$PYTHON3_INTERPRETER !=3D xno -a x$ENABLE_ABIDB !=3D xno; then - AX_CHECK_PYTHON_MODULES([git libarchive], + AX_CHECK_PYTHON_MODULES([git], [$PYTHON], [FOUND_ALL_PYTHON_MODULES=3Dyes], [FOUND_ALL_PYTHON_MODULES=3Dno]) =20 if test x$FOUND_ALL_PYTHON_MODULES =3D xno; then AC_MSG_NOTICE([missing python modules: $MISSING_PYTHON_MODULES]) - AC_MSG_NOTICE([disabling abidb as a result]) + AC_MSG_WARN([disabling abidb as a result]) + ENABLE_ABIDB=3Dno else ENABLE_ABIDB=3Dyes + dnl search for optional modules, just for autoconf reporting purposes + AX_CHECK_PYTHON_MODULES([libarchive], + [$PYTHON], + [FOUND_ALL_OPTIONAL_PYTHON_MODULES=3Dyes], + [FOUND_ALL_OPTIONAL_PYTHON_MODULES=3Dno]) + if test x$FOUND_ALL_OPTIONAL_PYTHON_MODULES =3D xno; then + AC_MSG_WARN([missing optional python modules for abidb: $MISSING_P= YTHON_MODULES]) + else + AC_MSG_NOTICE([found all optional python modules for abidb]) + fi fi else AC_MSG_NOTICE([disabling abidb]) diff --git a/tools/abidb b/tools/abidb index a3f6850f..af1750d9 100755 --- a/tools/abidb +++ b/tools/abidb @@ -23,7 +23,11 @@ import re import ast import os import glob -import libarchive +try: + import libarchive + enable_libarchive=3DTrue +except: + enable_libarchive=3DFalse =20 =20 # globals @@ -156,9 +160,10 @@ def main() -> list[str]: parser.add_argument('--timeout',type=3Dint,help=3D'limit abidw/abicomp= at runtime (seconds)',default=3D0) parser.add_argument('--submit',nargs=3D'*',type=3Dstr,default=3D[], help=3D'submit abidw of given binaries to abidb') - parser.add_argument('--archive','-Z',metavar=3D'EXT=3DCMD', - type=3Dstr,help=3D'submit binaries from archives w= ith given extension & decoder', - default=3D[],action=3D'append') # like debuginfod(= 8) + if enable_libarchive: + parser.add_argument('--archive','-Z',metavar=3D'EXT=3DCMD', + type=3Dstr,help=3D'submit binaries from archiv= es with given extension & decoder', + default=3D[],action=3D'append') # like debugin= fod(8) parser.add_argument('--sysroot',type=3Dstr,help=3D'remove given sysroo= t prefix from submitted file names',default=3DNone) parser.add_argument('--filter',type=3Dstr,help=3D'submit only binaries= matching given wildcard',default=3Dr'/lib.*\.so') # sub-version suffixes w= ill be flattened into SONAME # --sysroot=3DPATH subtract this from SUBMIT paths @@ -208,14 +213,15 @@ def main() -> list[str]: logging.info(f'checked out distrobranch {args.distrobranch} files = {numfiles}') =20 ra =3D {} - for entry in args.archive: # parse / accumulate -Z EXT=3DCMD bits - extcmd =3D entry.split('=3D') - ext =3D extcmd[0] - if len(extcmd) =3D=3D 1: - cmd =3D "cat" # default: pass through to libarchive - else: - cmd =3D "=3D".join(extcmd[1:]) # the rest of the command, = filling other =3D's back in - ra["."+ext] =3D cmd + if enable_libarchive: + for entry in args.archive: # parse / accumulate -Z EXT=3DCMD b= its + extcmd =3D entry.split('=3D') + ext =3D extcmd[0] + if len(extcmd) =3D=3D 1: + cmd =3D "cat" # default: pass through to libarchive + else: + cmd =3D "=3D".join(extcmd[1:]) # the rest of the comma= nd, filling other =3D's back in + ra["."+ext] =3D cmd =20 =20 def submit_file_generator(args): @@ -230,6 +236,7 @@ def main() -> list[str]: ln =3D submit yield (None, ln, pn) # must be a plain file # XXX or l= dconfig-created symlink, ugh else: # an archive! + assert enable_libarchive cmd =3D ra[ext] if (cmd =3D=3D "cat"): # short-circuit this with libarchive.file_reader(submit) as archive: --=20 2.39.3 --=20 Dodji