From 668ae24750a1d5c1310d014bf62d91335722d938 Mon Sep 17 00:00:00 2001 From: Funda Wang Date: Wed, 8 Mar 2023 09:02:14 +0800 Subject: [PATCH] Fix output of installed_version_of macro when package is not installed --- clean_perl | 2 +- dist.sh | 5 ----- fix-libtool-ltmain-from-overlinking | 2 +- macros | 7 +++---- macros.anolis-misc | 2 +- macros.anolis-misc-srpm | 5 +++-- system-rpm-config.spec | 6 +++++- 7 files changed, 14 insertions(+), 15 deletions(-) diff --git a/clean_perl b/clean_perl index b9da345..1a1214a 100755 --- a/clean_perl +++ b/clean_perl @@ -11,7 +11,7 @@ perl -MConfig -e 'unlink "$ENV{RPM_BUILD_ROOT}$Config{installarchlib}/perllocal. for i in $(find $d -name "*.bs"); do if [ -s $i ]; then - echo "non empty .bs file, please mail rgarciasuarez@mandriva.com about this!" + echo "non empty .bs file" else rm -f $i fi diff --git a/dist.sh b/dist.sh index 0c9eed2..5aaa6c1 100755 --- a/dist.sh +++ b/dist.sh @@ -4,12 +4,7 @@ # License: GPL # This is a script to output the value for the %{dist} # tag. The dist tag takes the following format: .$type$num -# Where $type is one of: el, fc, rh -# (for RHEL, Fedora Core, and RHL, respectively) # And $num is the version number of the distribution. -# NOTE: We can't detect Rawhide or Fedora Test builds properly. -# If we successfully detect the version number, we output the -# dist tag. Otherwise, we exit with no output. RELEASEFILE=/etc/anolis-release diff --git a/fix-libtool-ltmain-from-overlinking b/fix-libtool-ltmain-from-overlinking index b6b97e3..3a2e2e7 100755 --- a/fix-libtool-ltmain-from-overlinking +++ b/fix-libtool-ltmain-from-overlinking @@ -1,7 +1,7 @@ #!/bin/sh if [ -e ltmain.sh ]; then - echo "Fixing libtool's ltmain.sh to prevent overlinking (cf http://wiki.mandriva.com/en/Overlinking)" + echo "Fixing libtool's ltmain.sh to prevent overlinking" # a similar patch has been applied in ltmain.sh in libtool package # but this works even if autoreconf is not called diff --git a/macros b/macros index 6491930..2f4d46c 100644 --- a/macros +++ b/macros @@ -328,8 +328,7 @@ print(result) # we don't escape symbols '~', '"', etc. so be careful when changing this %_hardening_ldflags -Wl,-z,now %[ "%{toolchain}" == "gcc" ? "-specs=/usr/lib/rpm/anolis/anolis-hardened-ld" : "" ] -# Harden packages by default for Fedora 23+: -# https://fedorahosted.org/fesco/ticket/1384 (accepted on 2014-02-11) +# Harden packages by default for Anolis: # Use "%undefine _hardened_build" to disable. %_hardened_build 1 %_hardened_cflags %{?_hardened_build:%{_hardening_cflags}} @@ -362,7 +361,7 @@ print(result) %_ld_as_needed 1 %_ld_as_needed_flags %{?_ld_as_needed:-Wl,--as-needed} -# LTO is the default in Fedora. +# LTO is the default in Anolis. # "%define _lto_cflags %{nil}" to opt out # # We currently have -ffat-lto-objects turned on out of an abundance of @@ -394,7 +393,7 @@ print(result) #============================================================================== # ---- Generic auto req/prov filtering macros # -# http://fedoraproject.org/wiki/PackagingDrafts/AutoProvidesAndRequiresFiltering +# https://fedoraproject.org/wiki/PackagingDrafts/AutoProvidesAndRequiresFiltering # prevent anything matching from being scanned for provides %filter_provides_in(P) %{expand: \ diff --git a/macros.anolis-misc b/macros.anolis-misc index 2740849..cd96f10 100644 --- a/macros.anolis-misc +++ b/macros.anolis-misc @@ -1,4 +1,4 @@ -# Fedora macros, safe to use after the SRPM build stage +# Anolis macros, safe to use after the SRPM build stage # Lists files matching inclusion globs, excluding files matching exclusion # globs diff --git a/macros.anolis-misc-srpm b/macros.anolis-misc-srpm index f88e045..2d4000a 100644 --- a/macros.anolis-misc-srpm +++ b/macros.anolis-misc-srpm @@ -1,4 +1,4 @@ -# Fedora macros, safe to use at SRPM build stage +# Anolis macros, safe to use at SRPM build stage # A directory for rpm macros %rpmmacrodir /usr/lib/rpm/macros.d @@ -49,6 +49,7 @@ anolis.new_package(source_name, pkg_name, name_suffix, first, verbose) # -p query Provides besides name # (-r is useless when combined with -p, because # using -p means querying via Provides tag) +# output 0 if package not installed # # Usage example: # Requires: openssl-libs >= %{installed_version_of openssl-libs} @@ -62,5 +63,5 @@ anolis.new_package(source_name, pkg_name, name_suffix, first, verbose) %installed_version_of(rp) %(\ rpm -q %{-p:--whatprovides} %1 > /dev/null && \ %{-p: rpm -q --provides $(rpm -q --whatprovides %1) | grep '%1 =' | awk -F' = ' '{print $2}' } \ -%{!-p: rpm -q --queryformat="%%|EPOCH?{%%{EPOCH}:}:{}|%%{VERSION}%{-r:-%%{RELEASE}}" %1} +%{!-p: rpm -q --queryformat="%%|EPOCH?{%%{EPOCH}:}:{}|%%{VERSION}%{-r:-%%{RELEASE}}" %1} || echo 0 ) diff --git a/system-rpm-config.spec b/system-rpm-config.spec index 27917e1..a025ce4 100644 --- a/system-rpm-config.spec +++ b/system-rpm-config.spec @@ -1,4 +1,4 @@ -%define anolis_release 27 +%define anolis_release 28 Summary: Anolis OS specific rpm configuration files Name: system-rpm-config @@ -210,6 +210,10 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/anolis/srpm forge.lua %license MulanPSL %changelog +* Wed Mar 08 2023 Funda Wang - 1:23-28 +- Fix output of installed_version_of macro when package is not installed +- Cleanup macros + * Fri Feb 24 2023 Chunmei Xu - 1:23-27 - remove __brp_relink_symlinks temporarily -- Gitee