From patchwork Fri Apr 26 08:44:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 89025 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 1727B3858416 for ; Fri, 26 Apr 2024 08:44:58 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::225]) by sourceware.org (Postfix) with ESMTPS id B77D43858282; Fri, 26 Apr 2024 08:44:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B77D43858282 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 B77D43858282 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:4b98:dc4:8::225 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714121091; cv=none; b=aJgMRVmLe3rX1kR9FIf4rqOKeoBQKK7uNi8RakuT59kV2QfGVDZeaN9W/tomywdSdB/KjLU7j95GbsDLNdYMmUtK+0GN7f3ogi6pxqWEfuWEkSEUyfuK2QjoHEwV8GuuvjVh/O8PdGGw40ES0FtWB1HG6vieHjZoZIUHrWXB5PA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714121091; c=relaxed/simple; bh=9vaRM4XS9kYmjzlV8p4c/oPOVIV+e6vgDkJ42JnTxfQ=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=pu8lkAMYW5cOUEIUSBWBWvkes0/tO64xg/u861jfCKxNxnRvaYYks/U4CqI0qm58IHH1UNdMEbHSAMNV3y3n47mhvKMiDqcYJL2Hk42PMa5RI7RlKvoj+ur5ozVRNhxJdriU50tfDCqy5FyOifqX1acupx2t42k1veYmiBv+wcQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail.gandi.net (Postfix) with ESMTPSA id 7158B1C000C; Fri, 26 Apr 2024 08:44:44 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id BD747507A631; Fri, 26 Apr 2024 10:44:43 +0200 (CEST) From: Dodji Seketeli To: "fche at redhat dot com" Cc: libabigail@sourceware.org, fche@redhat.com Subject: [RFC] [PATCH] Make libarchive python module optional. Was Re: [Bug default/31672] abidb: make libarchive a soft dependency Organization: Me, myself and I References: X-Operating-System: AlmaLinux 9.3 X-URL: http://www.seketeli.net/~dodji Date: Fri, 26 Apr 2024 10:44:43 +0200 In-Reply-To: (fche at redhat dot com's message of "Tue, 23 Apr 2024 14:02:56 +0000") Message-ID: <87wmokfr7o.fsf_-_@seketeli.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-GND-Sasl: dodj@seketeli.org X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, 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 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 Hello, "fche at redhat dot com" a écrit: [...] > --- Comment #1 from Frank Ch. Eigler --- > Created attachment 15479 > --> https://sourceware.org/bugzilla/attachment.cgi?id=15479&action=edit > proposed patch Thanks for the patch! I have massaged it to add some more logging and such. I came up with the potential commit below that is currently running through the build bots. OK to apply if it passes tests? From 3810dbe6efd487c9712c87371265e41eacc6106e 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 Signed-off-by: Dodji Seketeli --- configure.ac | 15 +++++++++++++-- tools/abidb | 14 ++++++++++---- 2 files changed, 23 insertions(+), 6 deletions(-) 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..789b117f 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) 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 @@ -230,6 +235,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: