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); } return isnew; }
static PyObject * rpmds_Merge(rpmdsObject * s, PyObject * args, PyObject * kwds) { rpmdsObject *o = NULL; char * kwlist[] = {"element", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!:Merge", kwlist, &rpmds_Type, &o)) { return NULL; } return Py_BuildValue("i", rpmdsMerge(&s->ds, o->ds)); }
int rpmdsRpmlib(rpmds * dsp, const void * tblp) { const struct rpmlibProvides_s * rltblp = tblp; const struct rpmlibProvides_s * rlp; int rc = 0; if (rltblp == NULL) rltblp = rpmlibProvides; for (rlp = rltblp; rlp->featureName != NULL && rc == 0; rlp++) { rpmds ds = rpmdsSingle(RPMTAG_PROVIDENAME, rlp->featureName, rlp->featureEVR, rlp->featureFlags); rc = rpmdsMerge(dsp, ds); rpmdsFree(ds); } return rc; }
int rpmdsRpmlibPool(rpmstrPool pool, rpmds * dsp, const void * tblp) { const struct rpmlibProvides_s * rltblp = tblp; const struct rpmlibProvides_s * rlp; int rc = 0; if (rltblp == NULL) rltblp = rpmlibProvides; for (rlp = rltblp; rlp->featureName != NULL && rc >= 0; rlp++) { rpmds ds = rpmdsSinglePool(pool, RPMTAG_PROVIDENAME, rlp->featureName, rlp->featureEVR, rlp->featureFlags); rc = rpmdsMerge(dsp, ds); rpmdsFree(ds); } /* freeze the pool to save memory, but only if private pool */ if (*dsp && (*dsp)->pool != pool) rpmstrPoolFreeze((*dsp)->pool, 0); return (rc < 0) ? -1 : 0; }
int addReqProv(Package pkg, rpmTagVal tagN, const char * N, const char * EVR, rpmsenseFlags Flags, uint32_t index) { rpmds newds, *dsp = NULL; dsp = packageDependencies(pkg, tagN); /* rpmlib() dependency sanity: only requires permitted, ensure sense bit */ if (rstreqn(N, "rpmlib(", sizeof("rpmlib(")-1)) { if (tagN != RPMTAG_REQUIRENAME) return 1; Flags |= RPMSENSE_RPMLIB; } newds = rpmdsSinglePoolTix(pkg->pool, tagN, N, EVR, rpmSanitizeDSFlags(tagN, Flags), index); rpmdsMerge(dsp, newds); rpmdsFree(newds); return 0; }