Backport patches for rich dependencies from dependency generators
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
This commit is contained in:
parent
da3af5788b
commit
d7aa14bcd4
152
0001-Use-RPMTAG_-NAME-instead-of-RPMTAG_-FLAGS-in-parsePr.patch
Normal file
152
0001-Use-RPMTAG_-NAME-instead-of-RPMTAG_-FLAGS-in-parsePr.patch
Normal file
@ -0,0 +1,152 @@
|
||||
From 170ba73806c6f2cea258373bd98bf7d754fec995 Mon Sep 17 00:00:00 2001
|
||||
From: Florian Festi <ffesti@redhat.com>
|
||||
Date: Tue, 28 Feb 2017 10:57:56 +0100
|
||||
Subject: [PATCH 1/6] 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 933f7340f..a9db6f37c 100644
|
||||
--- a/build/parsePreamble.c
|
||||
+++ b/build/parsePreamble.c
|
||||
@@ -843,8 +843,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);
|
||||
@@ -852,13 +852,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;
|
||||
@@ -954,15 +954,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")},
|
||||
@@ -977,7 +977,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) {
|
||||
--
|
||||
2.13.1
|
||||
|
@ -0,0 +1,36 @@
|
||||
From b9e173d80b5374161f0b12d111e7b3f3acc3d3d3 Mon Sep 17 00:00:00 2001
|
||||
From: Florian Festi <ffesti@redhat.com>
|
||||
Date: Tue, 28 Feb 2017 17:42:21 +0100
|
||||
Subject: [PATCH 2/6] Fix check for weak deps in external dependency generator
|
||||
|
||||
(cherry picked from commit 43d230884365d90d42184a0000f44bb33e5f1ab8)
|
||||
---
|
||||
build/rpmfc.c | 12 ++++++------
|
||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/build/rpmfc.c b/build/rpmfc.c
|
||||
index ce192fa9c..921814ad1 100644
|
||||
--- a/build/rpmfc.c
|
||||
+++ b/build/rpmfc.c
|
||||
@@ -1267,12 +1267,12 @@ static rpmRC rpmfcApplyExternal(rpmfc fc)
|
||||
tagflags = RPMSENSE_FIND_PROVIDES;
|
||||
break;
|
||||
case RPMTAG_REQUIREFLAGS:
|
||||
- case RPMTAG_RECOMMENDNAME:
|
||||
- case RPMTAG_SUGGESTNAME:
|
||||
- case RPMTAG_SUPPLEMENTNAME:
|
||||
- case RPMTAG_ENHANCENAME:
|
||||
- case RPMTAG_CONFLICTNAME:
|
||||
- case RPMTAG_OBSOLETENAME:
|
||||
+ case RPMTAG_RECOMMENDFLAGS:
|
||||
+ case RPMTAG_SUGGESTFLAGS:
|
||||
+ case RPMTAG_SUPPLEMENTFLAGS:
|
||||
+ case RPMTAG_ENHANCEFLAGS:
|
||||
+ case RPMTAG_CONFLICTFLAGS:
|
||||
+ case RPMTAG_OBSOLETEFLAGS:
|
||||
if (fc->skipReq)
|
||||
continue;
|
||||
tagflags = RPMSENSE_FIND_REQUIRES;
|
||||
--
|
||||
2.13.1
|
||||
|
@ -0,0 +1,59 @@
|
||||
From ccb3a59bbbccbcf4003117e182d4ae7446e53d07 Mon Sep 17 00:00:00 2001
|
||||
From: Florian Festi <ffesti@redhat.com>
|
||||
Date: Thu, 9 Mar 2017 12:12:32 +0100
|
||||
Subject: [PATCH 3/6] Fix check whether to allow rich deps in a given tag
|
||||
|
||||
Broken with 9d5bbd9774d00f50749bb045217eaf91c87b6de0
|
||||
|
||||
(cherry picked from commit e4349ef7292578a7286bfca2e68a150422e65c3c)
|
||||
---
|
||||
build/parseReqs.c | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/build/parseReqs.c b/build/parseReqs.c
|
||||
index bd728ed2d..6c2aead4e 100644
|
||||
--- a/build/parseReqs.c
|
||||
+++ b/build/parseReqs.c
|
||||
@@ -129,6 +129,7 @@ rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTagVal tagN,
|
||||
rpmTagVal nametag = RPMTAG_NOT_FOUND;
|
||||
rpmsenseFlags Flags;
|
||||
rpmRC rc = RPMRC_FAIL; /* assume failure */
|
||||
+ int allow_richdeps = 0;
|
||||
|
||||
switch (tagN) {
|
||||
default:
|
||||
@@ -139,9 +140,11 @@ rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTagVal tagN,
|
||||
case RPMTAG_SUGGESTNAME:
|
||||
case RPMTAG_SUPPLEMENTNAME:
|
||||
case RPMTAG_ENHANCENAME:
|
||||
+ case RPMTAG_CONFLICTNAME:
|
||||
+ allow_richdeps = 1;
|
||||
+ /* fall through */
|
||||
case RPMTAG_PROVIDENAME:
|
||||
case RPMTAG_OBSOLETENAME:
|
||||
- case RPMTAG_CONFLICTNAME:
|
||||
case RPMTAG_ORDERNAME:
|
||||
nametag = tagN;
|
||||
break;
|
||||
@@ -149,6 +152,7 @@ rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTagVal tagN,
|
||||
/* XXX map legacy PreReq into Requires(pre,preun) */
|
||||
nametag = RPMTAG_REQUIRENAME;
|
||||
tagflags |= (RPMSENSE_SCRIPT_PRE|RPMSENSE_SCRIPT_PREUN);
|
||||
+ allow_richdeps = 1;
|
||||
break;
|
||||
case RPMTAG_TRIGGERPREIN:
|
||||
nametag = RPMTAG_TRIGGERNAME;
|
||||
@@ -209,9 +213,7 @@ rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTagVal tagN,
|
||||
|
||||
if (r[0] == '(') {
|
||||
struct parseRCPOTRichData data;
|
||||
- if (nametag != RPMTAG_REQUIRENAME && nametag != RPMTAG_CONFLICTNAME &&
|
||||
- nametag != RPMTAG_RECOMMENDNAME && nametag != RPMTAG_SUPPLEMENTNAME &&
|
||||
- nametag != RPMTAG_SUGGESTNAME && nametag != RPMTAG_ENHANCENAME) {
|
||||
+ if (!allow_richdeps) {
|
||||
rasprintf(&emsg, _("No rich dependencies allowed for this type"));
|
||||
goto exit;
|
||||
}
|
||||
--
|
||||
2.13.1
|
||||
|
@ -0,0 +1,30 @@
|
||||
From 2d3a50d2eb43e373dfb4a0cd0ded79d7e8b3b36c Mon Sep 17 00:00:00 2001
|
||||
From: Florian Festi <ffesti@redhat.com>
|
||||
Date: Thu, 9 Mar 2017 14:02:10 +0100
|
||||
Subject: [PATCH 4/6] Re-enable rich dependecies for build requires and
|
||||
conflicts
|
||||
|
||||
(cherry picked from commit cb3dc0b43bd9a119196a527504d03d57d0785092)
|
||||
---
|
||||
build/parseReqs.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/build/parseReqs.c b/build/parseReqs.c
|
||||
index 6c2aead4e..4d500c1df 100644
|
||||
--- a/build/parseReqs.c
|
||||
+++ b/build/parseReqs.c
|
||||
@@ -174,9 +174,11 @@ rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTagVal tagN,
|
||||
case RPMTAG_BUILDREQUIRES:
|
||||
nametag = RPMTAG_REQUIRENAME;
|
||||
tagflags |= RPMSENSE_ANY;
|
||||
+ allow_richdeps = 1;
|
||||
break;
|
||||
case RPMTAG_BUILDCONFLICTS:
|
||||
nametag = RPMTAG_CONFLICTNAME;
|
||||
+ allow_richdeps = 1;
|
||||
break;
|
||||
case RPMTAG_FILETRIGGERIN:
|
||||
nametag = RPMTAG_FILETRIGGERNAME;
|
||||
--
|
||||
2.13.1
|
||||
|
276
0005-add-support-for-rich-dependencies-from-dependency-ge.patch
Normal file
276
0005-add-support-for-rich-dependencies-from-dependency-ge.patch
Normal file
@ -0,0 +1,276 @@
|
||||
From aa4f0da27f1a18f35784f0f148a41f58ba581c78 Mon Sep 17 00:00:00 2001
|
||||
From: Igor Gnatenko <ignatenko@redhat.com>
|
||||
Date: Sat, 25 Feb 2017 12:28:16 +0100
|
||||
Subject: [PATCH 5/6] add support for rich dependencies from dependency
|
||||
generators
|
||||
|
||||
Mostly achieved by replacing custom parser with the parseRCPOT().
|
||||
|
||||
Closes: https://github.com/rpm-software-management/rpm/issues/167
|
||||
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
|
||||
(cherry picked from commit 8f509d669b9ae79c86dd510c5a4bc5109f60d733)
|
||||
---
|
||||
build/parsePreamble.c | 4 +--
|
||||
build/parseReqs.c | 9 +++--
|
||||
build/parseScript.c | 2 +-
|
||||
build/reqprov.c | 8 +++++
|
||||
build/rpmbuild_internal.h | 12 ++++++-
|
||||
build/rpmfc.c | 90 ++++++++++++++---------------------------------
|
||||
6 files changed, 54 insertions(+), 71 deletions(-)
|
||||
|
||||
diff --git a/build/parsePreamble.c b/build/parsePreamble.c
|
||||
index a9db6f37c..a9d2f8e23 100644
|
||||
--- a/build/parsePreamble.c
|
||||
+++ b/build/parsePreamble.c
|
||||
@@ -859,13 +859,13 @@ static rpmRC handlePreambleTag(rpmSpec spec, Package pkg, rpmTagVal tag,
|
||||
case RPMTAG_CONFLICTNAME:
|
||||
case RPMTAG_OBSOLETENAME:
|
||||
case RPMTAG_PROVIDENAME:
|
||||
- if (parseRCPOT(spec, pkg, field, tag, 0, tagflags))
|
||||
+ if (parseRCPOT(spec, pkg, field, tag, 0, tagflags, addReqProvPkg, NULL))
|
||||
goto exit;
|
||||
break;
|
||||
case RPMTAG_BUILDPREREQ:
|
||||
case RPMTAG_BUILDREQUIRES:
|
||||
case RPMTAG_BUILDCONFLICTS:
|
||||
- if (parseRCPOT(spec, spec->sourcePackage, field, tag, 0, tagflags))
|
||||
+ if (parseRCPOT(spec, spec->sourcePackage, field, tag, 0, tagflags, addReqProvPkg, NULL))
|
||||
goto exit;
|
||||
break;
|
||||
case RPMTAG_EXCLUDEARCH:
|
||||
diff --git a/build/parseReqs.c b/build/parseReqs.c
|
||||
index 4d500c1df..554ff49a5 100644
|
||||
--- a/build/parseReqs.c
|
||||
+++ b/build/parseReqs.c
|
||||
@@ -121,7 +121,7 @@ static rpmRC parseRCPOTRichCB(void *cbdata, rpmrichParseType type,
|
||||
}
|
||||
|
||||
rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTagVal tagN,
|
||||
- int index, rpmsenseFlags tagflags)
|
||||
+ int index, rpmsenseFlags tagflags, addReqProvFunction cb, void *cbdata)
|
||||
{
|
||||
const char *r, *re, *v, *ve;
|
||||
char *emsg = NULL;
|
||||
@@ -131,6 +131,9 @@ rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTagVal tagN,
|
||||
rpmRC rc = RPMRC_FAIL; /* assume failure */
|
||||
int allow_richdeps = 0;
|
||||
|
||||
+ if (!cbdata)
|
||||
+ cbdata = pkg;
|
||||
+
|
||||
switch (tagN) {
|
||||
default:
|
||||
case RPMTAG_REQUIRENAME:
|
||||
@@ -225,7 +228,7 @@ rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTagVal tagN,
|
||||
freeStringBuf(data.sb);
|
||||
goto exit;
|
||||
}
|
||||
- if (addReqProv(pkg, nametag, getStringBuf(data.sb), NULL, Flags, index)) {
|
||||
+ if (cb && cb(cbdata, nametag, getStringBuf(data.sb), NULL, Flags, index) != RPMRC_OK) {
|
||||
rasprintf(&emsg, _("invalid dependency"));
|
||||
freeStringBuf(data.sb);
|
||||
goto exit;
|
||||
@@ -300,7 +303,7 @@ rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTagVal tagN,
|
||||
goto exit;
|
||||
}
|
||||
|
||||
- if (addReqProv(pkg, nametag, N, EVR, Flags, index)) {
|
||||
+ if (cb && cb(cbdata, nametag, N, EVR, Flags, index) != RPMRC_OK) {
|
||||
rasprintf(&emsg, _("invalid dependency"));
|
||||
goto exit;
|
||||
}
|
||||
diff --git a/build/parseScript.c b/build/parseScript.c
|
||||
index 64fd89693..849e40244 100644
|
||||
--- a/build/parseScript.c
|
||||
+++ b/build/parseScript.c
|
||||
@@ -398,7 +398,7 @@ int parseScript(rpmSpec spec, int parsePart)
|
||||
priority);
|
||||
|
||||
/* Generate the trigger tags */
|
||||
- if (parseRCPOT(spec, pkg, reqargs, reqtag, index, tagflags))
|
||||
+ if (parseRCPOT(spec, pkg, reqargs, reqtag, index, tagflags, addReqProvPkg, NULL))
|
||||
goto exit;
|
||||
} else {
|
||||
struct rpmtd_s td;
|
||||
diff --git a/build/reqprov.c b/build/reqprov.c
|
||||
index 7422db65f..5fa0a1c6b 100644
|
||||
--- a/build/reqprov.c
|
||||
+++ b/build/reqprov.c
|
||||
@@ -34,6 +34,14 @@ int addReqProv(Package pkg, rpmTagVal tagN,
|
||||
return 0;
|
||||
}
|
||||
|
||||
+rpmRC addReqProvPkg(void *cbdata, rpmTagVal tagN,
|
||||
+ const char * N, const char *EVR, rpmsenseFlags Flags,
|
||||
+ int index)
|
||||
+{
|
||||
+ Package pkg = cbdata;
|
||||
+ return addReqProv(pkg, tagN, N, EVR, Flags, index) ? RPMRC_FAIL : RPMRC_OK;
|
||||
+}
|
||||
+
|
||||
int rpmlibNeedsFeature(Package pkg, const char * feature, const char * featureEVR)
|
||||
{
|
||||
char *reqname = NULL;
|
||||
diff --git a/build/rpmbuild_internal.h b/build/rpmbuild_internal.h
|
||||
index 7dd577f26..d0442f625 100644
|
||||
--- a/build/rpmbuild_internal.h
|
||||
+++ b/build/rpmbuild_internal.h
|
||||
@@ -283,6 +283,10 @@ int parseScript(rpmSpec spec, int parsePart);
|
||||
RPM_GNUC_INTERNAL
|
||||
rpmRC rpmCharCheck(rpmSpec spec, const char *field, const char *whitelist);
|
||||
|
||||
+typedef rpmRC (*addReqProvFunction) (void *cbdata, rpmTagVal tagN,
|
||||
+ const char * N, const char * EVR, rpmsenseFlags Flags,
|
||||
+ int index);
|
||||
+
|
||||
/** \ingroup rpmbuild
|
||||
* Parse dependency relations from spec file and/or autogenerated output buffer.
|
||||
* @param spec spec file control structure
|
||||
@@ -291,11 +295,13 @@ rpmRC rpmCharCheck(rpmSpec spec, const char *field, const char *whitelist);
|
||||
* @param tagN tag, identifies type of dependency
|
||||
* @param index (0 always)
|
||||
* @param tagflags dependency flags already known from context
|
||||
+ * @param cb Callback for adding dependency (nullable)
|
||||
+ * @param cbdata Callback data (@pkg if NULL)
|
||||
* @return RPMRC_OK on success, RPMRC_FAIL on failure
|
||||
*/
|
||||
RPM_GNUC_INTERNAL
|
||||
rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char * field, rpmTagVal tagN,
|
||||
- int index, rpmsenseFlags tagflags);
|
||||
+ int index, rpmsenseFlags tagflags, addReqProvFunction cb, void *cbdata);
|
||||
|
||||
/** \ingroup rpmbuild
|
||||
* Evaluate boolean expression.
|
||||
@@ -440,6 +446,10 @@ int addReqProv(Package pkg, rpmTagVal tagN,
|
||||
const char * N, const char * EVR, rpmsenseFlags Flags,
|
||||
uint32_t index);
|
||||
|
||||
+RPM_GNUC_INTERNAL
|
||||
+rpmRC addReqProvPkg(void *cbdata, rpmTagVal tagN,
|
||||
+ const char * N, const char * EVR, rpmsenseFlags Flags,
|
||||
+ int index);
|
||||
|
||||
/** \ingroup rpmbuild
|
||||
* Add rpmlib feature dependency.
|
||||
diff --git a/build/rpmfc.c b/build/rpmfc.c
|
||||
index 921814ad1..7fa8227d0 100644
|
||||
--- a/build/rpmfc.c
|
||||
+++ b/build/rpmfc.c
|
||||
@@ -447,44 +447,27 @@ static ARGV_t runCmd(const char *nsdep, const char *depname,
|
||||
return output;
|
||||
}
|
||||
|
||||
-static const char *parseDep(char **depav, int depac,
|
||||
- const char **N, const char **EVR, rpmsenseFlags *Flags)
|
||||
+struct addReqProvDataFc {
|
||||
+ rpmfc fc;
|
||||
+ const char *namespace;
|
||||
+ regex_t *exclude;
|
||||
+};
|
||||
+
|
||||
+static rpmRC addReqProvFc(void *cbdata, rpmTagVal tagN,
|
||||
+ const char * N, const char * EVR, rpmsenseFlags Flags,
|
||||
+ int index)
|
||||
{
|
||||
- const char *err = NULL;
|
||||
-
|
||||
- switch (depac) {
|
||||
- case 1: /* only a name */
|
||||
- *N = depav[0];
|
||||
- *EVR = "";
|
||||
- break;
|
||||
- case 3: /* name, range and version */
|
||||
- for (const char *s = depav[1]; *s; s++) {
|
||||
- switch(*s) {
|
||||
- default:
|
||||
- err = _("bad operator");
|
||||
- break;
|
||||
- case '=':
|
||||
- *Flags |= RPMSENSE_EQUAL;
|
||||
- break;
|
||||
- case '<':
|
||||
- *Flags |= RPMSENSE_LESS;
|
||||
- break;
|
||||
- case '>':
|
||||
- *Flags |= RPMSENSE_GREATER;
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
- if (!err) {
|
||||
- *N = depav[0];
|
||||
- *EVR = depav[2];
|
||||
- }
|
||||
- break;
|
||||
- default:
|
||||
- err = _("bad format");
|
||||
- break;
|
||||
- }
|
||||
+ struct addReqProvDataFc *data = cbdata;
|
||||
+ rpmfc fc = data->fc;
|
||||
+ const char *namespace = data->namespace;
|
||||
+ regex_t *exclude = data->exclude;
|
||||
+
|
||||
+ rpmds ds = rpmdsSingleNS(fc->pool, tagN, namespace, N, EVR, Flags);
|
||||
+ /* Add to package and file dependencies unless filtered */
|
||||
+ if (regMatch(exclude, rpmdsDNEVR(ds)+2) == 0)
|
||||
+ rpmfcAddFileDep(&fc->fileDeps, ds, index);
|
||||
|
||||
- return err;
|
||||
+ return RPMRC_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -522,35 +505,14 @@ static int rpmfcHelper(rpmfc fc, int ix,
|
||||
namespace = rpmfcAttrMacro(nsdep, NULL, "namespace");
|
||||
exclude = rpmfcAttrReg(depname, NULL, "exclude");
|
||||
|
||||
+ struct addReqProvDataFc data;
|
||||
+ data.fc = fc;
|
||||
+ data.namespace = namespace;
|
||||
+ data.exclude = exclude;
|
||||
+
|
||||
for (int i = 0; i < pac; i++) {
|
||||
- char ** depav = NULL;
|
||||
- int xx, depac = 0;
|
||||
- const char *N = NULL;
|
||||
- const char *EVR = NULL;
|
||||
- const char *err = NULL;
|
||||
- rpmsenseFlags Flags = dsContext;
|
||||
-
|
||||
- if ((xx = poptParseArgvString(pav[i], &depac, (const char ***)&depav)))
|
||||
- err = poptStrerror(xx);
|
||||
-
|
||||
- if (!err)
|
||||
- err = parseDep(depav, depac, &N, &EVR, &Flags);
|
||||
-
|
||||
- if (!err) {
|
||||
- rpmds ds = rpmdsSingleNS(fc->pool, tagN, namespace, N, EVR, Flags);
|
||||
-
|
||||
- /* Add to package and file dependencies unless filtered */
|
||||
- if (regMatch(exclude, rpmdsDNEVR(ds)+2) == 0) {
|
||||
- //rpmdsMerge(packageDependencies(fc->pkg, tagN), ds);
|
||||
- rpmfcAddFileDep(&fc->fileDeps, ds, ix);
|
||||
- }
|
||||
- } else {
|
||||
- rpmlog(RPMLOG_ERR, _("invalid dependency (%s): %s\n"),
|
||||
- err, pav[i]);
|
||||
+ if (parseRCPOT(NULL, fc->pkg, pav[i], tagN, 0, dsContext, addReqProvFc, &data))
|
||||
rc++;
|
||||
- }
|
||||
-
|
||||
- free(depav);
|
||||
}
|
||||
|
||||
argvFree(pav);
|
||||
@@ -1297,7 +1259,7 @@ static rpmRC rpmfcApplyExternal(rpmfc fc)
|
||||
}
|
||||
|
||||
/* Parse dependencies into header */
|
||||
- rc = parseRCPOT(NULL, fc->pkg, getStringBuf(sb_stdout), dm->ntag ? dm->ntag != -1 : RPMTAG_REQUIRENAME, 0, tagflags);
|
||||
+ rc = parseRCPOT(NULL, fc->pkg, getStringBuf(sb_stdout), dm->ntag ? dm->ntag != -1 : RPMTAG_REQUIRENAME, 0, tagflags, addReqProvPkg, NULL);
|
||||
freeStringBuf(sb_stdout);
|
||||
|
||||
if (rc) {
|
||||
--
|
||||
2.13.1
|
||||
|
@ -0,0 +1,30 @@
|
||||
From 25e4f138ec11e5b0f757a8ab610e43fe08f18cf0 Mon Sep 17 00:00:00 2001
|
||||
From: Florian Festi <ffesti@redhat.com>
|
||||
Date: Wed, 31 May 2017 10:42:03 +0200
|
||||
Subject: [PATCH 6/6] Pass proper file index when recording generated
|
||||
dependencies
|
||||
|
||||
Resolves regression introduced with 8f509d6
|
||||
Fixes #224
|
||||
|
||||
(cherry picked from commit dab75e7f26a08cc6798e4df177adb2dd8d40035c)
|
||||
---
|
||||
build/rpmfc.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/build/rpmfc.c b/build/rpmfc.c
|
||||
index 7fa8227d0..72f29ddf5 100644
|
||||
--- a/build/rpmfc.c
|
||||
+++ b/build/rpmfc.c
|
||||
@@ -511,7 +511,7 @@ static int rpmfcHelper(rpmfc fc, int ix,
|
||||
data.exclude = exclude;
|
||||
|
||||
for (int i = 0; i < pac; i++) {
|
||||
- if (parseRCPOT(NULL, fc->pkg, pav[i], tagN, 0, dsContext, addReqProvFc, &data))
|
||||
+ if (parseRCPOT(NULL, fc->pkg, pav[i], tagN, ix, dsContext, addReqProvFc, &data))
|
||||
rc++;
|
||||
}
|
||||
|
||||
--
|
||||
2.13.1
|
||||
|
17
rpm.spec
17
rpm.spec
@ -33,7 +33,7 @@
|
||||
Summary: The RPM package management system
|
||||
Name: rpm
|
||||
Version: %{rpmver}
|
||||
Release: %{?snapver:0.%{snapver}.}25%{?dist}
|
||||
Release: %{?snapver:0.%{snapver}.}26%{?dist}
|
||||
Group: System Environment/Base
|
||||
Url: http://www.rpm.org/
|
||||
Source0: http://ftp.rpm.org/releases/%{srcdir}/%{name}-%{srcver}.tar.bz2
|
||||
@ -104,10 +104,18 @@ Patch286: debugsrc-and-sub-debuginfo-packages.patch
|
||||
# OpenSSL backend
|
||||
Patch300: 0001-Add-OpenSSL-support-for-digest-and-signatures.patch
|
||||
|
||||
# Rich dependencies coming from dependency generatos
|
||||
Patch310: 0001-Use-RPMTAG_-NAME-instead-of-RPMTAG_-FLAGS-in-parsePr.patch
|
||||
Patch311: 0002-Fix-check-for-weak-deps-in-external-dependency-gener.patch
|
||||
Patch312: 0003-Fix-check-whether-to-allow-rich-deps-in-a-given-tag.patch
|
||||
Patch313: 0004-Re-enable-rich-dependecies-for-build-requires-and-co.patch
|
||||
Patch314: 0005-add-support-for-rich-dependencies-from-dependency-ge.patch
|
||||
Patch315: 0006-Pass-proper-file-index-when-recording-generated-depe.patch
|
||||
|
||||
# These are not yet upstream
|
||||
Patch302: rpm-4.7.1-geode-i686.patch
|
||||
Patch902: rpm-4.7.1-geode-i686.patch
|
||||
# Probably to be upstreamed in slightly different form
|
||||
Patch304: rpm-4.13.90-ldflags.patch
|
||||
Patch904: rpm-4.13.90-ldflags.patch
|
||||
|
||||
# Partially GPL/LGPL dual-licensed and some bits with BSD
|
||||
# SourceLicense: (GPLv2+ and LGPLv2+ with exceptions) and BSD
|
||||
@ -602,6 +610,9 @@ exit 0
|
||||
%doc doc/librpm/html/*
|
||||
|
||||
%changelog
|
||||
* Wed Jun 28 2017 Igor Gnatenko <ignatenko@redhat.com> - 4.13.0.1-26
|
||||
- Backport patches for rich dependencies from dependency generators
|
||||
|
||||
* Sun Jun 25 2017 Mark Wielaard <mjw@fedoraproject.org> - 4.13.0.1-25
|
||||
- Add support for debugsource and debuginfo subpackages
|
||||
- find-debuginfo-untangle-unique-build-options.patch
|
||||
|
Loading…
Reference in New Issue
Block a user