From patchwork Fri Apr 26 13:59:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: dodji at seketeli dot org X-Patchwork-Id: 89037 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 3C5673858416 for ; Fri, 26 Apr 2024 14:00:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3C5673858416 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1714140009; bh=42outxWy2xI46iJU3hCYA3cgHsoHUh10vAxEhm3hU/k=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ppWZOeVcztO8v6stYCUX08iqNkkwmx/92nWdZIcyvpIWeH9cToglKSfAkld69ZeNj exZNTxiY0BNUU0jrdvLkjOCW8XjBNLUhSu6bB6wsH9S52rHMTBOCAVF9LOlih4IRxV NEBVegRGDHmy6XVRoDJCxK7TrR3Zm6tZJUD5t/1o= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: by sourceware.org (Postfix, from userid 48) id 18B0E384AB55; Fri, 26 Apr 2024 13:59:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 18B0E384AB55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1714140000; bh=42outxWy2xI46iJU3hCYA3cgHsoHUh10vAxEhm3hU/k=; h=From:To:Subject:Date:In-Reply-To:References:From; b=vxqTmMHPUstv1gDpCxeeT/IMWZc75IyfxtAbdn5WwsoRtuFy7UcPtnCCDIr2Jc/S7 GDA2h4DnUHOttU7KpPj3uwRvVwh1Roq5IKjm9YJYJvbUEDjYR/MW2aWKeDeuT7P7GQ XNbRmXdAQNSot0i7YrJEy4XG5MKyLsEfU37EvrNU= From: "dodji at seketeli dot org" To: libabigail@sourceware.org Subject: [Bug default/31672] abidb: make libarchive a soft dependency Date: Fri, 26 Apr 2024 13:59:58 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: libabigail X-Bugzilla-Component: default X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dodji at seketeli dot org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org https://sourceware.org/bugzilla/show_bug.cgi?id=31672 --- Comment #3 from Dodji Seketeli --- Dodji Seketeli a écrit: [...] > 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 optional 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(-) parser.add_argument('--sysroot',type=str,help='remove given sysroot prefix from submitted file names',default=None) parser.add_argument('--filter',type=str,help='submit only binaries matching given wildcard',default=r'/lib.*\.so') # sub-version suffixes will be flattened into SONAME # --sysroot=PATH subtract this from SUBMIT paths @@ -208,14 +213,15 @@ def main() -> list[str]: logging.info(f'checked out distrobranch {args.distrobranch} files {numfiles}') ra = {} - for entry in args.archive: # parse / accumulate -Z EXT=CMD bits - extcmd = entry.split('=') - ext = extcmd[0] - if len(extcmd) == 1: - cmd = "cat" # default: pass through to libarchive - else: - cmd = "=".join(extcmd[1:]) # the rest of the command, filling other ='s back in - ra["."+ext] = cmd + if enable_libarchive: + for entry in args.archive: # parse / accumulate -Z EXT=CMD bits + extcmd = entry.split('=') + ext = extcmd[0] + if len(extcmd) == 1: + cmd = "cat" # default: pass through to libarchive + else: + cmd = "=".join(extcmd[1:]) # the rest of the command, filling other ='s back in + ra["."+ext] = cmd def submit_file_generator(args): @@ -230,6 +236,7 @@ def main() -> list[str]: ln = submit yield (None, ln, pn) # must be a plain file # XXX or ldconfig-created symlink, ugh else: # an archive! + assert enable_libarchive cmd = ra[ext] if (cmd == "cat"): # short-circuit this with libarchive.file_reader(submit) as archive: diff --git a/configure.ac b/configure.ac index a86f81d0..c6e1ad64 100644 --- a/configure.ac +++ b/configure.ac @@ -824,16 +824,27 @@ fi dnl abidb checks if test x$PYTHON3_INTERPRETER != xno -a x$ENABLE_ABIDB != xno; then - AX_CHECK_PYTHON_MODULES([git libarchive], + AX_CHECK_PYTHON_MODULES([git], [$PYTHON], [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 abidb as a result]) + AC_MSG_WARN([disabling abidb as a result]) + ENABLE_ABIDB=no else ENABLE_ABIDB=yes + dnl search for optional modules, just for autoconf reporting purposes + AX_CHECK_PYTHON_MODULES([libarchive], + [$PYTHON], + [FOUND_ALL_OPTIONAL_PYTHON_MODULES=yes], + [FOUND_ALL_OPTIONAL_PYTHON_MODULES=no]) + if test x$FOUND_ALL_OPTIONAL_PYTHON_MODULES = xno; then + AC_MSG_WARN([missing optional python modules for abidb: $MISSING_PYTHON_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=True +except: + enable_libarchive=False # globals @@ -156,9 +160,10 @@ def main() -> list[str]: parser.add_argument('--timeout',type=int,help='limit abidw/abicompat runtime (seconds)',default=0) parser.add_argument('--submit',nargs='*',type=str,default=[], help='submit abidw of given binaries to abidb') - parser.add_argument('--archive','-Z',metavar='EXT=CMD', - type=str,help='submit binaries from archives with given extension & decoder', - default=[],action='append') # like debuginfod(8) + if enable_libarchive: + parser.add_argument('--archive','-Z',metavar='EXT=CMD', + type=str,help='submit binaries from archives with given extension & decoder', + default=[],action='append') # like debuginfod(8)