rpm/findsupplements.diff
Cristian Rodríguez 41c257a762 Accepting request 96284 from home:coolo:branches:openSUSE:Factory
- add libtool as explicit buildrequire

- do not hardcode brp check list, but call everything below
  /usr/lib/rpm/brp-suse.d - and move our own brp scripts to 
  brp-check-suse

OBS-URL: https://build.opensuse.org/request/show/96284
OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=161
2011-12-11 21:58:21 +00:00

78 lines
2.4 KiB
Diff

Add support for supplements to the internal dependency
generator.
Index: build/rpmfc.c
===================================================================
--- build/rpmfc.c.orig 2011-12-09 14:46:56.296892644 +0100
+++ build/rpmfc.c 2011-12-09 14:47:08.510313829 +0100
@@ -57,6 +57,7 @@ struct rpmfc_s {
rpmds provides; /*!< (no. provides) package provides */
rpmds requires; /*!< (no. requires) package requires */
+ rpmds supplements; /*!< (no. supplements) package supplements */
};
struct rpmfcTokens_s {
@@ -504,6 +505,14 @@ static int rpmfcHelper(rpmfc fc, unsigne
dsContext = RPMSENSE_FIND_REQUIRES;
tagN = RPMTAG_REQUIRENAME;
break;
+ case 'S':
+ if (fc->skipProv)
+ return 0;
+ depname = "supplements";
+ depsp = &fc->supplements;
+ dsContext = RPMSENSE_FIND_REQUIRES|RPMSENSE_STRONG|RPMSENSE_MISSINGOK;
+ tagN = RPMTAG_ENHANCESNAME;
+ break;
}
/* If the entire path is filtered out, there's nothing more to do */
@@ -779,6 +788,7 @@ rpmfc rpmfcFree(rpmfc fc)
fc->provides = rpmdsFree(fc->provides);
fc->requires = rpmdsFree(fc->requires);
+ fc->supplements = rpmdsFree(fc->supplements);
}
fc = _free(fc);
return NULL;
@@ -831,6 +841,7 @@ rpmRC rpmfcApply(rpmfc fc)
for (ARGV_t fattr = fc->fattrs[fc->ix]; fattr && *fattr; fattr++) {
xx += rpmfcHelper(fc, 'P', *fattr);
xx += rpmfcHelper(fc, 'R', *fattr);
+ xx += rpmfcHelper(fc, 'S', *fattr);
}
}
@@ -873,6 +884,11 @@ rpmRC rpmfcApply(rpmfc fc)
dix = rpmdsFind(fc->requires, ds);
ds = rpmdsFree(ds);
break;
+ case 'S':
+ ds = rpmdsSingle(RPMTAG_ENHANCESNAME, N, EVR, Flags);
+ dix = rpmdsFind(fc->supplements, ds);
+ ds = rpmdsFree(ds);
+ break;
}
/* XXX assertion incorrect while generating -debuginfo deps. */
@@ -1384,6 +1400,18 @@ rpmRC rpmfcGenerateDepends(const rpmSpec
}
}
+ /* Add Supplements: */
+ if (fc->supplements != NULL && rpmdsCount(fc->supplements) > 0 && !fc->skipReq) {
+ rpmds pi = rpmdsInit(fc->supplements);
+ while (rpmdsNext(pi) >= 0) {
+ rpmsenseFlags flags = rpmdsFlags(pi);
+
+ headerPutString(pkg->header, RPMTAG_ENHANCESNAME, rpmdsN(pi));
+ headerPutString(pkg->header, RPMTAG_ENHANCESVERSION, rpmdsEVR(pi));
+ headerPutUint32(pkg->header, RPMTAG_ENHANCESFLAGS, &flags, 1);
+ }
+ }
+
/* Add dependency dictionary(#dependencies) */
if (rpmtdFromArgi(&td, RPMTAG_DEPENDSDICT, fc->ddictx)) {
assert(rpmtdType(&td) == RPM_INT32_TYPE);