Blob Blame History Raw
From 9c1e995043a999dcac05a74aa8bcf934122d40ba Mon Sep 17 00:00:00 2001
From: Lubos Kardos <lkardos@redhat.com>
Date: Thu, 14 Apr 2016 13:12:51 +0200
Subject: [PATCH] Make creating index records consistent for rich and rich-weak
 deps

If a package contains a rich require dependency then this rich
dependency is parsed and also subdependencies are stored into the
require index.  For example for rich dependency "(A and B)" the whole
string "(A and B)" is stored into the index Requirename but
subdependcies "A" and "B" are stored into index too. Previously this
parsing and storing subdependencies was done only for require rich
dependencies. Now it is done also for weak rich dependecies (suggests,
supplements and recommends).
(rhbz:1325982)
---
 lib/rpmdb.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/lib/rpmdb.c b/lib/rpmdb.c
index 7992d9c..334c4d9 100644
--- a/lib/rpmdb.c
+++ b/lib/rpmdb.c
@@ -2342,9 +2342,19 @@ static rpmRC tag2index(dbiIndex dbi, rpmTagVal rpmtag,
 
 	rc += idxupdate(dbi, dbc, key, keylen, &rec);
 
-	if ((rpmtag == RPMTAG_REQUIRENAME || rpmtag == RPMTAG_CONFLICTNAME) && *(char *)key == '(') {
-	    if (rpmtdType(&tagdata) == RPM_STRING_ARRAY_TYPE) {
-		rc += updateRichDep(dbi, dbc, rpmtdGetString(&tagdata), &rec, idxupdate);
+	if (*(char *)key == '(') {
+	    switch (rpmtag) {
+	    case RPMTAG_REQUIRENAME:
+	    case RPMTAG_CONFLICTNAME:
+	    case RPMTAG_SUGGESTNAME:
+	    case RPMTAG_SUPPLEMENTNAME:
+	    case RPMTAG_RECOMMENDNAME:
+		if (rpmtdType(&tagdata) == RPM_STRING_ARRAY_TYPE) {
+		    rc += updateRichDep(dbi, dbc, rpmtdGetString(&tagdata),
+			&rec, idxupdate);
+		}
+	    default:
+		break;
 	    }
 	}
     }
-- 
1.9.3