Blame SOURCES/rpm-4.16.1.3-unbreak-checking-of-installed-rich-deps.patch

a5e32e
From 137ecc2e1841c2b27b99d4db9006253dd1c73dde Mon Sep 17 00:00:00 2001
a5e32e
From: Michael Schroeder <mls@suse.de>
a5e32e
Date: Fri, 4 Jun 2021 23:30:49 +0200
a5e32e
Subject: [PATCH] Unbreak checking of installed rich dependencies
a5e32e
a5e32e
Commit ddb32b9187e9ce85819a84ca8d202131fd9f8b9f added an
a5e32e
extra check that tests if the provide we are checking really
a5e32e
intersects the dependency from rpmdb. Unfortunately the
a5e32e
rpmdsCompare() call does not understand rich dependencies and
a5e32e
will consider them as not intersecting.
a5e32e
a5e32e
Unbreak the check by not doing the intersection test for
a5e32e
rich dependencies. We'll improve this in a later commit.
a5e32e
a5e32e
Also add test cases for dependency problems with installed
a5e32e
rich dependencies.
a5e32e
---
a5e32e
 lib/depends.c    |  2 +-
a5e32e
 tests/rpmdeps.at | 99 ++++++++++++++++++++++++++++++++++++++++++++++++
a5e32e
 2 files changed, 100 insertions(+), 1 deletion(-)
