From c169fc86ccbb1fd054f0758c0b6d2bd6eade24c8 Mon Sep 17 00:00:00 2001 From: Michal Domonkos Date: Mon, 24 Nov 2025 16:51:04 +0100 Subject: [PATCH 1/2] Fix pre/post/meta/etc. qualifiers for weak deps Resolves: RHEL-101936 --- ...lifiers-like-pre-post-meta-for-weak-.patch | 118 ++++++++++++++++++ rpm.spec | 7 +- 2 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 0001-Really-allow-qualifiers-like-pre-post-meta-for-weak-.patch diff --git a/0001-Really-allow-qualifiers-like-pre-post-meta-for-weak-.patch b/0001-Really-allow-qualifiers-like-pre-post-meta-for-weak-.patch new file mode 100644 index 0000000..d26d77a --- /dev/null +++ b/0001-Really-allow-qualifiers-like-pre-post-meta-for-weak-.patch @@ -0,0 +1,118 @@ +From a382c58a59848d1a6f137ff9e2bc435ca99c31cf Mon Sep 17 00:00:00 2001 +From: Panu Matilainen +Date: Tue, 12 Mar 2024 14:28:13 +0200 +Subject: [PATCH 1/2] Add the ability to pass qualifiers to our dependency + tests + +(cherry picked from commit 9cb05896f70ebc480f717d3f2f958e933b451a40) +--- + tests/data/SPECS/deptest.spec | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/tests/data/SPECS/deptest.spec b/tests/data/SPECS/deptest.spec +index 5a1ecdc55..f7cc12df2 100644 +--- a/tests/data/SPECS/deptest.spec ++++ b/tests/data/SPECS/deptest.spec +@@ -8,15 +8,15 @@ Summary: Testing dependency behavior + Group: Testing + License: GPL + BuildArch: noarch +-%{?reqs:Requires: %{reqs}} ++%{?reqs:Requires%{?reqflags:(%{reqflags})}: %{reqs}} + %{?provs:Provides: %{provs}} + %{?cfls:Conflicts: %{cfls}} + %{?obs:Obsoletes: %{obs}} +-%{?recs:Recommends: %{recs}} +-%{?sugs:Suggests: %{sugs}} +-%{?sups:Supplements: %{sups}} +-%{?ens:Enhances: %{ens}} +-%{?ord:OrderWithRequires: %{ord}} ++%{?recs:Recommends%{?recflags:(%{recflags})}: %{recs}} ++%{?sugs:Suggests%{?sugflags:(%{sugflags})}: %{sugs}} ++%{?sups:Supplements%{?supflags:(%{supflags})}: %{sups}} ++%{?ens:Enhances%{?ensflags:(%{ensflags})}: %{ens}} ++%{?ord:OrderWithRequires%{?ordflags:(%{ordflags})}: %{ord}} + %{?buildreqs:BuildRequires: %{buildreqs}} + %{?buildcfls:BuildConflicts: %{buildcfls}} + +-- +2.52.0 + + +From 480294fb8bfb8c4b0544eccc2dd47fb25999255d Mon Sep 17 00:00:00 2001 +From: Panu Matilainen +Date: Tue, 12 Mar 2024 13:55:09 +0200 +Subject: [PATCH 2/2] Really allow qualifiers like pre/post/meta for weak + dependencies + +Commit ddbf30cf96a33319805b362b01d8a6fdfe7dea9c neglected to update the +preamble table types for the weak dependency tags, so it never worked. +Add a test to ensure it works and stays that way. + +Test depends on 078ccae5a655e044a9b867206cf4215acb3f0113 + +Fixes: #624 +(backported from commit 0644ba5755360cd6a33caa41ea09d3e25096bc72) +--- + build/parsePreamble.c | 8 ++++---- + tests/rpmbuild.at | 18 ++++++++++-------- + 2 files changed, 14 insertions(+), 12 deletions(-) + +diff --git a/build/parsePreamble.c b/build/parsePreamble.c +index de205d5f8..3693746f8 100644 +--- a/build/parsePreamble.c ++++ b/build/parsePreamble.c +@@ -1032,10 +1032,10 @@ static struct PreambleRec_s const preambleList[] = { + {RPMTAG_ICON, 0, 0, 0, LEN_AND_STR("icon")}, + {RPMTAG_PROVIDENAME, 0, 0, 0, LEN_AND_STR("provides")}, + {RPMTAG_REQUIRENAME, 2, 0, 0, LEN_AND_STR("requires")}, +- {RPMTAG_RECOMMENDNAME, 0, 0, 0, LEN_AND_STR("recommends")}, +- {RPMTAG_SUGGESTNAME, 0, 0, 0, LEN_AND_STR("suggests")}, +- {RPMTAG_SUPPLEMENTNAME, 0, 0, 0, LEN_AND_STR("supplements")}, +- {RPMTAG_ENHANCENAME, 0, 0, 0, LEN_AND_STR("enhances")}, ++ {RPMTAG_RECOMMENDNAME, 2, 0, 0, LEN_AND_STR("recommends")}, ++ {RPMTAG_SUGGESTNAME, 2, 0, 0, LEN_AND_STR("suggests")}, ++ {RPMTAG_SUPPLEMENTNAME, 2, 0, 0, LEN_AND_STR("supplements")}, ++ {RPMTAG_ENHANCENAME, 2, 0, 0, LEN_AND_STR("enhances")}, + {RPMTAG_PREREQ, 2, 1, 0, LEN_AND_STR("prereq")}, + {RPMTAG_CONFLICTNAME, 0, 0, 0, LEN_AND_STR("conflicts")}, + {RPMTAG_OBSOLETENAME, 0, 0, 0, LEN_AND_STR("obsoletes")}, +diff --git a/tests/rpmbuild.at b/tests/rpmbuild.at +index f98e4988f..1d61afd2f 100644 +--- a/tests/rpmbuild.at ++++ b/tests/rpmbuild.at +@@ -753,21 +753,23 @@ RPMDB_INIT + runroot rpmbuild -bb --quiet \ + --define "pkg weakdeps" \ + --define "recs foo > 1.2.3" \ ++ --define "recflags post" \ + --define "sugs bar >= 0.1.2" \ + --define "sups baz" \ ++ --define "supflags preun" \ + --define "ens zap = 3" \ + /data/SPECS/deptest.spec + +-runroot rpm -qp --recommends /build/RPMS/noarch/deptest-weakdeps-1.0-1.noarch.rpm +-runroot rpm -qp --suggests /build/RPMS/noarch/deptest-weakdeps-1.0-1.noarch.rpm +-runroot rpm -qp --supplements /build/RPMS/noarch/deptest-weakdeps-1.0-1.noarch.rpm +-runroot rpm -qp --enhances /build/RPMS/noarch/deptest-weakdeps-1.0-1.noarch.rpm ++runroot rpm -qpv --recommends /build/RPMS/noarch/deptest-weakdeps-1.0-1.noarch.rpm ++runroot rpm -qpv --suggests /build/RPMS/noarch/deptest-weakdeps-1.0-1.noarch.rpm ++runroot rpm -qpv --supplements /build/RPMS/noarch/deptest-weakdeps-1.0-1.noarch.rpm ++runroot rpm -qpv --enhances /build/RPMS/noarch/deptest-weakdeps-1.0-1.noarch.rpm + ], + [0], +-[foo > 1.2.3 +-bar >= 0.1.2 +-baz +-zap = 3 ++[post: foo > 1.2.3 ++manual: bar >= 0.1.2 ++preun: baz ++manual: zap = 3 + ], + [ignore]) + RPMTEST_CLEANUP +-- +2.52.0 + diff --git a/rpm.spec b/rpm.spec index 0244d52..a1e3c4b 100644 --- a/rpm.spec +++ b/rpm.spec @@ -27,7 +27,7 @@ %global rpmver 4.19.1.1 #global snapver rc1 -%global baserelease 20 +%global baserelease 21 %global sover 10 %global srcver %{rpmver}%{?snapver:-%{snapver}} @@ -169,6 +169,8 @@ rpm-4.19.x-multisig.patch rpm-4.19.x-pqc-algo.patch rpm-4.19.x-pqc-fixes.patch +0001-Really-allow-qualifiers-like-pre-post-meta-for-weak-.patch + # These are not yet upstream rpm-4.7.1-geode-i686.patch @@ -658,6 +660,9 @@ fi %doc %{_defaultdocdir}/rpm/API/ %changelog +* Thu Nov 27 2025 Michal Domonkos - 4.19.1.1-21 +- Fix pre/post/meta/etc. qualifiers for weak dependencies (RHEL-101936) + * Tue Aug 26 2025 Michal Domonkos - 4.19.1.1-20 - Fix rpmsign(8) man page (RHEL-109221) From e4753ed8149c279fe931c5fe90a488329bfeabfb Mon Sep 17 00:00:00 2001 From: Michal Domonkos Date: Thu, 27 Nov 2025 12:58:44 +0100 Subject: [PATCH 2/2] Fix redundant rpmdb-migrate.service runs We turn the old path (/var/lib/rpm) into a symlink when the migration is done but then keep retriggering the migration service whenever rpm is upgraded since the -d conditional is still true. This has no actual effect since the rpmdb_migrate script does check whether it's a symlink and bails out if so, but it causes unnecessary noise in the journal, so fix that by checking for the symlink in the %posttrans scriptlet right away. Do the same in %pre, even though there the find command doesn't follow symlinks by default so it won't produce any files to iterate over. Still, fix that as well, if just for the sake of consistency. Resolves: RHEL-96510 --- rpm.spec | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rpm.spec b/rpm.spec index a1e3c4b..1b297d5 100644 --- a/rpm.spec +++ b/rpm.spec @@ -464,7 +464,7 @@ rm $RPM_BUILD_ROOT/%{rpmhome}/rpmdump %pre # Symlink all rpmdb files to the new location if we're still using /var/lib/rpm -if [ -d /var/lib/rpm ]; then +if [ ! -L /var/lib/rpm ] && [ -d /var/lib/rpm ]; then mkdir -p /usr/lib/sysimage/rpm rpmdb_files=$(find /var/lib/rpm -maxdepth 1 -type f | sed 's|^/var/lib/rpm/||g' | sort) for rpmdb_file in ${rpmdb_files[@]}; do @@ -479,7 +479,7 @@ if [ -x /usr/bin/systemctl ]; then fi %posttrans -if [ -d /var/lib/rpm ]; then +if [ ! -L /var/lib/rpm ] && [ -d /var/lib/rpm ]; then touch /var/lib/rpm/.migratedb fi if [ ! -d /var/lib/rpm ] && [ -d /usr/lib/sysimage/rpm ] && [ ! -f /usr/lib/sysimage/rpm/.rpmdbdirsymlink_created ]; then @@ -662,6 +662,7 @@ fi %changelog * Thu Nov 27 2025 Michal Domonkos - 4.19.1.1-21 - Fix pre/post/meta/etc. qualifiers for weak dependencies (RHEL-101936) +- Fix redundant rpmdb-migrate.service runs (RHEL-96510) * Tue Aug 26 2025 Michal Domonkos - 4.19.1.1-20 - Fix rpmsign(8) man page (RHEL-109221)