diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/depends.c | 118 | ||||
-rw-r--r-- | lib/psm.c | 2 | ||||
-rw-r--r-- | lib/rpmds.h | 2 | ||||
-rw-r--r-- | lib/rpmfi.c | 2 | ||||
-rw-r--r-- | lib/rpminstall.c | 20 | ||||
-rw-r--r-- | lib/rpmte.c | 62 | ||||
-rw-r--r-- | lib/rpmte.h | 35 | ||||
-rw-r--r-- | lib/rpmts.c | 26 | ||||
-rw-r--r-- | lib/rpmts.h | 12 | ||||
-rw-r--r-- | lib/transaction.c | 98 | ||||
-rw-r--r-- | lib/ts.c | 4 | ||||
-rw-r--r-- | lib/verify.c | 4 |
12 files changed, 199 insertions, 186 deletions
diff --git a/lib/depends.c b/lib/depends.c index cd58e5451..95250e49a 100644 --- a/lib/depends.c +++ b/lib/depends.c @@ -121,13 +121,13 @@ static int removePackage(rpmts ts, Header h, int dboffset, return 0; } -int rpmtsAddPackage(rpmts ts, Header h, +int rpmtsAddInstallElement(rpmts ts, Header h, fnpyKey key, int upgrade, rpmRelocation * relocs) { HGE_t hge = (HGE_t)headerGetEntryMinMemory; int isSource; int duplicate = 0; - rpmtei pi; rpmte p; + rpmtsi pi; rpmte p; rpmds add; rpmds obsoletes; alKey pkgKey; /* addedPackages key */ @@ -142,7 +142,7 @@ int rpmtsAddPackage(rpmts ts, Header h, */ add = rpmdsThis(h, RPMTAG_REQUIRENAME, (RPMSENSE_EQUAL|RPMSENSE_LESS)); pkgKey = RPMAL_NOMATCH; - for (pi = rpmteiInit(ts), oc = 0; (p = rpmteiNext(pi, 0)) != NULL; oc++) { + for (pi = rpmtsiInit(ts), oc = 0; (p = rpmtsiNext(pi, 0)) != NULL; oc++) { rpmds this; /* XXX Only added packages need be checked for dupes. */ @@ -165,7 +165,7 @@ int rpmtsAddPackage(rpmts ts, Header h, break; } } - pi = rpmteiFree(pi); + pi = rpmtsiFree(pi); add = rpmdsFree(add); isSource = headerIsEntry(h, RPMTAG_SOURCEPACKAGE); @@ -302,10 +302,11 @@ int rpmtsAddPackage(rpmts ts, Header h, ec = 0; exit: - pi = rpmteiFree(pi); + pi = rpmtsiFree(pi); return ec; } +#ifdef DYING void rpmtsAvailablePackage(rpmts ts, Header h, fnpyKey key) { int scareMem = 0; @@ -318,8 +319,9 @@ void rpmtsAvailablePackage(rpmts ts, Header h, fnpyKey key) fi = rpmfiFree(fi, 1); provides = rpmdsFree(provides); } +#endif -int rpmtsRemovePackage(rpmts ts, Header h, int dboffset) +int rpmtsAddEraseElement(rpmts ts, Header h, int dboffset) { return removePackage(ts, h, dboffset, RPMAL_NOMATCH); } @@ -980,7 +982,7 @@ static inline int addRelation(rpmts ts, /*@globals fileSystem @*/ /*@modifies ts, p, *selected, fileSystem @*/ { - rpmtei qi; rpmte q; + rpmtsi qi; rpmte q; tsortInfo tsi; const char * Name; fnpyKey key; @@ -1006,7 +1008,7 @@ fprintf(stderr, "addRelation: pkgKey %ld\n", (long)pkgKey); /* XXX Set q to the added package that has pkgKey == q->u.addedKey */ /* XXX FIXME: bsearch is possible/needed here */ - for (qi = rpmteiInit(ts), i = 0; (q = rpmteiNext(qi, 0)) != NULL; i++) { + for (qi = rpmtsiInit(ts), i = 0; (q = rpmtsiNext(qi, 0)) != NULL; i++) { /* XXX Only added packages need be checked for matches. */ if (rpmteType(q) == TR_REMOVED) @@ -1015,7 +1017,7 @@ fprintf(stderr, "addRelation: pkgKey %ld\n", (long)pkgKey); if (pkgKey == rpmteAddedKey(q)) break; } - qi = rpmteiFree(qi); + qi = rpmtsiFree(qi); if (q == NULL || i == ts->orderCount) return 0; @@ -1150,9 +1152,9 @@ int rpmtsOrder(rpmts ts) #else int chainsaw = 1; #endif - rpmtei pi; rpmte p; - rpmtei qi; rpmte q; - rpmtei ri; rpmte r; + rpmtsi pi; rpmte p; + rpmtsi qi; rpmte q; + rpmtsi ri; rpmte r; tsortInfo tsi; tsortInfo tsi_next; alKey * ordering; @@ -1196,16 +1198,16 @@ fprintf(stderr, "*** rpmtsOrder(%p) order %p[%d]\n", ts, ts->order, ts->orderCou ordering = alloca(sizeof(*ordering) * (numOrderList + 1)); loopcheck = numOrderList; - pi = rpmteiInit(ts); - while ((p = rpmteiNext(pi, oType)) != NULL) + pi = rpmtsiInit(ts); + while ((p = rpmtsiNext(pi, oType)) != NULL) rpmteNewTSI(p); - pi = rpmteiFree(pi); + pi = rpmtsiFree(pi); /* Record all relations. */ rpmMessage(RPMMESS_DEBUG, _("========== recording tsort relations\n")); - pi = rpmteiInit(ts); + pi = rpmtsiInit(ts); /* XXX Only added packages are ordered (for now). */ - while ((p = rpmteiNext(pi, oType)) != NULL) { + while ((p = rpmtsiNext(pi, oType)) != NULL) { if ((requires = rpmteDS(p, RPMTAG_REQUIRENAME)) == NULL) continue; @@ -1213,7 +1215,7 @@ fprintf(stderr, "*** rpmtsOrder(%p) order %p[%d]\n", ts, ts->order, ts->orderCou memset(selected, 0, sizeof(*selected) * ts->orderCount); /* Avoid narcisstic relations. */ - selected[rpmteiGetOc(pi)] = 1; + selected[rpmtsiOc(pi)] = 1; /* T2. Next "q <- p" relation. */ @@ -1279,12 +1281,12 @@ fprintf(stderr, "*** rpmtsOrder(%p) order %p[%d]\n", ts, ts->order, ts->orderCou } } - pi = rpmteiFree(pi); + pi = rpmtsiFree(pi); /* Save predecessor count and mark tree roots. */ treex = 0; - pi = rpmteiInit(ts); - while ((p = rpmteiNext(pi, oType)) != NULL) { + pi = rpmtsiInit(ts); + while ((p = rpmtsiNext(pi, oType)) != NULL) { int npreds; npreds = rpmteTSI(p)->tsi_count; @@ -1301,25 +1303,25 @@ fprintf(stderr, "*** rpmtsOrder(%p) order %p[%d]\n", ts, ts->order, ts->orderCou /*@-modfilesystem -nullpass @*/ if (_tso_debug) -/*@i@*/ fprintf(stderr, "\t+++ %p[%d] %s npreds %d\n", p, rpmteiGetOc(pi), rpmteNEVR(p), rpmteNpreds(p)); +/*@i@*/ fprintf(stderr, "\t+++ %p[%d] %s npreds %d\n", p, rpmtsiOc(pi), rpmteNEVR(p), rpmteNpreds(p)); /*@=modfilesystem =nullpass @*/ } - pi = rpmteiFree(pi); + pi = rpmtsiFree(pi); /* T4. Scan for zeroes. */ rpmMessage(RPMMESS_DEBUG, _("========== tsorting packages (order, #predecessors, #succesors, tree, depth)\n")); rescan: - if (pi != NULL) pi = rpmteiFree(pi); + if (pi != NULL) pi = rpmtsiFree(pi); q = r = NULL; qlen = 0; - pi = rpmteiInit(ts); - while ((p = rpmteiNext(pi, oType)) != NULL) { + pi = rpmtsiInit(ts); + while ((p = rpmtsiNext(pi, oType)) != NULL) { /* Prefer packages in chainsaw or presentation order. */ if (!chainsaw) - rpmteTSI(p)->tsi_qcnt = (ts->orderCount - rpmteiGetOc(pi)); + rpmteTSI(p)->tsi_qcnt = (ts->orderCount - rpmtsiOc(pi)); if (rpmteTSI(p)->tsi_count != 0) continue; @@ -1332,7 +1334,7 @@ if (_tso_debug) prtTSI(" p", rpmteTSI(p)); /*@=modfilesystem =nullpass @*/ } - pi = rpmteiFree(pi); + pi = rpmtsiFree(pi); /* T5. Output front of queue (T7. Remove from queue.) */ for (; q != NULL; q = rpmteTSI(q)->tsi_suc) { @@ -1405,15 +1407,15 @@ prtTSI(" p", rpmteTSI(p)); /* Relink the queue in presentation order. */ tsi = rpmteTSI(q); - pi = rpmteiInit(ts); - while ((p = rpmteiNext(pi, oType)) != NULL) { + pi = rpmtsiInit(ts); + while ((p = rpmtsiNext(pi, oType)) != NULL) { /* Is this element in the queue? */ if (rpmteTSI(p)->tsi_reqx == 0) /*@innercontinue@*/ continue; tsi->tsi_suc = p; tsi = rpmteTSI(p); } - pi = rpmteiFree(pi); + pi = rpmtsiFree(pi); tsi->tsi_suc = NULL; } } @@ -1424,30 +1426,30 @@ prtTSI(" p", rpmteTSI(p)); /* T9. Initialize predecessor chain. */ nzaps = 0; - qi = rpmteiInit(ts); - while ((q = rpmteiNext(qi, oType)) != NULL) { + qi = rpmtsiInit(ts); + while ((q = rpmtsiNext(qi, oType)) != NULL) { rpmteTSI(q)->tsi_chain = NULL; rpmteTSI(q)->tsi_reqx = 0; /* Mark packages already sorted. */ if (rpmteTSI(q)->tsi_count == 0) rpmteTSI(q)->tsi_count = -1; } - qi = rpmteiFree(qi); + qi = rpmtsiFree(qi); /* T10. Mark all packages with their predecessors. */ - qi = rpmteiInit(ts); - while ((q = rpmteiNext(qi, oType)) != NULL) { + qi = rpmtsiInit(ts); + while ((q = rpmtsiNext(qi, oType)) != NULL) { if ((tsi = rpmteTSI(q)->tsi_next) == NULL) continue; rpmteTSI(q)->tsi_next = NULL; markLoop(tsi, q); rpmteTSI(q)->tsi_next = tsi; } - qi = rpmteiFree(qi); + qi = rpmtsiFree(qi); /* T11. Print all dependency loops. */ - ri = rpmteiInit(ts); - while ((r = rpmteiNext(ri, oType)) != NULL) + ri = rpmtsiInit(ts); + while ((r = rpmtsiNext(ri, oType)) != NULL) { int printed; @@ -1501,7 +1503,7 @@ prtTSI(" p", rpmteTSI(p)); rpmteTSI(p)->tsi_reqx = 0; } } - ri = rpmteiFree(ri); + ri = rpmtsiFree(ri); /* If a relation was eliminated, then continue sorting. */ /* XXX TODO: add control bit. */ @@ -1517,10 +1519,10 @@ prtTSI(" p", rpmteTSI(p)); } /* Clean up tsort remnants (if any). */ - pi = rpmteiInit(ts); - while ((p = rpmteiNext(pi, 0)) != NULL) + pi = rpmtsiInit(ts); + while ((p = rpmtsiNext(pi, 0)) != NULL) rpmteFreeTSI(p); - pi = rpmteiFree(pi); + pi = rpmtsiFree(pi); /* * The order ends up as installed packages followed by removed packages, @@ -1530,8 +1532,8 @@ prtTSI(" p", rpmteTSI(p)); */ orderList = xcalloc(numOrderList, sizeof(*orderList)); j = 0; - pi = rpmteiInit(ts); - while ((p = rpmteiNext(pi, oType)) != NULL) { + pi = rpmtsiInit(ts); + while ((p = rpmtsiNext(pi, oType)) != NULL) { /* Prepare added package ordering permutation. */ switch (rpmteType(p)) { case TR_ADDED: @@ -1541,10 +1543,10 @@ prtTSI(" p", rpmteTSI(p)); orderList[j].pkgKey = RPMAL_NOMATCH; /*@switchbreak@*/ break; } - orderList[j].orIndex = rpmteiGetOc(pi); + orderList[j].orIndex = rpmtsiOc(pi); j++; } - pi = rpmteiFree(pi); + pi = rpmtsiFree(pi); qsort(orderList, numOrderList, sizeof(*orderList), orderListIndexCmp); @@ -1602,11 +1604,11 @@ assert(newOrderCount == ts->orderCount); #ifdef DYING /* Clean up after dependency checks */ - pi = rpmteiInit(ts); - while ((p = rpmteiNext(pi, 0)) != NULL) { + pi = rpmtsiInit(ts); + while ((p = rpmtsiNext(pi, 0)) != NULL) { rpmteCleanDS(p); } - pi = rpmteiFree(pi); + pi = rpmtsiFree(pi); ts->addedPackages = rpmalFree(ts->addedPackages); ts->numAddedPackages = 0; @@ -1655,7 +1657,7 @@ static int rpmdbCloseDBI(/*@null@*/ rpmdb db, int rpmtag) int rpmtsCheck(rpmts ts) { rpmdbMatchIterator mi = NULL; - rpmtei pi = NULL; rpmte p; + rpmtsi pi = NULL; rpmte p; int closeatexit = 0; int xx; int rc; @@ -1677,8 +1679,8 @@ int rpmtsCheck(rpmts ts) * Look at all of the added packages and make sure their dependencies * are satisfied. */ - pi = rpmteiInit(ts); - while ((p = rpmteiNext(pi, TR_ADDED)) != NULL) { + pi = rpmtsiInit(ts); + while ((p = rpmtsiNext(pi, TR_ADDED)) != NULL) { rpmds provides; rpmMessage(RPMMESS_DEBUG, "========== +++ %s\n" , rpmteNEVR(p)); @@ -1718,13 +1720,13 @@ int rpmtsCheck(rpmts ts) if (rc) goto exit; } - pi = rpmteiFree(pi); + pi = rpmtsiFree(pi); /* * Look at the removed packages and make sure they aren't critical. */ - pi = rpmteiInit(ts); - while ((p = rpmteiNext(pi, TR_REMOVED)) != NULL) { + pi = rpmtsiInit(ts); + while ((p = rpmtsiNext(pi, TR_REMOVED)) != NULL) { rpmds provides; rpmfi fi; @@ -1772,13 +1774,13 @@ int rpmtsCheck(rpmts ts) if (rc) goto exit; } - pi = rpmteiFree(pi); + pi = rpmtsiFree(pi); rc = 0; exit: mi = rpmdbFreeIterator(mi); - pi = rpmteiFree(pi); + pi = rpmtsiFree(pi); /*@-branchstate@*/ if (closeatexit) xx = rpmtsCloseDB(ts); @@ -494,7 +494,7 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd, goto exit; } - (void) rpmtsAddPackage(ts, h, NULL, 0, NULL); + (void) rpmtsAddInstallElement(ts, h, NULL, 0, NULL); fi = rpmfiNew(ts, fi, h, RPMTAG_BASENAMES, scareMem); h = headerFree(h, "InstallSourcePackage"); diff --git a/lib/rpmds.h b/lib/rpmds.h index 1ded5e922..3fbbf82f6 100644 --- a/lib/rpmds.h +++ b/lib/rpmds.h @@ -6,6 +6,8 @@ * Structure(s) used for dependency tag sets. */ +/** + */ /*@unchecked@*/ extern int _rpmds_debug; diff --git a/lib/rpmfi.c b/lib/rpmfi.c index 741b5f9e2..9c542133c 100644 --- a/lib/rpmfi.c +++ b/lib/rpmfi.c @@ -485,7 +485,7 @@ Header relocateFileList(const rpmts ts, rpmfi fi, /* XXX actions check prevents problem from being appended twice. */ if (j == numValid && !allowBadRelocate && actions) { - rpmps ps = rpmtsGetProblems(ts); + rpmps ps = rpmtsProblems(ts); rpmpsAppend(ps, RPMPROB_BADRELOCATE, rpmteNEVR(p), rpmteKey(p), relocations[i].oldPath, NULL, NULL, 0); diff --git a/lib/rpminstall.c b/lib/rpminstall.c index fb9250472..952f253c1 100644 --- a/lib/rpminstall.c +++ b/lib/rpminstall.c @@ -454,7 +454,7 @@ restart: } /*@-abstract@*/ - rc = rpmtsAddPackage(ts, eiu->h, (fnpyKey)fileName, + rc = rpmtsAddInstallElement(ts, eiu->h, (fnpyKey)fileName, (ia->installInterfaceFlags & INSTALL_UPGRADE) != 0, relocations); /*@=abstract@*/ @@ -537,7 +537,7 @@ restart: stopInstall = 1; } - ps = rpmtsGetProblems(ts); + ps = rpmtsProblems(ts); if (!stopInstall && ps) { rpmMessage(RPMMESS_ERROR, _("Failed dependencies:\n")); printDepProblems(stderr, ps); @@ -579,7 +579,7 @@ restart: rpmMessage(RPMMESS_DEBUG, _("installing binary packages\n")); rc = rpmtsRun(ts, NULL, probFilter); - ps = rpmtsGetProblems(ts); + ps = rpmtsProblems(ts); if (rc < 0) { eiu->numFailed += eiu->numRPMS; @@ -679,7 +679,7 @@ int rpmErase(rpmts ts, while ((h = rpmdbNextIterator(mi)) != NULL) { unsigned int recOffset = rpmdbGetIteratorOffset(mi); if (recOffset) { - (void) rpmtsRemovePackage(ts, h, recOffset); + (void) rpmtsAddEraseElement(ts, h, recOffset); numPackages++; } } @@ -694,7 +694,7 @@ int rpmErase(rpmts ts, stopUninstall = 1; } - ps = rpmtsGetProblems(ts); + ps = rpmtsProblems(ts); if (!stopUninstall && ps) { rpmMessage(RPMMESS_ERROR, _("removing these packages would break " "dependencies:\n")); @@ -708,7 +708,7 @@ int rpmErase(rpmts ts, if (!stopUninstall) { (void) rpmtsSetFlags(ts, (rpmtsFlags(ts) | RPMTRANS_FLAG_REVERSE)); numFailed += rpmtsRun(ts, NULL, 0); - ps = rpmtsGetProblems(ts); + ps = rpmtsProblems(ts); ps = rpmpsFree(ps); } @@ -1013,7 +1013,7 @@ int rpmRollback(rpmts ts, rpmMessage(RPMMESS_DEBUG, "\t+++ %s\n", rp->key); - rc = rpmtsAddPackage(ts, rp->h, (fnpyKey)rp->key, + rc = rpmtsAddInstallElement(ts, rp->h, (fnpyKey)rp->key, 0, ia->relocations); if (rc != 0) goto exit; @@ -1038,7 +1038,7 @@ int rpmRollback(rpmts ts, rpmMessage(RPMMESS_DEBUG, "\t--- rpmdb instance #%u\n", ip->instance); - rc = rpmtsRemovePackage(ts, ip->instance); + rc = rpmtsAddEraseElement(ts, ip->instance); if (rc != 0) goto exit; @@ -1065,7 +1065,7 @@ int rpmRollback(rpmts ts, packagesTotal, ctime(&tid)); rc = rpmtsCheck(ts); - ps = rpmtsGetProblems(ts); + ps = rpmtsProblems(ts); if (rc != 0 && ps) { rpmMessage(RPMMESS_ERROR, _("Failed dependencies:\n")); printDepProblems(stderr, ps); @@ -1079,7 +1079,7 @@ int rpmRollback(rpmts ts, goto exit; rc = rpmtsRun(ts, NULL, (ia->probFilter|RPMPROB_FILTER_OLDPACKAGE)); - ps = rpmtsGetProblems(ts); + ps = rpmtsProblems(ts); if (rc > 0) rpmpsPrint(stderr, ps); ps = rpmpsFree(ps); diff --git a/lib/rpmte.c b/lib/rpmte.c index dd4aa5a55..fee9b899d 100644 --- a/lib/rpmte.c +++ b/lib/rpmte.c @@ -19,11 +19,11 @@ #include "debug.h" /*@unchecked@*/ -int _te_debug = 0; +int _rpmte_debug = 0; /*@access alKey @*/ -/*@access rpmtei @*/ /*@access rpmte @*/ +/*@access rpmtsi @*/ /*@access rpmts @*/ void rpmteCleanDS(rpmte te) @@ -419,72 +419,72 @@ rpmfi rpmteFI(rpmte te, rpmTag tag) /*@=compdef =refcounttrans =retalias =retexpose =usereleased @*/ } -int rpmteiGetOc(rpmtei tei) +int rpmtsiOc(rpmtsi tsi) { - return tei->ocsave; + return tsi->ocsave; } -rpmtei XrpmteiFree(/*@only@*//*@null@*/ rpmtei tei, +rpmtsi XrpmtsiFree(/*@only@*//*@null@*/ rpmtsi tsi, const char * fn, unsigned int ln) { - if (tei) - tei->ts = rpmtsUnlink(tei->ts, "tsIterator"); + if (tsi) + tsi->ts = rpmtsUnlink(tsi->ts, "rpmtsiInit"); /*@-modfilesys@*/ -if (_te_debug) -fprintf(stderr, "*** tei %p -- %s:%d\n", tei, fn, ln); +if (_rpmte_debug) +fprintf(stderr, "*** tsi %p -- %s:%d\n", tsi, fn, ln); /*@=modfilesys@*/ - return _free(tei); + return _free(tsi); } -rpmtei XrpmteiInit(rpmts ts, const char * fn, unsigned int ln) +rpmtsi XrpmtsiInit(rpmts ts, const char * fn, unsigned int ln) { - rpmtei tei = NULL; + rpmtsi tsi = NULL; - tei = xcalloc(1, sizeof(*tei)); - tei->ts = rpmtsLink(ts, "rpmtei"); - tei->reverse = ((rpmtsFlags(ts) & RPMTRANS_FLAG_REVERSE) ? 1 : 0); - tei->oc = (tei->reverse ? (rpmtsNElements(ts) - 1) : 0); - tei->ocsave = tei->oc; + tsi = xcalloc(1, sizeof(*tsi)); + tsi->ts = rpmtsLink(ts, "rpmtsi"); + tsi->reverse = ((rpmtsFlags(ts) & RPMTRANS_FLAG_REVERSE) ? 1 : 0); + tsi->oc = (tsi->reverse ? (rpmtsNElements(ts) - 1) : 0); + tsi->ocsave = tsi->oc; /*@-modfilesys@*/ -if (_te_debug) -fprintf(stderr, "*** tei %p ++ %s:%d\n", tei, fn, ln); +if (_rpmte_debug) +fprintf(stderr, "*** tsi %p ++ %s:%d\n", tsi, fn, ln); /*@=modfilesys@*/ - return tei; + return tsi; } /** * Return next transaction element. - * @param tei transaction element iterator + * @param tsi transaction element iterator * @return transaction element, NULL on termination */ static /*@dependent@*/ /*@null@*/ -rpmte rpmteiNextIterator(rpmtei tei) - /*@modifies tei @*/ +rpmte rpmtsiNextElement(rpmtsi tsi) + /*@modifies tsi @*/ { rpmte te = NULL; int oc = -1; - if (tei == NULL || tei->ts == NULL || rpmtsNElements(tei->ts) <= 0) + if (tsi == NULL || tsi->ts == NULL || rpmtsNElements(tsi->ts) <= 0) return te; - if (tei->reverse) { - if (tei->oc >= 0) oc = tei->oc--; + if (tsi->reverse) { + if (tsi->oc >= 0) oc = tsi->oc--; } else { - if (tei->oc < rpmtsNElements(tei->ts)) oc = tei->oc++; + if (tsi->oc < rpmtsNElements(tsi->ts)) oc = tsi->oc++; } - tei->ocsave = oc; + tsi->ocsave = oc; /*@-branchstate@*/ if (oc != -1) - te = rpmtsElement(tei->ts, oc); + te = rpmtsElement(tsi->ts, oc); /*@=branchstate@*/ return te; } -rpmte rpmteiNext(rpmtei tei, rpmElementType type) +rpmte rpmtsiNext(rpmtsi tsi, rpmElementType type) { rpmte te; - while ((te = rpmteiNextIterator(tei)) != NULL) { + while ((te = rpmtsiNextElement(tsi)) != NULL) { if (type == 0 || (te->type & type) != 0) break; } diff --git a/lib/rpmte.h b/lib/rpmte.h index 7f0185ffa..b2e0d94db 100644 --- a/lib/rpmte.h +++ b/lib/rpmte.h @@ -7,6 +7,11 @@ */ /** + */ +/*@unchecked@*/ +extern int _rpmte_debug; + +/** * Transaction element ordering chain linkage. */ typedef /*@abstract@*/ struct tsortInfo_s * tsortInfo; @@ -14,7 +19,7 @@ typedef /*@abstract@*/ struct tsortInfo_s * tsortInfo; /** * Transaction element iterator. */ -typedef /*@abstract@*/ struct rpmtei_s * rpmtei; +typedef /*@abstract@*/ struct rpmtsi_s * rpmtsi; /** \ingroup rpmte * Transaction element type. @@ -121,7 +126,7 @@ struct rpmte_s { /** * Iterator across transaction elements, forward on install, backward on erase. */ -struct rpmtei_s { +struct rpmtsi_s { /*@refcounted@*/ rpmts ts; /*!< transaction set. */ int reverse; /*!< reversed traversal? */ @@ -441,33 +446,33 @@ rpmfi rpmteFI(rpmte te, rpmTag tag) /** * Return transaction element index. - * @param tei transaction element iterator + * @param tsi transaction element iterator * @return transaction element index */ -int rpmteiGetOc(rpmtei tei) +int rpmtsiOc(rpmtsi tsi) /*@*/; /** * Destroy transaction element iterator. - * @param tei transaction element iterator + * @param tsi transaction element iterator * @return NULL always */ /*@unused@*/ /*@null@*/ -rpmtei rpmteiFree(/*@only@*//*@null@*/ rpmtei tei) +rpmtsi rpmtsiFree(/*@only@*//*@null@*/ rpmtsi tsi) /*@*/; /** * Destroy transaction element iterator. - * @param tei transaction element iterator + * @param tsi transaction element iterator * @param fn * @param ln * @return NULL always */ /*@null@*/ -rpmtei XrpmteiFree(/*@only@*//*@null@*/ rpmtei tei, +rpmtsi XrpmtsiFree(/*@only@*//*@null@*/ rpmtsi tsi, const char * fn, unsigned int ln) /*@*/; -#define rpmteiFree(_tei) XrpmteiFree(_tei, __FILE__, __LINE__) +#define rpmtsiFree(_tsi) XrpmtsiFree(_tsi, __FILE__, __LINE__) /** * Create transaction element iterator. @@ -475,7 +480,7 @@ rpmtei XrpmteiFree(/*@only@*//*@null@*/ rpmtei tei, * @return transaction element iterator */ /*@unused@*/ /*@only@*/ -rpmtei rpmteiInit(rpmts ts) +rpmtsi rpmtsiInit(rpmts ts) /*@modifies ts @*/; /** @@ -486,20 +491,20 @@ rpmtei rpmteiInit(rpmts ts) * @return transaction element iterator */ /*@unused@*/ /*@only@*/ -rpmtei XrpmteiInit(rpmts ts, +rpmtsi XrpmtsiInit(rpmts ts, const char * fn, unsigned int ln) /*@modifies ts @*/; -#define rpmteiInit(_ts) XrpmteiInit(_ts, __FILE__, __LINE__) +#define rpmtsiInit(_ts) XrpmtsiInit(_ts, __FILE__, __LINE__) /** * Return next transaction element of type. - * @param tei transaction element iterator + * @param tsi transaction element iterator * @param type transaction element type selector (0 for any) * @return next transaction element of type, NULL on termination */ /*@dependent@*/ /*@null@*/ -rpmte rpmteiNext(rpmtei tei, rpmElementType type) - /*@modifies tei @*/; +rpmte rpmtsiNext(rpmtsi tsi, rpmElementType type) + /*@modifies tsi @*/; #ifdef __cplusplus } diff --git a/lib/rpmts.c b/lib/rpmts.c index 7615bbac7..881cc0e3e 100644 --- a/lib/rpmts.c +++ b/lib/rpmts.c @@ -311,7 +311,7 @@ int rpmtsAvailable(rpmts ts, const rpmds ds) /*@=nullstate@*/ } -rpmps rpmtsGetProblems(rpmts ts) +rpmps rpmtsProblems(rpmts ts) { rpmps ps = NULL; if (ts) { @@ -326,13 +326,13 @@ rpmps rpmtsGetProblems(rpmts ts) void rpmtsClean(rpmts ts) { if (ts) { - rpmtei pi; rpmte p; + rpmtsi pi; rpmte p; /* Clean up after dependency checks. */ - pi = rpmteiInit(ts); - while ((p = rpmteiNext(pi, 0)) != NULL) + pi = rpmtsiInit(ts); + while ((p = rpmtsiNext(pi, 0)) != NULL) rpmteCleanDS(p); - pi = rpmteiFree(pi); + pi = rpmtsiFree(pi); ts->addedPackages = rpmalFree(ts->addedPackages); ts->numAddedPackages = 0; @@ -353,7 +353,7 @@ void rpmtsClean(rpmts ts) rpmts rpmtsFree(rpmts ts) { if (ts) { - rpmtei pi; rpmte p; + rpmtsi pi; rpmte p; int oc; (void) rpmtsUnlink(ts, "tsCreate"); @@ -379,12 +379,12 @@ rpmts rpmtsFree(rpmts ts) ts->rootDir = _free(ts->rootDir); ts->currDir = _free(ts->currDir); - for (pi = rpmteiInit(ts), oc = 0; (p = rpmteiNext(pi, 0)) != NULL; oc++) { + for (pi = rpmtsiInit(ts), oc = 0; (p = rpmtsiNext(pi, 0)) != NULL; oc++) { /*@-type -unqualifiedtrans @*/ ts->order[oc] = rpmteFree(ts->order[oc]); /*@=type =unqualifiedtrans @*/ } - pi = rpmteiFree(pi); + pi = rpmtsiFree(pi); /*@-type +voidabstract @*/ /* FIX: double indirection */ ts->order = _free(ts->order); /*@=type =voidabstract @*/ @@ -678,7 +678,7 @@ void rpmtsCheckDSIProblems(const rpmts ts, const rpmte te) if (fc <= 0) return; - ps = rpmtsGetProblems(ts); + ps = rpmtsProblems(ts); for (i = 0; i < ts->filesystemCount; i++, dsi++) { /* XXX Avoid FAT and other file systems that have not inodes. */ @@ -775,12 +775,12 @@ int rpmtsGetKeys(const rpmts ts, fnpyKey ** ep, int * nep) if (nep) *nep = ts->orderCount; if (ep) { - rpmtei pi; rpmte p; + rpmtsi pi; rpmte p; fnpyKey * e; *ep = e = xmalloc(ts->orderCount * sizeof(*e)); - pi = rpmteiInit(ts); - while ((p = rpmteiNext(pi, 0)) != NULL) { + pi = rpmtsiInit(ts); + while ((p = rpmtsiNext(pi, 0)) != NULL) { switch (rpmteType(p)) { case TR_ADDED: /*@-dependenttrans@*/ @@ -794,7 +794,7 @@ int rpmtsGetKeys(const rpmts ts, fnpyKey ** ep, int * nep) } e++; } - pi = rpmteiFree(pi); + pi = rpmtsiFree(pi); } return rc; } diff --git a/lib/rpmts.h b/lib/rpmts.h index 0a01605cf..6fecf39a8 100644 --- a/lib/rpmts.h +++ b/lib/rpmts.h @@ -104,9 +104,11 @@ struct rpmts_s { rpmal addedPackages; /*!< Set of packages being installed. */ int numAddedPackages; /*!< No. added package instances. */ +#ifndef DYING /*@only@*/ rpmal availablePackages; /*!< Universe of available packages. */ int numAvailablePackages; /*!< No. available package instances. */ +#endif /*@owned@*/ rpmte * order; /*!< Packages sorted by dependencies. */ @@ -288,12 +290,12 @@ int rpmtsAvailable(rpmts ts, const rpmds ds) /*@modifies ts, fileSystem @*/; /** - * Return (and clear) current transaction set problems. + * Return current transaction set problems. * @param ts transaction set * @return current problem set (or NULL) */ /*@null@*/ -rpmps rpmtsGetProblems(rpmts ts) +rpmps rpmtsProblems(rpmts ts) /*@modifies ts @*/; /** \ingroup rpmts @@ -544,12 +546,13 @@ rpmts rpmtsCreate(void) * @param relocs package file relocations * @return 0 on success, 1 on I/O error, 2 needs capabilities */ -int rpmtsAddPackage(rpmts ts, Header h, +int rpmtsAddInstallElement(rpmts ts, Header h, /*@exposed@*/ /*@null@*/ const fnpyKey key, int upgrade, /*@null@*/ rpmRelocation * relocs) /*@globals fileSystem, internalState @*/ /*@modifies ts, h, fileSystem, internalState @*/; +#ifdef DYING /** \ingroup rpmts * Add package to universe of possible packages to install in transaction set. * @warning The key parameter is non-functional. @@ -561,6 +564,7 @@ int rpmtsAddPackage(rpmts ts, Header h, void rpmtsAvailablePackage(rpmts ts, Header h, /*@exposed@*/ /*@null@*/ fnpyKey key) /*@modifies h, ts @*/; +#endif /** \ingroup rpmts * Add package to be erased to transaction set. @@ -569,7 +573,7 @@ void rpmtsAvailablePackage(rpmts ts, Header h, * @param dboffset rpm database instance * @return 0 on success */ -int rpmtsRemovePackage(rpmts ts, Header h, int dboffset) +int rpmtsAddEraseElement(rpmts ts, Header h, int dboffset) /*@modifies ts, h @*/; /** \ingroup rpmts diff --git a/lib/transaction.c b/lib/transaction.c index 804605346..cef9b7483 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -42,7 +42,7 @@ /*@access rpmfi @*/ -/*@access rpmtei @*/ +/*@access rpmtsi @*/ /*@access rpmts @*/ /** @@ -244,7 +244,7 @@ static int handleInstInstalledFiles(const rpmts ts, fi->replaced = xcalloc(sharedCount, sizeof(*fi->replaced)); - ps = rpmtsGetProblems(ts); + ps = rpmtsProblems(ts); for (i = 0; i < sharedCount; i++, shared++) { int otherFileNum, fileNum; @@ -497,7 +497,7 @@ static void handleOverlappedFiles(const rpmts ts, const char * fn; int i, j; - ps = rpmtsGetProblems(ts); + ps = rpmtsProblems(ts); fi = rpmfiInit(fi, 0); if (fi != NULL) while ((i = rpmfiNext(fi)) >= 0) { @@ -692,7 +692,7 @@ static int ensureOlder(rpmts ts, req = rpmdsFree(req); if (rc == 0) { - rpmps ps = rpmtsGetProblems(ts); + rpmps ps = rpmtsProblems(ts); const char * altNEVR = hGetNEVR(h, NULL); rpmpsAppend(ps, RPMPROB_OLDPACKAGE, rpmteNEVR(p), rpmteKey(p), @@ -907,18 +907,18 @@ static void skipFiles(const rpmts ts, rpmfi fi) /** * Return transaction element's file info. * @todo Take a rpmfi refcount here. - * @param tei transaction element iterator + * @param tsi transaction element iterator * @return transaction element file info */ static /*@null@*/ -rpmfi rpmteiGetFi(const rpmtei tei) +rpmfi rpmtsiFi(const rpmtsi tsi) /*@*/ { rpmfi fi = NULL; - if (tei != NULL && tei->ocsave != -1) { + if (tsi != NULL && tsi->ocsave != -1) { /*@-type -abstract@*/ /* FIX: rpmte not opaque */ - rpmte te = rpmtsElement(tei->ts, tei->ocsave); + rpmte te = rpmtsElement(tsi->ts, tsi->ocsave); /*@-assignexpose@*/ if (te != NULL && (fi = te->fi) != NULL) fi->te = te; @@ -945,8 +945,8 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet) fingerPrintCache fpc; rpmps ps; PSM_t psm = memset(alloca(sizeof(*psm)), 0, sizeof(*psm)); - rpmtei pi; rpmte p; - rpmtei qi; rpmte q; + rpmtsi pi; rpmte p; + rpmtsi qi; rpmte q; int xx; /* FIXME: what if the same package is included in ts twice? */ @@ -989,14 +989,14 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet) * For packages being removed: * - count files. */ - ps = rpmtsGetProblems(ts); + ps = rpmtsProblems(ts); /* The ordering doesn't matter here */ - pi = rpmteiInit(ts); - while ((p = rpmteiNext(pi, TR_ADDED)) != NULL) { + pi = rpmtsiInit(ts); + while ((p = rpmtsiNext(pi, TR_ADDED)) != NULL) { rpmdbMatchIterator mi; int fc; - if ((fi = rpmteiGetFi(pi)) == NULL) + if ((fi = rpmtsiFi(pi)) == NULL) continue; /* XXX can't happen */ fc = rpmfiFC(fi); @@ -1044,21 +1044,21 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet) totalFileCount += fc; } - pi = rpmteiFree(pi); + pi = rpmtsiFree(pi); ps = rpmpsFree(ps); /* The ordering doesn't matter here */ - pi = rpmteiInit(ts); - while ((p = rpmteiNext(pi, TR_REMOVED)) != NULL) { + pi = rpmtsiInit(ts); + while ((p = rpmtsiNext(pi, TR_REMOVED)) != NULL) { int fc; - if ((fi = rpmteiGetFi(pi)) == NULL) + if ((fi = rpmtsiFi(pi)) == NULL) continue; /* XXX can't happen */ fc = rpmfiFC(fi); totalFileCount += fc; } - pi = rpmteiFree(pi); + pi = rpmtsiFree(pi); /* =============================================== * Initialize transaction element file info for package: @@ -1069,15 +1069,15 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet) * calling fpLookupList only once. I'm not sure that the speedup is * worth the trouble though. */ - pi = rpmteiInit(ts); - while ((p = rpmteiNext(pi, 0)) != NULL) { + pi = rpmtsiInit(ts); + while ((p = rpmtsiNext(pi, 0)) != NULL) { int fc; - if ((fi = rpmteiGetFi(pi)) == NULL) + if ((fi = rpmtsiFi(pi)) == NULL) continue; /* XXX can't happen */ fc = rpmfiFC(fi); -#ifdef DYING /* XXX W2DO? this is now done in rpmteiGetFi, okay ??? */ +#ifdef DYING /* XXX W2DO? this is now done in rpmtsiFi, okay ??? */ fi->magic = RPMFIMAGIC; fi->te = p; #endif @@ -1098,7 +1098,7 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet) fi->fps = (fc > 0 ? xmalloc(fc * sizeof(*fi->fps)) : NULL); } - pi = rpmteiFree(pi); + pi = rpmtsiFree(pi); if (!rpmtsChrootDone(ts)) { const char * rootDir = rpmtsRootDir(ts); @@ -1116,11 +1116,11 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet) /* =============================================== * Add fingerprint for each file not skipped. */ - pi = rpmteiInit(ts); - while ((p = rpmteiNext(pi, 0)) != NULL) { + pi = rpmtsiInit(ts); + while ((p = rpmtsiNext(pi, 0)) != NULL) { int fc; - if ((fi = rpmteiGetFi(pi)) == NULL) + if ((fi = rpmtsiFi(pi)) == NULL) continue; /* XXX can't happen */ fc = rpmfiFC(fi); @@ -1137,7 +1137,7 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet) } /*@=branchstate@*/ } - pi = rpmteiFree(pi); + pi = rpmtsiFree(pi); NOTIFY(ts, (NULL, RPMCALLBACK_TRANS_START, 6, ts->orderCount, NULL, ts->notifyData)); @@ -1145,18 +1145,18 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet) /* =============================================== * Compute file disposition for each package in transaction set. */ - ps = rpmtsGetProblems(ts); - pi = rpmteiInit(ts); - while ((p = rpmteiNext(pi, 0)) != NULL) { + ps = rpmtsProblems(ts); + pi = rpmtsiInit(ts); + while ((p = rpmtsiNext(pi, 0)) != NULL) { dbiIndexSet * matches; int knownBad; int fc; - if ((fi = rpmteiGetFi(pi)) == NULL) + if ((fi = rpmtsiFi(pi)) == NULL) continue; /* XXX can't happen */ fc = rpmfiFC(fi); - NOTIFY(ts, (NULL, RPMCALLBACK_TRANS_PROGRESS, rpmteiGetOc(pi), + NOTIFY(ts, (NULL, RPMCALLBACK_TRANS_PROGRESS, rpmtsiOc(pi), ts->orderCount, NULL, ts->notifyData)); if (fc == 0) continue; @@ -1187,14 +1187,14 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet) int ro; ro = dbiIndexRecordOffset(matches[i], j); knownBad = 0; - qi = rpmteiInit(ts); - while ((q = rpmteiNext(qi, TR_REMOVED)) != NULL) { + qi = rpmtsiInit(ts); + while ((q = rpmtsiNext(qi, TR_REMOVED)) != NULL) { if (ro == knownBad) /*@innerbreak@*/ break; if (rpmteDBOffset(q) == ro) knownBad = ro; } - qi = rpmteiFree(qi); + qi = rpmtsiFree(qi); shared->pkgFileNum = i; shared->otherPkg = dbiIndexRecordOffset(matches[i], j); @@ -1262,7 +1262,7 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet) /*@switchbreak@*/ break; } } - pi = rpmteiFree(pi); + pi = rpmtsiFree(pi); ps = rpmpsFree(ps); if (rpmtsChrootDone(ts)) { @@ -1281,15 +1281,15 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet) /* =============================================== * Free unused memory as soon as possible. */ - pi = rpmteiInit(ts); - while ((p = rpmteiNext(pi, 0)) != NULL) { - if ((fi = rpmteiGetFi(pi)) == NULL) + pi = rpmtsiInit(ts); + while ((p = rpmtsiNext(pi, 0)) != NULL) { + if ((fi = rpmtsiFi(pi)) == NULL) continue; /* XXX can't happen */ if (rpmfiFC(fi) == 0) continue; fi->fps = _free(fi->fps); } - pi = rpmteiFree(pi); + pi = rpmtsiFree(pi); fpc = fpCacheFree(fpc); ts->ht = htFree(ts->ht); @@ -1311,9 +1311,9 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet) * Save removed files before erasing. */ if (rpmtsFlags(ts) & (RPMTRANS_FLAG_DIRSTASH | RPMTRANS_FLAG_REPACKAGE)) { - pi = rpmteiInit(ts); - while ((p = rpmteiNext(pi, 0)) != NULL) { - fi = rpmteiGetFi(pi); + pi = rpmtsiInit(ts); + while ((p = rpmtsiNext(pi, 0)) != NULL) { + fi = rpmtsiFi(pi); switch (rpmteType(p)) { case TR_ADDED: /*@switchbreak@*/ break; @@ -1329,21 +1329,21 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet) /*@switchbreak@*/ break; } } - pi = rpmteiFree(pi); + pi = rpmtsiFree(pi); } /* =============================================== * Install and remove packages. */ lastKey = (alKey)-2; /* erased packages have -1 */ - pi = rpmteiInit(ts); + pi = rpmtsiInit(ts); /*@-branchstate@*/ /* FIX: fi reload needs work */ - while ((p = rpmteiNext(pi, 0)) != NULL) { + while ((p = rpmtsiNext(pi, 0)) != NULL) { alKey pkgKey; int gotfd; gotfd = 0; - if ((fi = rpmteiGetFi(pi)) == NULL) + if ((fi = rpmtsiFi(pi)) == NULL) continue; /* XXX can't happen */ psm->te = p; @@ -1448,7 +1448,7 @@ fi->actions = actions; /*@=type@*/ } /*@=branchstate@*/ - pi = rpmteiFree(pi); + pi = rpmtsiFree(pi); psm->ts = rpmtsUnlink(psm->ts, "tsRun"); @@ -185,7 +185,7 @@ static int ftsPrint(FTS * ftsp, FTSENT * fts, rpmts ts) indent * (fts->fts_level < 0 ? 0 : fts->fts_level), "", n, v, r); #ifdef NOTYET - xx = rpmtsAddPackage(ts, h, fts->fts_path, 1, NULL); + xx = rpmtsAddInstallElement(ts, h, fts->fts_path, 1, NULL); #endif break; @@ -374,7 +374,7 @@ if (!_debug) { xx = rpmtsCheck(ts); - ps = rpmtsGetProblems(ts); + ps = rpmtsProblems(ts); if (ps) { rpmMessage(RPMMESS_ERROR, _("Failed dependencies:\n")); printDepProblems(stderr, ps); diff --git a/lib/verify.c b/lib/verify.c index 92d2fb233..8ae977ad8 100644 --- a/lib/verify.c +++ b/lib/verify.c @@ -357,10 +357,10 @@ static int verifyDependencies(/*@unused@*/ QVA_t qva, rpmts ts, int i; rpmtsClean(ts); - (void) rpmtsAddPackage(ts, h, NULL, 0, NULL); + (void) rpmtsAddInstallElement(ts, h, NULL, 0, NULL); xx = rpmtsCheck(ts); - ps = rpmtsGetProblems(ts); + ps = rpmtsProblems(ts); /*@-branchstate@*/ if (ps) { |