Igor Gnatenko 082d5d
From 287cda21a5594ad41ffbd29eb01022f314637bdf Mon Sep 17 00:00:00 2001
Igor Gnatenko d7aa14
From: Florian Festi <ffesti@redhat.com>
Igor Gnatenko d7aa14
Date: Tue, 28 Feb 2017 10:57:56 +0100
Mark Wielaard 284dc3
Subject: [PATCH] Use RPMTAG_*NAME instead of RPMTAG_*FLAGS in parsePreamble.c
Mark Wielaard 284dc3
 and parseRCPOT()
Igor Gnatenko d7aa14
Igor Gnatenko d7aa14
Using the FLGS tags is awkward and inconsistent with other part of the code
Igor Gnatenko d7aa14
routinly use the NAME tags to denominate the type of dependencies.
Igor Gnatenko d7aa14
This is also going to make using parseRCPOT() easier for the rpmfc code
Igor Gnatenko d7aa14
that is also based on NAME tags.
Igor Gnatenko d7aa14
Igor Gnatenko d7aa14
(cherry picked from commit 9d5bbd9774d00f50749bb045217eaf91c87b6de0)
Igor Gnatenko d7aa14
---
Igor Gnatenko d7aa14
 build/parsePreamble.c | 36 ++++++++++++++++++------------------
Igor Gnatenko d7aa14
 build/parseReqs.c     | 37 +++++++++++--------------------------
Igor Gnatenko d7aa14
 build/rpmfc.c         |  2 +-
Igor Gnatenko d7aa14
 3 files changed, 30 insertions(+), 45 deletions(-)
