From 47e6eacc52cae31b70fee476263bf6eee790002e Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Sat, 24 Jan 2004 23:31:06 +0000 Subject: [PATCH] addReqProv: do not add provided requires --- build/reqprov.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/build/reqprov.c b/build/reqprov.c index e90c4f9..aadf32c 100644 --- a/build/reqprov.c +++ b/build/reqprov.c @@ -126,6 +126,43 @@ int addReqProv(/*@unused@*/ Spec spec, Header h, return 0; } + /* Do not add provided requires. */ + if ((nametag == RPMTAG_REQUIRENAME) && + (flagtag == RPMTAG_REQUIREFLAGS) && + !(depFlags & _notpre(RPMSENSE_RPMLIB | RPMSENSE_KEYRING | RPMSENSE_SCRIPT_PRE | RPMSENSE_SCRIPT_POSTUN)) && + !isLegacyPreReq(depFlags) && + hge(h, RPMTAG_PROVIDENAME, &dnt, (void **) &names, &len)) { + + int skip = 0; + int *flags = 0; + const char ** versions = 0; + rpmTagType dvt = RPM_STRING_ARRAY_TYPE; + + hge(h, RPMTAG_PROVIDEVERSION, &dvt, (void **) &versions, NULL); + hge(h, RPMTAG_PROVIDEFLAGS, NULL, (void **) &flags, NULL); + + while (flags && versions && (len > 0)) { + --len; + + if (strcmp (depName, names[len])) + continue; + if (!(depFlags & RPMSENSE_SENSEMASK)) { + skip = 1; + break; + } + if (!(flags[len] & RPMSENSE_SENSEMASK)) + continue; + if (rpmRangesOverlap (names[len], versions[len], flags[len], depName, depEVR, depFlags)) { + skip = 1; + break; + } + } + + versions = hfd(versions, dvt); + names = hfd(names, dnt); + if (skip) return 0; + } + /* Add this dependency. */ xx = headerAddOrAppendEntry(h, nametag, RPM_STRING_ARRAY_TYPE, &depName, 1); if (flagtag) {