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