From 7ea494327675e59d4f0998233698602312075dee Mon Sep 17 00:00:00 2001 From: jbj Date: Sun, 11 Nov 2001 02:50:31 +0000 Subject: [PATCH] Iterate over TR_REMOVED transactionElement stripped data, don't hit rpmdb. CVS patchset: 5171 CVS date: 2001/11/11 02:50:31 --- lib/depends.c | 146 ++++++++++++++++++++++++++-------------------------------- lib/rpmal.h | 4 +- po/rpm.pot | 38 +++++++-------- 3 files changed, 86 insertions(+), 102 deletions(-) diff --git a/lib/depends.c b/lib/depends.c index 97712ca..1c2d8f2 100644 --- a/lib/depends.c +++ b/lib/depends.c @@ -19,16 +19,17 @@ #include "debug.h" -/*@access Header@*/ /* XXX compared with NULL */ -/*@access FD_t@*/ /* XXX compared with NULL */ -/*@access rpmdb@*/ /* XXX compared with NULL */ -/*@access rpmdbMatchIterator@*/ /* XXX compared with NULL */ +/*@access Header @*/ /* XXX compared with NULL */ +/*@access FD_t @*/ /* XXX compared with NULL */ +/*@access rpmdb @*/ /* XXX compared with NULL */ +/*@access rpmdbMatchIterator @*/ /* XXX compared with NULL */ -/*@access tsortInfo@*/ -/*@access rpmTransactionSet@*/ +/*@access rpmFNSet @*/ +/*@access tsortInfo @*/ +/*@access rpmTransactionSet @*/ /*@access alKey @*/ -/*@access rpmProblemSet@*/ +/*@access rpmProblemSet @*/ /** */ @@ -1753,13 +1754,12 @@ static int rpmdbCloseDBI(/*@null@*/ rpmdb db, int rpmtag) int rpmdepCheck(rpmTransactionSet ts, rpmProblem * conflicts, int * numConflicts) { - int scareMem = _DS_SCAREMEM; - HGE_t hge = (HGE_t)headerGetEntryMinMemory; - HFD_t hfd = headerFreeData; rpmdbMatchIterator mi = NULL; teIterator pi = NULL; transactionElement p; + char * fn = NULL; + int fileAlloced = 0; int closeatexit = 0; - int j, xx; + int xx; int rc; /* Do lazy, readonly, open of rpm database. */ @@ -1782,7 +1782,6 @@ int rpmdepCheck(rpmTransactionSet ts, * are satisfied. */ pi = teInitIterator(ts); - /* XXX Only added packages are checked (for now). */ while ((p = teNext(pi, TR_ADDED)) != NULL) { rpmDepSet provides; uint_32 multiLib; @@ -1826,87 +1825,71 @@ int rpmdepCheck(rpmTransactionSet ts, * Look at the removed packages and make sure they aren't critical. */ /*@-branchstate@*/ - if (ts->numRemovedPackages > 0) { - rpmDepSet provides; - Header h; - - mi = rpmtsInitIterator(ts, RPMDBI_PACKAGES, NULL, 0); - xx = rpmdbAppendIterator(mi, - ts->removedPackages, ts->numRemovedPackages); - while ((h = rpmdbNextIterator(mi)) != NULL) { - - { const char * name = NULL; - const char * pkgNEVR = hGetNEVR(h, &name); - rpmMessage(RPMMESS_DEBUG, "========== --- %s\n" , pkgNEVR); - pkgNEVR = _free(pkgNEVR); - - /* Erasing: check name against requiredby matches. */ - rc = checkDependentPackages(ts, name); - if (rc) + pi = teInitIterator(ts); + while ((p = teNext(pi, TR_REMOVED)) != NULL) { + rpmDepSet provides; + rpmFNSet fns; + + rpmMessage(RPMMESS_DEBUG, "========== --- %s\n" , p->NEVR); + + /* Erasing: check name against requiredby matches. */ + rc = checkDependentPackages(ts, p->name); + if (rc) goto exit; - } - rc = 0; - provides = dsiInit(dsNew(h, RPMTAG_PROVIDENAME, scareMem)); - if (provides != NULL) - while (dsiNext(provides) >= 0) { - const char * Name; + rc = 0; + provides = p->provides; + provides = dsiInit(provides); + if (provides != NULL) + while (dsiNext(provides) >= 0) { + const char * Name; - if ((Name = dsiGetN(provides)) == NULL) - /*@innercontinue@*/ continue; /* XXX can't happen */ + if ((Name = dsiGetN(provides)) == NULL) + /*@innercontinue@*/ continue; /* XXX can't happen */ - /* Erasing: check provides against requiredby matches. */ - if (!checkDependentPackages(ts, Name)) - /*@innercontinue@*/ continue; - rc = 1; - /*@innerbreak@*/ break; - } - provides = dsFree(provides); - if (rc) - goto exit; + /* Erasing: check provides against requiredby matches. */ + if (!checkDependentPackages(ts, Name)) + /*@innercontinue@*/ continue; + rc = 1; + /*@innerbreak@*/ break; + } + if (rc) + goto exit; - { const char ** baseNames, ** dirNames; - int_32 * dirIndexes; - rpmTagType dnt, bnt; - int fileCount; - char * fileName = NULL; - int fileAlloced = 0; - int len; + fns = p->fns; + if (fns == NULL) + continue; + if (fns->bnl == NULL) + continue; /* XXX can't happen */ + if (fns->dnl == NULL) + continue; /* XXX can't happen */ + if (fns->dil == NULL) + continue; /* XXX can't happen */ - if (hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, &fileCount)) - { - xx = hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL); - xx = hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, - NULL); - rc = 0; - for (j = 0; j < fileCount; j++) { - len = strlen(baseNames[j]) + 1 + - strlen(dirNames[dirIndexes[j]]); - if (len > fileAlloced) { - fileAlloced = len * 2; - fileName = xrealloc(fileName, fileAlloced); - } - *fileName = '\0'; - (void) stpcpy( stpcpy(fileName, dirNames[dirIndexes[j]]) , baseNames[j]); - /* Erasing: check filename against requiredby matches. */ - if (!checkDependentPackages(ts, fileName)) - /*@innercontinue@*/ continue; - rc = 1; - /*@innerbreak@*/ break; - } + rc = 0; + for (fns->i = 0; fns->i < fns->fc; fns->i++) { + int len; - fileName = _free(fileName); - baseNames = hfd(baseNames, bnt); - dirNames = hfd(dirNames, dnt); - if (rc) - goto exit; + len = strlen(fns->bnl[fns->i]) + 1 + + strlen(fns->dnl[fns->dil[fns->i]]); + if (len > fileAlloced) { + fileAlloced = len * 2; + fn = xrealloc(fn, fileAlloced); } + *fn = '\0'; + (void) stpcpy( stpcpy(fn, fns->dnl[fns->dil[fns->i]]), fns->bnl[fns->i]); + /* Erasing: check filename against requiredby matches. */ + if (!checkDependentPackages(ts, fn)) + /*@innercontinue@*/ continue; + rc = 1; + /*@innerbreak@*/ break; } - } - mi = rpmdbFreeIterator(mi); + if (rc) + goto exit; } /*@=branchstate@*/ + pi = teFreeIterator(pi); if (ts->probs->numProblems) { *conflicts = ts->probs->probs; @@ -1916,6 +1899,7 @@ int rpmdepCheck(rpmTransactionSet ts, rc = 0; exit: + fn = _free(fn); mi = rpmdbFreeIterator(mi); pi = teFreeIterator(pi); /*@-branchstate@*/ diff --git a/lib/rpmal.h b/lib/rpmal.h index 5ee9c97..fca7e45 100644 --- a/lib/rpmal.h +++ b/lib/rpmal.h @@ -45,8 +45,8 @@ void alDelPackage(availableList al, /*@null@*/ alKey pkgKey) * @param fns file info set * @return available package index */ -alKey alAddPackage(availableList al, /*@null@*/ alKey pkgKey, - fnpyKey key, rpmDepSet provides, rpmFNSet fns) +alKey alAddPackage(availableList al, /*@null@*/ alKey pkgKey, fnpyKey key, + /*@null@*/ rpmDepSet provides, /*@null@*/ rpmFNSet fns) /*@modifies al, provides, fns @*/; /** diff --git a/po/rpm.pot b/po/rpm.pot index c90a3fe..dc96a77 100644 --- a/po/rpm.pot +++ b/po/rpm.pot @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2001-11-10 20:39-0500\n" +"POT-Creation-Date: 2001-11-10 21:35-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1410,83 +1410,83 @@ msgstr "" msgid " failed - " msgstr "" -#: lib/depends.c:113 +#: lib/depends.c:114 #, c-format msgid "cannot open Packages database in %s\n" msgstr "" -#: lib/depends.c:415 +#: lib/depends.c:416 #, c-format msgid "package %s was already added, replacing with %s\n" msgstr "" -#: lib/depends.c:684 +#: lib/depends.c:685 msgid "(cached)" msgstr "" -#: lib/depends.c:709 +#: lib/depends.c:710 msgid "(rpmrc provides)" msgstr "" -#: lib/depends.c:725 +#: lib/depends.c:726 msgid "(rpmlib provides)" msgstr "" -#: lib/depends.c:746 +#: lib/depends.c:747 msgid "(db files)" msgstr "" -#: lib/depends.c:758 +#: lib/depends.c:759 msgid "(db provides)" msgstr "" -#: lib/depends.c:771 +#: lib/depends.c:772 msgid "(db package)" msgstr "" -#: lib/depends.c:810 +#: lib/depends.c:811 #, c-format msgid "%9s: (%s, %s) added to Depends cache.\n" msgstr "" -#: lib/depends.c:812 lib/rpmds.c:563 lib/rpmds.c:721 +#: lib/depends.c:813 lib/rpmds.c:563 lib/rpmds.c:721 msgid "NO " msgstr "" -#: lib/depends.c:812 lib/rpmds.c:563 lib/rpmds.c:721 +#: lib/depends.c:813 lib/rpmds.c:563 lib/rpmds.c:721 msgid "YES" msgstr "" -#: lib/depends.c:1154 +#: lib/depends.c:1155 #, c-format msgid "removing %s \"%s\" from tsort relations.\n" msgstr "" #. Record all relations. -#: lib/depends.c:1387 +#: lib/depends.c:1388 msgid "========== recording tsort relations\n" msgstr "" #. T4. Scan for zeroes. -#: lib/depends.c:1458 +#: lib/depends.c:1459 msgid "" "========== tsorting packages (order, #predecessors, #succesors, depth)\n" msgstr "" -#: lib/depends.c:1533 +#: lib/depends.c:1534 msgid "========== successors only (presentation order)\n" msgstr "" -#: lib/depends.c:1593 +#: lib/depends.c:1594 msgid "LOOP:\n" msgstr "" -#: lib/depends.c:1628 +#: lib/depends.c:1629 msgid "========== continuing tsort ...\n" msgstr "" #. Return no. of packages that could not be ordered. -#: lib/depends.c:1633 +#: lib/depends.c:1634 #, c-format msgid "rpmdepOrder failed, %d elements remain\n" msgstr "" -- 2.7.4