From patchwork Fri Dec 10 16:52:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 48791 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 15B7F3858024 for ; Fri, 10 Dec 2021 16:55:29 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from smtprelay03.ispgateway.de (smtprelay03.ispgateway.de [80.67.18.15]) by sourceware.org (Postfix) with ESMTPS id 209E43857C71 for ; Fri, 10 Dec 2021 16:52:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 209E43857C71 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 smtprelay03.ispgateway.de with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mvj8j-0004yd-D3; Fri, 10 Dec 2021 17:52:57 +0100 Received: (nullmailer pid 3434997 invoked by uid 1000); Fri, 10 Dec 2021 16:52:55 -0000 From: Thomas Schwinge To: libabigail@sourceware.org, Dodji Seketeli Subject: [PATCH] configure: Instead of for rpm 4.15+ version, test actual rpm/zstd support Date: Fri, 10 Dec 2021 17:52:46 +0100 Message-Id: <20211210165246.3434933-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.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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: Thomas Schwinge Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libabigail" If no 'rpm' is available, we currently get: [...] checking for rpm... no ../git/configure: line 13119: rpm: command not found configure: detected rpm version: configure: rpm support in abipkgdiff is disabled [...] Here is the configuration of the package: [...] Enable rpm support in abipkgdiff : no Enable rpm 4.15 support in abipkgdiff tests : no [...] Notice intermixed error output: 'rpm: command not found'. If Ubuntu focal 'rpm' 4.14.2.1+dfsg1-1build2 is available, we currently get: [...] checking for rpm... yes configure: detected rpm version: 4.14.2.1 configure: rpm support in abipkgdiff is enabled configure: rpm 4.15 support in abipkgdiff tests is enabled [...] Here is the configuration of the package: [...] Enable rpm support in abipkgdiff : yes Enable rpm 4.15 support in abipkgdiff tests : yes [...] Notice wrong 4.15+ version detection (due to '[[ "$rpmversion" > "4.14.0" ]]'), which is satisfied by '4.14.2.1'. (Comparing versions with shell '[[' generally is fragile; instead use 'autoconf-archive/ax_compare_version.m4' or similar?) Also, 'configure'ing with '--disable-rpm415' doesn't work; same output as before. That's due to commit 26c41c060bf30750fe2cded87edaf1ae47027523 "Fix thinko in configure.ac", where either there was no thinko in fact (the original idea, I suppose, was only if 'test x$ENABLE_RPM = xyes' to do the 4.15+ 'auto' checking?), and/or a typo: instead of 'test x$ENABLE_RPM = xyes', the first conditional should 'test x$ENABLE_RPM415 = xyes'? And, 'configure'ing with '--enable-rpm415' doesn't raise a hard error if 'rpm' actually isn't 4.15+. But all that said, we don't actually need to check for rpm 4.15+ version, but instead may simply check for the rpm/zstd support that we need: 'rpm2cpio'. * configure.ac: Instead of for rpm 4.15+ version, test actual rpm/zstd support. * tests/test-diff-pkg.cc: Adjust. Signed-off-by: Thomas Schwinge --- configure.ac | 48 +++++++++++++++++++++++++++++------------- tests/test-diff-pkg.cc | 5 ++--- 2 files changed, 35 insertions(+), 18 deletions(-) diff --git configure.ac configure.ac index 5342a269..a77ab4d8 100644 --- configure.ac +++ configure.ac @@ -64,11 +64,12 @@ AC_ARG_ENABLE(rpm, ENABLE_RPM=$enableval, ENABLE_RPM=auto) +# '--enable-rpm415' option name preserved for backwards compatibility. AC_ARG_ENABLE(rpm415, AS_HELP_STRING([--enable-rpm415=yes|no|auto], - [enable the support of rpm 4.15 or higher in abipkgdiff (default is auto)]), - ENABLE_RPM415=$enableval, - ENABLE_RPM415=auto) + [enable rpm/zstd in abipkgdiff testing (default is auto)]), + ENABLE_RPM_ZSTD=$enableval, + ENABLE_RPM_ZSTD=auto) AC_ARG_ENABLE(debug-self-comparison, AS_HELP_STRING([--enable-debug-self-comparison=yes|no], @@ -314,23 +315,40 @@ if test x$ENABLE_RPM = xyes -o x$ENABLE_RPM = xauto; then fi fi -if test x$ENABLE_RPM = xyes -o x$ENABLE_RPM415 = xauto; then - rpmversion=$(rpm --version | sed "s/RPM version //") - AC_MSG_NOTICE([detected rpm version: $rpmversion]) - if [[[ "$rpmversion" > "4.14.0" ]]]; then - ENABLE_RPM415=yes - else - ENABLE_RPM415=no - fi +dnl Point to a rpm/zstd file, that is: +dnl $ rpm -qp --qf '%{PAYLOADCOMPRESSOR}\n' [rpm_zstd_file] +dnl zstd +m4_define([rpm_zstd_file], [tests/data/test-diff-pkg/mesa-libGLU-9.0.1-3.fc33.x86_64.rpm]) +AC_CONFIG_SRCDIR([rpm_zstd_file]) +if test x$ENABLE_RPM_ZSTD = xyes -o x$ENABLE_RPM_ZSTD = xauto; then + if test x$ENABLE_RPM = xno; then + if test x$ENABLE_RPM_ZSTD = xyes; then + AC_MSG_ERROR([rpm/zstd support needs rpm support]) + fi + ENABLE_RPM_ZSTD=n/a + else + AC_MSG_CHECKING([for rpm/zstd support]) + rpm2cpio > /dev/null 2>&AS_MESSAGE_LOG_FD "$srcdir"/rpm_zstd_file + if test $? -eq 0; then + enable_rpm_zstd=yes + else + enable_rpm_zstd=no + fi + AC_MSG_RESULT([$enable_rpm_zstd]) + if test x$ENABLE_RPM_ZSTD:$enable_rpm_zstd = xyes:no; then + AC_MSG_ERROR([rpm/zstd support not available]) + fi + ENABLE_RPM_ZSTD=$enable_rpm_zstd + fi fi if test x$ENABLE_RPM = xyes; then AC_DEFINE([WITH_RPM], 1, [compile the rpm package support in abipkgdiff]) AC_MSG_NOTICE([rpm support in abipkgdiff is enabled]); - if test x$ENABLE_RPM415 = xyes; then - AC_DEFINE([WITH_RPM_4_15], 1, [has RPM 4.15 at least]) - AC_MSG_NOTICE([rpm 4.15 support in abipkgdiff tests is enabled]) + if test x$ENABLE_RPM_ZSTD = xyes; then + AC_DEFINE([WITH_RPM_ZSTD], 1, [has rpm/zstd support]) + AC_MSG_NOTICE([rpm/zstd in abipkgdiff testing is enabled]) fi else AC_MSG_NOTICE([rpm support in abipkgdiff is disabled]); @@ -980,7 +998,7 @@ AC_MSG_NOTICE([ C++ standard level : ${CXX_STANDARD} libdw has the dwarf_getalt function : ${FOUND_DWARF_GETALT_IN_LIBDW} Enable rpm support in abipkgdiff : ${ENABLE_RPM} - Enable rpm 4.15 support in abipkgdiff tests : ${ENABLE_RPM415} + Enable rpm/zstd in abipkgdiff testing : ${ENABLE_RPM_ZSTD} Enable self comparison debugging : ${ENABLE_DEBUG_SELF_COMPARISON} Enable type canonicalization debugging : ${ENABLE_DEBUG_TYPE_CANONICALIZATION} Enable deb support in abipkgdiff : ${ENABLE_DEB} diff --git tests/test-diff-pkg.cc tests/test-diff-pkg.cc index c9e221b7..bcf2e38e 100644 --- tests/test-diff-pkg.cc +++ tests/test-diff-pkg.cc @@ -605,8 +605,7 @@ static InOutSpec in_out_specs[] = "data/test-diff-pkg/PR24690/PR24690-report-0.txt", "output/test-diff-pkg/PR24690/PR24690-report-0.txt" }, -#if WITH_RPM_4_15 - // This RPM version supports packages compressed with zstd. +#if WITH_RPM_ZSTD // RPMs from Fedora 31 onwards are compressed with zstd. { "data/test-diff-pkg/mesa-libGLU-9.0.1-3.fc33.x86_64.rpm", @@ -747,7 +746,7 @@ static InOutSpec in_out_specs[] = "data/test-diff-pkg/wireshark/wireshark-cli-3.4.9-1.fc36.x86_64-self-check-report.txt", "output/test-diff-pkg/wireshark/wireshark-cli-3.4.9-1.fc36.x86_64-self-check-report.txt" } , -#endif // WITH_RPM_4_15 +#endif // WITH_RPM_ZSTD #endif //WITH_RPM #ifdef WITH_DEB