Panu Matilainen 931d61
From a4afbb62c94c6e0dc18c1bf08336aeb4a91f82de Mon Sep 17 00:00:00 2001
Panu Matilainen 931d61
Message-Id: <a4afbb62c94c6e0dc18c1bf08336aeb4a91f82de.1587559252.git.pmatilai@redhat.com>
Panu Matilainen 931d61
From: Panu Matilainen <pmatilai@redhat.com>
Panu Matilainen 931d61
Date: Wed, 22 Apr 2020 14:12:47 +0300
Panu Matilainen 931d61
Subject: [PATCH] Don't look into source package provides in depsolving
Panu Matilainen 931d61
Panu Matilainen 931d61
Fixes regressions from commit 75ec16e660e784d7897b37cac1a2b9b135825f25:
Panu Matilainen 931d61
the newly added provides of to-be-built packages were being used for
Panu Matilainen 931d61
dependency resolution, such as spec satifying its own buildrequires,
Panu Matilainen 931d61
and matched against conflicts in installed packages.
Panu Matilainen 931d61
Panu Matilainen 931d61
Source packages cannot obsolete anything or provide capabilities or files
Panu Matilainen 931d61
to transactions, don't add them to rpmal at all. Explicitly skip checks
Panu Matilainen 931d61
against source provides, similarly to what we already did with obsoletes.
Panu Matilainen 931d61
Panu Matilainen 931d61
Fixes: #1189
Panu Matilainen 931d61
---
Panu Matilainen 931d61
 lib/depends.c | 8 ++++----
Panu Matilainen 931d61
 lib/rpmal.c   | 4 ++++
Panu Matilainen 931d61
 2 files changed, 8 insertions(+), 4 deletions(-)
Panu Matilainen 931d61
Panu Matilainen 931d61
diff --git a/lib/depends.c b/lib/depends.c
Panu Matilainen 931d61
index 6acb21dc3..579451926 100644
Panu Matilainen 931d61
--- a/lib/depends.c
Panu Matilainen 931d61
+++ b/lib/depends.c
Panu Matilainen 931d61
@@ -1040,6 +1040,10 @@ int rpmtsCheck(rpmts ts)
Panu Matilainen 931d61
 	checkDS(ts, dcache, p, rpmteNEVRA(p), rpmteDS(p, RPMTAG_OBSOLETENAME),
Panu Matilainen 931d61
 		tscolor);
Panu Matilainen 931d61
 
Panu Matilainen 931d61
+	/* Skip obsoletion and provides checks for source packages (ie build) */
Panu Matilainen 931d61
+	if (rpmteIsSource(p))
Panu Matilainen 931d61
+	    continue;
Panu Matilainen 931d61
+
Panu Matilainen 931d61
 	/* Check provides against conflicts in installed packages. */
Panu Matilainen 931d61
 	while (rpmdsNext(provides) >= 0) {
Panu Matilainen 931d61
 	    checkInstDeps(ts, dcache, p, RPMTAG_CONFLICTNAME, NULL, provides, 0);
Panu Matilainen 931d61
@@ -1047,10 +1051,6 @@ int rpmtsCheck(rpmts ts)
Panu Matilainen 931d61
 		checkInstDeps(ts, dcache, p, RPMTAG_REQUIRENAME, NULL, provides, 1);
Panu Matilainen 931d61
 	}
Panu Matilainen 931d61
 
Panu Matilainen 931d61
-	/* Skip obsoletion checks for source packages (ie build) */
Panu Matilainen 931d61
-	if (rpmteIsSource(p))
Panu Matilainen 931d61
-	    continue;
Panu Matilainen 931d61
-
Panu Matilainen 931d61
 	/* Check package name (not provides!) against installed obsoletes */
Panu Matilainen 931d61
 	checkInstDeps(ts, dcache, p, RPMTAG_OBSOLETENAME, NULL, rpmteDS(p, RPMTAG_NAME), 0);
Panu Matilainen 931d61
 
Panu Matilainen 931d61
diff --git a/lib/rpmal.c b/lib/rpmal.c
Panu Matilainen 931d61
index 3c8acd63a..8a47d025a 100644
Panu Matilainen 931d61
--- a/lib/rpmal.c
Panu Matilainen 931d61
+++ b/lib/rpmal.c
Panu Matilainen 931d61
@@ -247,6 +247,10 @@ void rpmalAdd(rpmal al, rpmte p)
Panu Matilainen 931d61
     rpmalNum pkgNum;
Panu Matilainen 931d61
     availablePackage alp;
Panu Matilainen 931d61
 
Panu Matilainen 931d61
+    /* Source packages don't provide anything to depsolving */
Panu Matilainen 931d61
+    if (rpmteIsSource(p))
Panu Matilainen 931d61
+	return;
Panu Matilainen 931d61
+
Panu Matilainen 931d61
     if (al->size == al->alloced) {
Panu Matilainen 931d61
 	al->alloced += al->delta;
Panu Matilainen 931d61
 	al->list = xrealloc(al->list, sizeof(*al->list) * al->alloced);
Panu Matilainen 931d61
-- 
Panu Matilainen 931d61
2.25.3
Panu Matilainen 931d61