Igor Gnatenko 082d5d
From 9a316cbeb61549b3004692c9dd8437b9fa805e74 Mon Sep 17 00:00:00 2001
Igor Gnatenko d7aa14
From: Florian Festi <ffesti@redhat.com>
Igor Gnatenko d7aa14
Date: Thu, 9 Mar 2017 12:12:32 +0100
Mark Wielaard 284dc3
Subject: [PATCH] Fix check whether to allow rich deps in a given tag
Igor Gnatenko d7aa14
Igor Gnatenko d7aa14
Broken with 9d5bbd9774d00f50749bb045217eaf91c87b6de0
Igor Gnatenko d7aa14
Igor Gnatenko d7aa14
(cherry picked from commit e4349ef7292578a7286bfca2e68a150422e65c3c)
Igor Gnatenko d7aa14
---
Igor Gnatenko d7aa14
 build/parseReqs.c | 10 ++++++----
Igor Gnatenko d7aa14
 1 file changed, 6 insertions(+), 4 deletions(-)
Igor Gnatenko d7aa14
Igor Gnatenko d7aa14
diff --git a/build/parseReqs.c b/build/parseReqs.c
Igor Gnatenko d7aa14
index bd728ed2d..6c2aead4e 100644
Igor Gnatenko d7aa14
--- a/build/parseReqs.c
Igor Gnatenko d7aa14
+++ b/build/parseReqs.c
Igor Gnatenko d7aa14
@@ -129,6 +129,7 @@ rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTagVal tagN,
Igor Gnatenko d7aa14
     rpmTagVal nametag = RPMTAG_NOT_FOUND;
Igor Gnatenko d7aa14
     rpmsenseFlags Flags;
Igor Gnatenko d7aa14
     rpmRC rc = RPMRC_FAIL; /* assume failure */
Igor Gnatenko d7aa14
+    int allow_richdeps = 0;
Igor Gnatenko d7aa14
 
Igor Gnatenko d7aa14
     switch (tagN) {
Igor Gnatenko d7aa14
     default:
Igor Gnatenko d7aa14
@@ -139,9 +140,11 @@ rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTagVal tagN,
Igor Gnatenko d7aa14
     case RPMTAG_SUGGESTNAME:
Igor Gnatenko d7aa14
     case RPMTAG_SUPPLEMENTNAME:
Igor Gnatenko d7aa14
     case RPMTAG_ENHANCENAME:
Igor Gnatenko d7aa14
+    case RPMTAG_CONFLICTNAME:
Igor Gnatenko d7aa14
+	allow_richdeps = 1;
Igor Gnatenko d7aa14
+	/* fall through */
Igor Gnatenko d7aa14
     case RPMTAG_PROVIDENAME:
Igor Gnatenko d7aa14
     case RPMTAG_OBSOLETENAME:
Igor Gnatenko d7aa14
-    case RPMTAG_CONFLICTNAME:
Igor Gnatenko d7aa14
     case RPMTAG_ORDERNAME:
Igor Gnatenko d7aa14
 	nametag = tagN;
Igor Gnatenko d7aa14
 	break;
Igor Gnatenko d7aa14
@@ -149,6 +152,7 @@ rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTagVal tagN,
Igor Gnatenko d7aa14
 	/* XXX map legacy PreReq into Requires(pre,preun) */
Igor Gnatenko d7aa14
 	nametag = RPMTAG_REQUIRENAME;
Igor Gnatenko d7aa14
 	tagflags |= (RPMSENSE_SCRIPT_PRE|RPMSENSE_SCRIPT_PREUN);
Igor Gnatenko d7aa14
+	allow_richdeps = 1;
Igor Gnatenko d7aa14
 	break;
Igor Gnatenko d7aa14
     case RPMTAG_TRIGGERPREIN:
Igor Gnatenko d7aa14
 	nametag = RPMTAG_TRIGGERNAME;
Igor Gnatenko d7aa14
@@ -209,9 +213,7 @@ rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTagVal tagN,
Igor Gnatenko d7aa14
 
Igor Gnatenko d7aa14
 	if (r[0] == '(') {
Igor Gnatenko d7aa14
 	    struct parseRCPOTRichData data;
Igor Gnatenko d7aa14
-	    if (nametag != RPMTAG_REQUIRENAME && nametag != RPMTAG_CONFLICTNAME &&
Igor Gnatenko d7aa14
-			nametag != RPMTAG_RECOMMENDNAME && nametag != RPMTAG_SUPPLEMENTNAME &&
Igor Gnatenko d7aa14
-			nametag != RPMTAG_SUGGESTNAME && nametag != RPMTAG_ENHANCENAME) {
Igor Gnatenko d7aa14
+	    if (!allow_richdeps) {
Igor Gnatenko d7aa14
 		rasprintf(&emsg, _("No rich dependencies allowed for this type"));
Igor Gnatenko d7aa14
 		goto exit;
Igor Gnatenko d7aa14
 	    }