a5e32e
a5e32e
diff --git a/lib/depends.c b/lib/depends.c
a5e32e
index c10ba4bda..fecbd9675 100644
a5e32e
--- a/lib/depends.c
a5e32e
+++ b/lib/depends.c
a5e32e
@@ -846,7 +846,7 @@ static void checkInstDeps(rpmts ts, depCache dcache, rpmte te,
a5e32e
 	rpmdsSetIx(ds, rpmdbGetIteratorFileNum(mi));
a5e32e
 
a5e32e
 	/* Is it in our range at all? (but file deps have no range) */
a5e32e
-	if (depds)
a5e32e
+	if (depds && !rpmdsIsRich(ds))
a5e32e
 	    match = rpmdsCompare(ds, depds);
a5e32e
 
a5e32e
 	if (match && unsatisfiedDepend(ts, dcache, ds) == is_problem) {
a5e32e
diff --git a/tests/rpmdeps.at b/tests/rpmdeps.at
a5e32e
index 67bde1dc8..8357af9df 100644
a5e32e
--- a/tests/rpmdeps.at
a5e32e
+++ b/tests/rpmdeps.at
a5e32e
@@ -732,3 +732,102 @@ runroot rpm -U /build/RPMS/noarch/deptest-one-1.0-1.noarch.rpm /build/RPMS/noarc
a5e32e
 [],
a5e32e
 [])
a5e32e
 AT_CLEANUP
a5e32e
+
a5e32e
+# ------------------------------
a5e32e
+#
a5e32e
+AT_SETUP([install to break installed rich dependency])
a5e32e
+AT_KEYWORDS([install, boolean])
a5e32e
+RPMDB_INIT
a5e32e
+
a5e32e
+runroot rpmbuild --quiet -bb \
a5e32e
+	--define "pkg one" \
a5e32e
+	--define "cfls (deptest-three or deptest-five)" \
a5e32e
+	  /data/SPECS/deptest.spec
a5e32e
+runroot rpmbuild --quiet -bb \
a5e32e
+	--define "pkg two" \
a5e32e
+	--define "reqs (deptest-five if deptest-four)" \
a5e32e
+	  /data/SPECS/deptest.spec
a5e32e
+runroot rpmbuild --quiet -bb \
a5e32e
+	--define "pkg three" \
a5e32e
+	  /data/SPECS/deptest.spec
a5e32e
+runroot rpmbuild --quiet -bb \
a5e32e
+	--define "pkg four" \
a5e32e
+	  /data/SPECS/deptest.spec
a5e32e
+
a5e32e
+# installed conflict with "or" clause
a5e32e
+AT_CHECK([
a5e32e
+RPMDB_INIT
a5e32e
+
a5e32e
+runroot rpm -U /build/RPMS/noarch/deptest-one-1.0-1.noarch.rpm
a5e32e
+runroot rpm -U /build/RPMS/noarch/deptest-three-1.0-1.noarch.rpm
a5e32e
+],
a5e32e
+[1],
a5e32e
+[],
a5e32e
+[error: Failed dependencies:
a5e32e
+	(deptest-three or deptest-five) conflicts with (installed) deptest-one-1.0-1.noarch
a5e32e
+])
a5e32e
+
a5e32e
+# installed requires with "if" clause
a5e32e
+AT_CHECK([
a5e32e
+RPMDB_INIT
a5e32e
+
a5e32e
+runroot rpm -U /build/RPMS/noarch/deptest-two-1.0-1.noarch.rpm
a5e32e
+runroot rpm -U /build/RPMS/noarch/deptest-four-1.0-1.noarch.rpm
a5e32e
+],
a5e32e
+[1],
a5e32e
+[],
a5e32e
+[error: Failed dependencies:
a5e32e
+	(deptest-five if deptest-four) is needed by (installed) deptest-two-1.0-1.noarch
a5e32e
+])
a5e32e
+AT_CLEANUP
a5e32e
+
a5e32e
+# ------------------------------
a5e32e
+#
a5e32e
+AT_SETUP([erase to break installed rich dependency])
a5e32e
+AT_KEYWORDS([install, boolean])
a5e32e
+RPMDB_INIT
a5e32e
+
a5e32e
+runroot rpmbuild --quiet -bb \
a5e32e
+	--define "pkg one" \
a5e32e
+	--define "reqs (deptest-three or deptest-five)" \
a5e32e
+	  /data/SPECS/deptest.spec
a5e32e
+runroot rpmbuild --quiet -bb \
a5e32e
+	--define "pkg two" \
a5e32e
+	--define "cfls (deptest-five unless deptest-four)" \
a5e32e
+	  /data/SPECS/deptest.spec
a5e32e
+runroot rpmbuild --quiet -bb \
a5e32e
+	--define "pkg three" \
a5e32e
+	  /data/SPECS/deptest.spec
a5e32e
+runroot rpmbuild --quiet -bb \
a5e32e
+	--define "pkg four" \
a5e32e
+	  /data/SPECS/deptest.spec
a5e32e
+runroot rpmbuild --quiet -bb \
a5e32e
+	--define "pkg five" \
a5e32e
+	  /data/SPECS/deptest.spec
a5e32e
+
a5e32e
+# installed requires with "or" clause
a5e32e
+AT_CHECK([
a5e32e
+RPMDB_INIT
a5e32e
+
a5e32e
+runroot rpm -U /build/RPMS/noarch/deptest-one-1.0-1.noarch.rpm /build/RPMS/noarch/deptest-three-1.0-1.noarch.rpm
a5e32e
+runroot rpm -e deptest-three
a5e32e
+],
a5e32e
+[1],
a5e32e
+[],
a5e32e
+[error: Failed dependencies:
a5e32e
+	(deptest-three or deptest-five) is needed by (installed) deptest-one-1.0-1.noarch
a5e32e
+])
a5e32e
+
a5e32e
+# installed conflicts with "unless" clause
a5e32e
+AT_CHECK([
a5e32e
+RPMDB_INIT
a5e32e
+
a5e32e
+runroot rpm -U /build/RPMS/noarch/deptest-two-1.0-1.noarch.rpm /build/RPMS/noarch/deptest-four-1.0-1.noarch.rpm /build/RPMS/noarch/deptest-five-1.0-1.noarch.rpm
a5e32e
+runroot rpm -e deptest-four
a5e32e
+],
a5e32e
+[1],
a5e32e
+[],
a5e32e
+[error: Failed dependencies:
a5e32e
+	(deptest-five unless deptest-four) conflicts with (installed) deptest-two-1.0-1.noarch
a5e32e
+])
a5e32e
+AT_CLEANUP
a5e32e
-- 
a5e32e
2.33.1
a5e32e