diff options
author | Anas Nashif <anas.nashif@intel.com> | 2012-10-11 12:40:31 -0700 |
---|---|---|
committer | Anas Nashif <anas.nashif@intel.com> | 2013-02-02 16:44:15 -0800 |
commit | 8966e44f90581477f689e6e6673dec4cd0f44c30 (patch) | |
tree | f27c68e7f76aba1c1c460f41df82d0d73e41be70 /build | |
parent | cd10f180b09bd91d4d720c66a0835b757d7f944f (diff) | |
download | librpm-tizen-8966e44f90581477f689e6e6673dec4cd0f44c30.tar.gz librpm-tizen-8966e44f90581477f689e6e6673dec4cd0f44c30.tar.bz2 librpm-tizen-8966e44f90581477f689e6e6673dec4cd0f44c30.zip |
Add support for weak dependencies:
A) use RPMTAG_SUGGESTS and RPMTAG_ENHANCES to store them.
This is different to upstream, which uses RPMSENSE_MISSINGOK
and RPMTAG_REQUIRES/RPMTAG_PROVIDES instead. I chose different
tags because I wanted to be compatible. The point is that
applications that don't know about the new MISSINGOK semantics
will mis-interpret the provides/requires otherwise, which
I deemed to risky.
B) use RPMSENSE_STRONG to support a "strong" version, "Recommends"
instead of "Suggests" and "Supplements" instead of "Enhances".
Diffstat (limited to 'build')
-rw-r--r-- | build/parsePreamble.c | 22 | ||||
-rw-r--r-- | build/parseReqs.c | 14 | ||||
-rw-r--r-- | build/reqprov.c | 10 | ||||
-rw-r--r-- | build/rpmfc.c | 14 |
4 files changed, 60 insertions, 0 deletions
diff --git a/build/parsePreamble.c b/build/parsePreamble.c index 16848ec76..78891dbdf 100644 --- a/build/parsePreamble.c +++ b/build/parsePreamble.c @@ -341,6 +341,8 @@ static struct tokenBits_s const installScriptBits[] = { { "verify", RPMSENSE_SCRIPT_VERIFY }, { "pretrans", RPMSENSE_PRETRANS }, { "posttrans", RPMSENSE_POSTTRANS }, + { "hint", RPMSENSE_MISSINGOK }, + { "strong", RPMSENSE_STRONG }, { NULL, 0 } }; @@ -789,6 +791,18 @@ static rpmRC handlePreambleTag(rpmSpec spec, Package pkg, rpmTagVal tag, if (parseRCPOT(spec, pkg, field, tag, 0, tagflags)) goto exit; break; + case RPMTAG_SUGGESTSFLAGS: + case RPMTAG_ENHANCESFLAGS: + case RPMTAG_BUILDSUGGESTS: + case RPMTAG_BUILDENHANCES: + tagflags = RPMSENSE_MISSINGOK; + if (macro && (!strcmp(macro, "recommends") || !strcmp(macro, "buildrecommends"))) + tagflags |= RPMSENSE_STRONG; + if (macro && (!strcmp(macro, "supplements") || !strcmp(macro, "buildsupplements"))) + tagflags |= RPMSENSE_STRONG; + if ((rc = parseRCPOT(spec, pkg, field, tag, 0, tagflags))) + return rc; + break; case RPMTAG_EXCLUDEARCH: case RPMTAG_EXCLUSIVEARCH: case RPMTAG_EXCLUDEOS: @@ -897,6 +911,14 @@ static struct PreambleRec_s const preambleList[] = { {RPMTAG_BUGURL, 0, 0, LEN_AND_STR("bugurl")}, {RPMTAG_COLLECTIONS, 0, 0, LEN_AND_STR("collections")}, {RPMTAG_ORDERFLAGS, 2, 0, LEN_AND_STR("orderwithrequires")}, + {RPMTAG_SUGGESTSFLAGS, 0, 0, LEN_AND_STR("recommends")}, + {RPMTAG_SUGGESTSFLAGS, 0, 0, LEN_AND_STR("suggests")}, + {RPMTAG_ENHANCESFLAGS, 0, 0, LEN_AND_STR("supplements")}, + {RPMTAG_ENHANCESFLAGS, 0, 0, LEN_AND_STR("enhances")}, + {RPMTAG_BUILDSUGGESTS, 0, 0, LEN_AND_STR("buildrecommends")}, + {RPMTAG_BUILDSUGGESTS, 0, 0, LEN_AND_STR("buildsuggests")}, + {RPMTAG_BUILDENHANCES, 0, 0, LEN_AND_STR("buildsupplements")}, + {RPMTAG_BUILDENHANCES, 0, 0, LEN_AND_STR("buildenhances")}, {0, 0, 0, 0} }; diff --git a/build/parseReqs.c b/build/parseReqs.c index 5ad0501e4..1507090d3 100644 --- a/build/parseReqs.c +++ b/build/parseReqs.c @@ -95,6 +95,20 @@ rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTagVal tagN, nametag = RPMTAG_CONFLICTNAME; h = spec->buildRestrictions; break; + case RPMTAG_SUGGESTSFLAGS: + nametag = RPMTAG_SUGGESTSNAME; + break; + case RPMTAG_ENHANCESFLAGS: + nametag = RPMTAG_ENHANCESNAME; + break; + case RPMTAG_BUILDSUGGESTS: + nametag = RPMTAG_SUGGESTSNAME; + h = spec->buildRestrictions; + break; + case RPMTAG_BUILDENHANCES: + nametag = RPMTAG_ENHANCESNAME; + h = spec->buildRestrictions; + break; } for (r = field; *r != '\0'; r = re) { diff --git a/build/reqprov.c b/build/reqprov.c index f2cdb5cd4..bc2f7ea26 100644 --- a/build/reqprov.c +++ b/build/reqprov.c @@ -75,6 +75,16 @@ int addReqProv(Header h, rpmTagVal tagN, indextag = RPMTAG_TRIGGERINDEX; extra = Flags & RPMSENSE_TRIGGER; break; + case RPMTAG_SUGGESTSNAME: + versiontag = RPMTAG_SUGGESTSVERSION; + flagtag = RPMTAG_SUGGESTSFLAGS; + extra = Flags & _ALL_REQUIRES_MASK; + break; + case RPMTAG_ENHANCESNAME: + versiontag = RPMTAG_ENHANCESVERSION; + flagtag = RPMTAG_ENHANCESFLAGS; + extra = Flags & _ALL_REQUIRES_MASK; + break; case RPMTAG_REQUIRENAME: default: tagN = RPMTAG_REQUIRENAME; diff --git a/build/rpmfc.c b/build/rpmfc.c index 990abab98..261a09ee3 100644 --- a/build/rpmfc.c +++ b/build/rpmfc.c @@ -1081,6 +1081,12 @@ static struct DepMsg_s depMsgs[] = { { "Obsoletes", { "%{?__find_obsoletes}", NULL, NULL, NULL }, RPMTAG_OBSOLETENAME, RPMTAG_OBSOLETEVERSION, RPMTAG_OBSOLETEFLAGS, 0, -1 }, + { "Enhances", { "%{?__find_enhances}", NULL, NULL, NULL }, + RPMTAG_ENHANCESNAME, RPMTAG_ENHANCESVERSION, RPMTAG_ENHANCESFLAGS, + RPMSENSE_STRONG, RPMSENSE_STRONG }, + { "Supplements", { "%{?__find_supplements}", NULL, NULL, NULL }, + RPMTAG_ENHANCESNAME, RPMTAG_ENHANCESVERSION, RPMTAG_ENHANCESFLAGS, + RPMSENSE_STRONG, 0 }, { NULL, { NULL, NULL, NULL, NULL }, 0, 0, 0, 0, 0 } }; @@ -1157,6 +1163,14 @@ static rpmRC rpmfcGenerateDependsHelper(const rpmSpec spec, Package pkg, rpmfi f continue; tagflags = RPMSENSE_FIND_REQUIRES; break; + case RPMTAG_ENHANCESFLAGS: + if (!pkg->autoProv) + continue; + failnonzero = 0; + tagflags = RPMSENSE_FIND_REQUIRES | RPMSENSE_MISSINGOK; + if (strcmp(dm->msg, "Supplements") == 0) + tagflags |= RPMSENSE_STRONG; + break; default: continue; break; |