mirror of
https://abf.rosa.ru/djam/rpm.git
synced 2025-02-23 18:33:04 +00:00
141 lines
4.2 KiB
Diff
141 lines
4.2 KiB
Diff
![]() |
--- rpm-5.4.9/lib/rpmfc.c.fc_deps~ 2012-05-15 02:23:23.157740011 +0200
|
||
|
+++ rpm-5.4.9/lib/rpmfc.c 2012-05-15 02:24:42.863147557 +0200
|
||
|
@@ -1763,12 +1763,14 @@ static int rpmfcGenerateScriptletDeps(co
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
-static void removeSillyDeps(Header h) {
|
||
|
+static unsigned removeSillyDeps(Header h, rpmfc fc) {
|
||
|
HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
|
||
|
- int xx, i, rnum, removed = 0;
|
||
|
+ int xx;
|
||
|
+ unsigned i, rnum, removed = 0;
|
||
|
const char **deps = NULL;
|
||
|
const char **versions = NULL;
|
||
|
evrFlags *flags = NULL;
|
||
|
+ int *newpos = NULL, *ddictxPos = NULL;
|
||
|
|
||
|
he->tag = RPMTAG_REQUIRENAME;
|
||
|
xx = headerGet(h, he, 0);
|
||
|
@@ -1783,18 +1785,32 @@ static void removeSillyDeps(Header h) {
|
||
|
xx = headerGet(h, he, 0);
|
||
|
flags = (evrFlags*)he->p.ui32p;
|
||
|
|
||
|
+ if (fc && fc->requires != NULL && fc->ddictx != NULL) {
|
||
|
+ newpos = alloca(he->c*sizeof(newpos[0]));
|
||
|
+ if (fc->ddictx)
|
||
|
+ ddictxPos = alloca(fc->ddictx->nvals*sizeof(ddictxPos[0]));
|
||
|
+ }
|
||
|
for (i = 0; i < rnum-removed; i++) {
|
||
|
if (removed) {
|
||
|
deps[i] = deps[i+removed];
|
||
|
versions[i] = versions[i+removed];
|
||
|
flags[i] = flags[i+removed];
|
||
|
+ if (fc) {
|
||
|
+ fc->requires->N[i] = fc->requires->N[i+removed];
|
||
|
+ fc->requires->EVR[i] = fc->requires->EVR[i+removed];
|
||
|
+ fc->requires->Flags[i] = fc->requires->Flags[i+removed];
|
||
|
+ }
|
||
|
}
|
||
|
+ if (fc && fc->requires != NULL && fc->ddictx != NULL)
|
||
|
+ newpos[i+removed] = i;
|
||
|
rpmds req = rpmdsSingle(RPMTAG_REQUIRENAME, deps[i], versions[i], flags[i]);
|
||
|
rpmds prov = rpmdsNew(h, (*deps[i] == '/' && !*versions[i]) ? RPMTAG_BASENAMES : RPMTAG_PROVIDENAME, 0);
|
||
|
if (rpmdsMatch(req, prov)) {
|
||
|
if (flags[i] & RPMSENSE_SCRIPT_PRE)
|
||
|
rpmlog(RPMLOG_ERR, "Requires(pre): on dependency provided by self: %s\n", rpmdsDNEVR(req));
|
||
|
else {
|
||
|
+ if (fc && fc->requires != NULL && fc->ddictx != NULL)
|
||
|
+ newpos[i+removed] = -1;
|
||
|
rpmlog(RPMLOG_NOTICE, "Removing dependency on self: %s\n", rpmdsDNEVR(req));
|
||
|
removed++;
|
||
|
i--;
|
||
|
@@ -1803,6 +1819,52 @@ static void removeSillyDeps(Header h) {
|
||
|
req = rpmdsFree(req);
|
||
|
prov = rpmdsFree(prov);
|
||
|
}
|
||
|
+ if (fc && fc->requires != NULL && fc->ddictx != NULL && removed) {
|
||
|
+ fc->requires->Count -= removed;
|
||
|
+ unsigned rx = 0;
|
||
|
+ for (i = 0; i < fc->ddictx->nvals-rx; i++) {
|
||
|
+ unsigned ix;
|
||
|
+ unsigned char deptype;
|
||
|
+
|
||
|
+ ix = fc->ddictx->vals[i+rx];
|
||
|
+ deptype = ((ix >> 24) & 0xff);
|
||
|
+ ix &= 0x00ffffff;
|
||
|
+
|
||
|
+ if (deptype == 'P') {
|
||
|
+ ddictxPos[i+rx] = i;
|
||
|
+ fc->ddictx->vals[i] = fc->ddictx->vals[i+rx];
|
||
|
+ continue;
|
||
|
+ }
|
||
|
+ if (newpos[ix] == -1) {
|
||
|
+ ddictxPos[i+rx] = -1;
|
||
|
+ i--, rx++;
|
||
|
+ }
|
||
|
+ else
|
||
|
+ {
|
||
|
+ ddictxPos[i+rx] = i;
|
||
|
+ fc->ddictx->vals[i] = (deptype << 24) | (newpos[ix] & 0x00ffffff);
|
||
|
+ }
|
||
|
+ }
|
||
|
+ fc->ddictx->nvals -= rx;
|
||
|
+
|
||
|
+ for (i = 0; i < fc->fddictn->nvals; i++) {
|
||
|
+ rx = 0;
|
||
|
+ if (fc->fddictn->vals[i]) {
|
||
|
+ unsigned j, ix = fc->fddictx->vals[i];
|
||
|
+ for (j = 0, rx = 0; j < fc->fddictn->vals[i]; j++, ix++) {
|
||
|
+ if (ddictxPos[ix] == -1)
|
||
|
+ rx++;
|
||
|
+ if (j == 0 || fc->fddictx->vals[i] == -1)
|
||
|
+ fc->fddictx->vals[i] = ddictxPos[ix];
|
||
|
+ }
|
||
|
+ }
|
||
|
+ if (rx)
|
||
|
+ fc->fddictn->vals[i] -= rx;
|
||
|
+ if (fc->fddictn->vals[i] == 0)
|
||
|
+ fc->fddictx->vals[i] = 0;
|
||
|
+ }
|
||
|
+ }
|
||
|
+
|
||
|
if (removed) {
|
||
|
he->tag = RPMTAG_REQUIRENAME;
|
||
|
he->t = RPM_STRING_ARRAY_TYPE;
|
||
|
@@ -1820,6 +1882,7 @@ static void removeSillyDeps(Header h) {
|
||
|
headerMod(h, he, 0);
|
||
|
}
|
||
|
|
||
|
+ return removed;
|
||
|
}
|
||
|
|
||
|
rpmRC rpmfcGenerateDepends(void * _spec, void * _pkg)
|
||
|
@@ -1855,7 +1918,7 @@ rpmRC rpmfcGenerateDepends(void * _spec,
|
||
|
if (internaldeps == 0) {
|
||
|
/* ... then generate dependencies using %{__find_requires} et al. */
|
||
|
rc = rpmfcGenerateDependsHelper(spec, pkg, fi);
|
||
|
- removeSillyDeps(pkg->header);
|
||
|
+ removeSillyDeps(pkg->header, NULL);
|
||
|
printDeps(pkg->header);
|
||
|
return rc;
|
||
|
}
|
||
|
@@ -2045,6 +2108,8 @@ assert(he->p.ptr != NULL);
|
||
|
/*@=nullpass@*/
|
||
|
}
|
||
|
|
||
|
+ removeSillyDeps(pkg->header, fc);
|
||
|
+
|
||
|
/* Add dependency dictionary(#dependencies) */
|
||
|
he->tag = RPMTAG_DEPENDSDICT;
|
||
|
he->t = RPM_UINT32_TYPE;
|
||
|
@@ -2073,8 +2138,6 @@ assert(ac == (int)he->c);
|
||
|
xx = headerPut(pkg->header, he, 0);
|
||
|
}
|
||
|
|
||
|
- removeSillyDeps(pkg->header);
|
||
|
-
|
||
|
printDeps(pkg->header);
|
||
|
|
||
|
if (fc != NULL && _rpmfc_debug) {
|