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

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