addReqProv() and handleOneTrigger() now use rpmds with trigger indices.
This commit is contained in:
parent
06122bc1a4
commit
899d602616
|
@ -14,30 +14,9 @@
|
|||
static int isNewDep(rpmds *dsp, rpmds bds,
|
||||
Header h, rpmTagVal indextag, uint32_t index)
|
||||
{
|
||||
int isnew = 1;
|
||||
|
||||
if (!indextag) {
|
||||
/* With normal deps, we can just merge and see if anything got added */
|
||||
isnew = (rpmdsMerge(dsp, bds) > 0);
|
||||
} else {
|
||||
struct rpmtd_s idx;
|
||||
rpmds ads = *dsp;
|
||||
headerGet(h, indextag, &idx, HEADERGET_MINMEM);
|
||||
|
||||
/* rpmdsFind/Merge() probably isn't realiable with triggers... */
|
||||
rpmdsInit(ads);
|
||||
while (isnew && rpmdsNext(ads) >= 0) {
|
||||
if (!rstreq(rpmdsN(ads), rpmdsN(bds))) continue;
|
||||
if (!rstreq(rpmdsEVR(ads), rpmdsEVR(bds))) continue;
|
||||
if (rpmdsFlags(ads) != rpmdsFlags(bds)) continue;
|
||||
if (indextag && rpmtdSetIndex(&idx, rpmdsIx(ads)) >= 0 &&
|
||||
rpmtdGetNumber(&idx) != index) continue;
|
||||
isnew = 0;
|
||||
}
|
||||
rpmtdFreeData(&idx);
|
||||
rpmdsMerge(dsp, bds);
|
||||
}
|
||||
int isnew;
|
||||
|
||||
isnew = (rpmdsMerge(dsp, bds) > 0);
|
||||
return isnew;
|
||||
}
|
||||
|
||||
|
@ -125,7 +104,8 @@ int addReqProv(Package pkg, rpmTagVal tagN,
|
|||
if (EVR == NULL)
|
||||
EVR = "";
|
||||
|
||||
newds = rpmdsSinglePool(pkg->pool, tagN, N, EVR, Flags);
|
||||
newds = rpmdsSinglePoolTix(pkg->pool, tagN, N, EVR, Flags, index);
|
||||
|
||||
/* Avoid adding duplicate dependencies. */
|
||||
if (isNewDep(dsp, newds, h, indextag, index)) {
|
||||
headerPutString(h, tagN, N);
|
||||
|
|
13
lib/psm.c
13
lib/psm.c
|
@ -364,7 +364,6 @@ static rpmRC handleOneTrigger(rpmts ts, rpmte te, rpmsenseFlags sense,
|
|||
(void) rpmdsSetNoPromote(trigger, 1);
|
||||
|
||||
while ((i = rpmdsNext(trigger)) >= 0) {
|
||||
struct rpmtd_s tindexes;
|
||||
uint32_t tix;
|
||||
|
||||
if (!(rpmdsFlags(trigger) & sense))
|
||||
|
@ -377,15 +376,7 @@ static rpmRC handleOneTrigger(rpmts ts, rpmte te, rpmsenseFlags sense,
|
|||
if (!rpmdsAnyMatchesDep(sourceH, trigger, 1))
|
||||
continue;
|
||||
|
||||
if (!headerGet(trigH, RPMTAG_TRIGGERINDEX, &tindexes, HEADERGET_MINMEM))
|
||||
continue;
|
||||
|
||||
if (rpmtdSetIndex(&tindexes, i) < 0) {
|
||||
rpmtdFreeData(&tindexes);
|
||||
continue;
|
||||
}
|
||||
|
||||
tix = rpmtdGetNumber(&tindexes);
|
||||
tix = rpmdsTi(trigger);
|
||||
if (triggersAlreadyRun == NULL || triggersAlreadyRun[tix] == 0) {
|
||||
int arg1 = rpmdbCountPackages(rpmtsGetRdb(ts), triggerName);
|
||||
|
||||
|
@ -405,8 +396,6 @@ static rpmRC handleOneTrigger(rpmts ts, rpmte te, rpmsenseFlags sense,
|
|||
}
|
||||
}
|
||||
|
||||
rpmtdFreeData(&tindexes);
|
||||
|
||||
/*
|
||||
* Each target/source header pair can only result in a single
|
||||
* script being run.
|
||||
|
|
Loading…
Reference in New Issue