Igor Gnatenko d7aa14
Igor Gnatenko d7aa14
diff --git a/build/parsePreamble.c b/build/parsePreamble.c
Igor Gnatenko 34e0e8
index 3bb833cff..bc639e86c 100644
Igor Gnatenko d7aa14
--- a/build/parsePreamble.c
Igor Gnatenko d7aa14
+++ b/build/parsePreamble.c
Igor Gnatenko 34e0e8
@@ -850,8 +850,8 @@ static rpmRC handlePreambleTag(rpmSpec spec, Package pkg, rpmTagVal tag,
Igor Gnatenko d7aa14
 	if (parseNoSource(spec, field, tag))
Igor Gnatenko d7aa14
 	    goto exit;
Igor Gnatenko d7aa14
 	break;
Igor Gnatenko d7aa14
-    case RPMTAG_ORDERFLAGS:
Igor Gnatenko d7aa14
-    case RPMTAG_REQUIREFLAGS:
Igor Gnatenko d7aa14
+    case RPMTAG_ORDERNAME:
Igor Gnatenko d7aa14
+    case RPMTAG_REQUIRENAME:
Igor Gnatenko d7aa14
 	if (parseBits(lang, installScriptBits, &tagflags)) {
Igor Gnatenko d7aa14
 	    rpmlog(RPMLOG_ERR, _("line %d: Bad %s: qualifiers: %s\n"),
Igor Gnatenko d7aa14
 		     spec->lineNum, rpmTagGetName(tag), spec->line);
Igor Gnatenko 34e0e8
@@ -859,13 +859,13 @@ static rpmRC handlePreambleTag(rpmSpec spec, Package pkg, rpmTagVal tag,
Igor Gnatenko d7aa14
 	}
Igor Gnatenko d7aa14
 	/* fallthrough */
Igor Gnatenko d7aa14
     case RPMTAG_PREREQ:
Igor Gnatenko d7aa14
-    case RPMTAG_RECOMMENDFLAGS:
Igor Gnatenko d7aa14
-    case RPMTAG_SUGGESTFLAGS:
Igor Gnatenko d7aa14
-    case RPMTAG_SUPPLEMENTFLAGS:
Igor Gnatenko d7aa14
-    case RPMTAG_ENHANCEFLAGS:
Igor Gnatenko d7aa14
-    case RPMTAG_CONFLICTFLAGS:
Igor Gnatenko d7aa14
-    case RPMTAG_OBSOLETEFLAGS:
Igor Gnatenko d7aa14
-    case RPMTAG_PROVIDEFLAGS:
Igor Gnatenko d7aa14
+    case RPMTAG_RECOMMENDNAME:
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
+    case RPMTAG_OBSOLETENAME:
Igor Gnatenko d7aa14
+    case RPMTAG_PROVIDENAME:
Igor Gnatenko d7aa14
 	if (parseRCPOT(spec, pkg, field, tag, 0, tagflags))
Igor Gnatenko d7aa14
 	    goto exit;
Igor Gnatenko d7aa14
 	break;
Igor Gnatenko 34e0e8
@@ -970,15 +970,15 @@ static struct PreambleRec_s const preambleList[] = {
Igor Gnatenko d7aa14
     {RPMTAG_EXCLUDEOS,		0, 0, LEN_AND_STR("excludeos")},
Igor Gnatenko d7aa14
     {RPMTAG_EXCLUSIVEOS,	0, 0, LEN_AND_STR("exclusiveos")},
Igor Gnatenko d7aa14
     {RPMTAG_ICON,		0, 0, LEN_AND_STR("icon")},
Igor Gnatenko d7aa14
-    {RPMTAG_PROVIDEFLAGS,	0, 0, LEN_AND_STR("provides")},
Igor Gnatenko d7aa14
-    {RPMTAG_REQUIREFLAGS,	2, 0, LEN_AND_STR("requires")},
Igor Gnatenko d7aa14
-    {RPMTAG_RECOMMENDFLAGS,	0, 0, LEN_AND_STR("recommends")},
Igor Gnatenko d7aa14
-    {RPMTAG_SUGGESTFLAGS,	0, 0, LEN_AND_STR("suggests")},
Igor Gnatenko d7aa14
-    {RPMTAG_SUPPLEMENTFLAGS,	0, 0, LEN_AND_STR("supplements")},
Igor Gnatenko d7aa14
-    {RPMTAG_ENHANCEFLAGS,	0, 0, LEN_AND_STR("enhances")},
Igor Gnatenko d7aa14
+    {RPMTAG_PROVIDENAME,	0, 0, LEN_AND_STR("provides")},
Igor Gnatenko d7aa14
+    {RPMTAG_REQUIRENAME,	2, 0, LEN_AND_STR("requires")},
Igor Gnatenko d7aa14
+    {RPMTAG_RECOMMENDNAME,	0, 0, LEN_AND_STR("recommends")},
Igor Gnatenko d7aa14
+    {RPMTAG_SUGGESTNAME,	0, 0, LEN_AND_STR("suggests")},
Igor Gnatenko d7aa14
+    {RPMTAG_SUPPLEMENTNAME,	0, 0, LEN_AND_STR("supplements")},
Igor Gnatenko d7aa14
+    {RPMTAG_ENHANCENAME,	0, 0, LEN_AND_STR("enhances")},
Igor Gnatenko d7aa14
     {RPMTAG_PREREQ,		2, 1, LEN_AND_STR("prereq")},
Igor Gnatenko d7aa14
-    {RPMTAG_CONFLICTFLAGS,	0, 0, LEN_AND_STR("conflicts")},
Igor Gnatenko d7aa14
-    {RPMTAG_OBSOLETEFLAGS,	0, 0, LEN_AND_STR("obsoletes")},
Igor Gnatenko d7aa14
+    {RPMTAG_CONFLICTNAME,	0, 0, LEN_AND_STR("conflicts")},
Igor Gnatenko d7aa14
+    {RPMTAG_OBSOLETENAME,	0, 0, LEN_AND_STR("obsoletes")},
Igor Gnatenko d7aa14
     {RPMTAG_PREFIXES,		0, 0, LEN_AND_STR("prefixes")},
Igor Gnatenko d7aa14
     {RPMTAG_PREFIXES,		0, 0, LEN_AND_STR("prefix")},
Igor Gnatenko d7aa14
     {RPMTAG_BUILDROOT,		0, 0, LEN_AND_STR("buildroot")},
Igor Gnatenko 34e0e8
@@ -993,7 +993,7 @@ static struct PreambleRec_s const preambleList[] = {
Igor Gnatenko d7aa14
     {RPMTAG_DOCDIR,		0, 0, LEN_AND_STR("docdir")},
Igor Gnatenko d7aa14
     {RPMTAG_DISTTAG,		0, 0, LEN_AND_STR("disttag")},
Igor Gnatenko d7aa14
     {RPMTAG_BUGURL,		0, 0, LEN_AND_STR("bugurl")},
Igor Gnatenko d7aa14
-    {RPMTAG_ORDERFLAGS,		2, 0, LEN_AND_STR("orderwithrequires")},
Igor Gnatenko d7aa14
+    {RPMTAG_ORDERNAME,		2, 0, LEN_AND_STR("orderwithrequires")},
Igor Gnatenko d7aa14
     {RPMTAG_REMOVEPATHPOSTFIXES,0, 0, LEN_AND_STR("removepathpostfixes")},
Igor Gnatenko d7aa14
     {0, 0, 0, 0}
Igor Gnatenko d7aa14
 };
Igor Gnatenko d7aa14
diff --git a/build/parseReqs.c b/build/parseReqs.c
Igor Gnatenko d7aa14
index a443505e4..bd728ed2d 100644
Igor Gnatenko d7aa14
--- a/build/parseReqs.c
Igor Gnatenko d7aa14
+++ b/build/parseReqs.c
Igor Gnatenko d7aa14
@@ -132,33 +132,18 @@ rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTagVal tagN,
Igor Gnatenko d7aa14
 
Igor Gnatenko d7aa14
     switch (tagN) {
Igor Gnatenko d7aa14
     default:
Igor Gnatenko d7aa14
-    case RPMTAG_REQUIREFLAGS:
Igor Gnatenko d7aa14
-	nametag = RPMTAG_REQUIRENAME;
Igor Gnatenko d7aa14
+    case RPMTAG_REQUIRENAME:
Igor Gnatenko d7aa14
 	tagflags |= RPMSENSE_ANY;
Igor Gnatenko d7aa14
-	break;
Igor Gnatenko d7aa14
-    case RPMTAG_RECOMMENDFLAGS:
Igor Gnatenko d7aa14
-	nametag = RPMTAG_RECOMMENDNAME;
Igor Gnatenko d7aa14
-	break;
Igor Gnatenko d7aa14
-    case RPMTAG_SUGGESTFLAGS:
Igor Gnatenko d7aa14
-	nametag = RPMTAG_SUGGESTNAME;
Igor Gnatenko d7aa14
-	break;
Igor Gnatenko d7aa14
-    case RPMTAG_SUPPLEMENTFLAGS:
Igor Gnatenko d7aa14
-	nametag = RPMTAG_SUPPLEMENTNAME;
Igor Gnatenko d7aa14
-	break;
Igor Gnatenko d7aa14
-    case RPMTAG_ENHANCEFLAGS:
Igor Gnatenko d7aa14
-	nametag = RPMTAG_ENHANCENAME;
Igor Gnatenko d7aa14
-	break;
Igor Gnatenko d7aa14
-    case RPMTAG_PROVIDEFLAGS:
Igor Gnatenko d7aa14
-	nametag = RPMTAG_PROVIDENAME;
Igor Gnatenko d7aa14
-	break;
Igor Gnatenko d7aa14
-    case RPMTAG_OBSOLETEFLAGS:
Igor Gnatenko d7aa14
-	nametag = RPMTAG_OBSOLETENAME;
Igor Gnatenko d7aa14
-	break;
Igor Gnatenko d7aa14
-    case RPMTAG_CONFLICTFLAGS:
Igor Gnatenko d7aa14
-	nametag = RPMTAG_CONFLICTNAME;
Igor Gnatenko d7aa14
-	break;
Igor Gnatenko d7aa14
-    case RPMTAG_ORDERFLAGS:
Igor Gnatenko d7aa14
-	nametag = RPMTAG_ORDERNAME;
Igor Gnatenko d7aa14
+	/* fall through */
Igor Gnatenko d7aa14
+    case RPMTAG_RECOMMENDNAME:
Igor Gnatenko d7aa14
+    case RPMTAG_SUGGESTNAME:
Igor Gnatenko d7aa14
+    case RPMTAG_SUPPLEMENTNAME:
Igor Gnatenko d7aa14
+    case RPMTAG_ENHANCENAME:
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
     case RPMTAG_PREREQ:
Igor Gnatenko d7aa14
 	/* XXX map legacy PreReq into Requires(pre,preun) */
Igor Gnatenko d7aa14
diff --git a/build/rpmfc.c b/build/rpmfc.c
Igor Gnatenko d7aa14
index 73915015a..ce192fa9c 100644
Igor Gnatenko d7aa14
--- a/build/rpmfc.c
Igor Gnatenko d7aa14
+++ b/build/rpmfc.c
Igor Gnatenko d7aa14
@@ -1297,7 +1297,7 @@ static rpmRC rpmfcApplyExternal(rpmfc fc)
Igor Gnatenko d7aa14
 	}
Igor Gnatenko d7aa14
 
Igor Gnatenko d7aa14
 	/* Parse dependencies into header */
Igor Gnatenko d7aa14
-	rc = parseRCPOT(NULL, fc->pkg, getStringBuf(sb_stdout), tag, 0, tagflags);
Igor Gnatenko d7aa14
+	rc = parseRCPOT(NULL, fc->pkg, getStringBuf(sb_stdout), dm->ntag ? dm->ntag != -1 : RPMTAG_REQUIRENAME, 0, tagflags);
Igor Gnatenko d7aa14
 	freeStringBuf(sb_stdout);
Igor Gnatenko d7aa14
 
Igor Gnatenko d7aa14
 	if (rc) {