diff options
author | jbj <devnull@localhost> | 2000-04-13 12:43:49 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2000-04-13 12:43:49 +0000 |
commit | bd4ce434867c61fb80976f05b6556e48391b1864 (patch) | |
tree | b3a0588a1aca8a3896b0dc84efaeb81f84593370 /lib | |
parent | 7fd28d7bf20d37d360011b1a6957d35b99bf8098 (diff) | |
download | librpm-tizen-bd4ce434867c61fb80976f05b6556e48391b1864.tar.gz librpm-tizen-bd4ce434867c61fb80976f05b6556e48391b1864.tar.bz2 librpm-tizen-bd4ce434867c61fb80976f05b6556e48391b1864.zip |
Remove rpmdbFindByFile from API (and fix RPMDBI_FILE iterator).
CVS patchset: 3676
CVS date: 2000/04/13 12:43:49
Diffstat (limited to 'lib')
-rw-r--r-- | lib/depends.c | 98 | ||||
-rw-r--r-- | lib/rpmdb.c | 24 | ||||
-rw-r--r-- | lib/rpmlib.h | 24 |
3 files changed, 28 insertions, 118 deletions
diff --git a/lib/depends.c b/lib/depends.c index f6a3728ed..464d576b5 100644 --- a/lib/depends.c +++ b/lib/depends.c @@ -526,6 +526,7 @@ int headerMatchesDepFlags(Header h, const char *reqName, const char * reqEVR, in } +#ifdef DYING static inline int dbrecMatchesDepFlags(rpmTransactionSet rpmdep, int recOffset, const char * reqName, const char * reqEVR, int reqFlags, dbrecMatch_t matchDepFlags) @@ -545,6 +546,7 @@ static inline int dbrecMatchesDepFlags(rpmTransactionSet rpmdep, int recOffset, return rc; } +#endif rpmTransactionSet rpmtransCreateSet(rpmdb db, const char * root) { @@ -611,8 +613,8 @@ int rpmtransAddPackage(rpmTransactionSet rpmdep, Header h, FD_t fd, { /* this is an install followed by uninstalls */ dbiIndexSet matches = NULL; - char * name; - int count, i, j; + const char * name; + int count; const char ** obsoletes; int alNum; int * caps; @@ -661,6 +663,7 @@ int rpmtransAddPackage(rpmTransactionSet rpmdep, Header h, FD_t fd, if (headerGetEntry(h, RPMTAG_OBSOLETENAME, NULL, (void **) &obsoletes, &count)) { const char **obsoletesEVR; int_32 *obsoletesFlags; + int j; headerGetEntry(h, RPMTAG_OBSOLETEVERSION, NULL, (void **) &obsoletesEVR, NULL); headerGetEntry(h, RPMTAG_OBSOLETEFLAGS, NULL, (void **) &obsoletesFlags, NULL); @@ -865,7 +868,9 @@ static int unsatisfiedDepend(rpmTransactionSet rpmdep, const char * keyName, const char * keyEVR, int keyFlags, /*@out@*/ struct availablePackage ** suggestion) { - dbiIndexSet matches = NULL; /* XXX DYING */ +#ifdef DYING + dbiIndexSet matches = NULL; +#endif int rc = 0; /* assume dependency is satisfied */ int i; @@ -893,7 +898,7 @@ static int unsatisfiedDepend(rpmTransactionSet rpmdep, if (rpmdep->db != NULL) { if (*keyName == '/') { /* keyFlags better be 0! */ -#ifndef DYING /* XXX more to do here */ +#ifdef DYING if (!rpmdbFindByFile(rpmdep->db, keyName, &matches)) { for (i = 0; i < dbiIndexSetCount(matches); i++) { unsigned int recOffset = dbiIndexRecordOffset(matches, i); @@ -914,7 +919,7 @@ static int unsatisfiedDepend(rpmTransactionSet rpmdep, { rpmdbMatchIterator mi; Header h2; - mi = rpmdbInitIterator(rpmdep->db, RPMDBI_PROVIDES, keyName, 0); + mi = rpmdbInitIterator(rpmdep->db, RPMDBI_FILE, keyName, 0); while ((h2 = rpmdbNextIterator(mi)) != NULL) { unsigned int recOffset = rpmdbGetIteratorOffset(mi); if (bsearch(&recOffset, @@ -932,36 +937,13 @@ static int unsatisfiedDepend(rpmTransactionSet rpmdep, } #endif } - if (matches) { - dbiFreeIndexSet(matches); - matches = NULL; - } - #ifdef DYING - if (!rpmdbFindByProvides(rpmdep->db, keyName, &matches)) { - for (i = 0; i < dbiIndexSetCount(matches); i++) { - unsigned int recOffset = dbiIndexRecordOffset(matches, i); - if (bsearch(&recOffset, - rpmdep->removedPackages, - rpmdep->numRemovedPackages, - sizeof(int), intcmp)) - continue; - if (dbrecMatchesDepFlags(rpmdep, recOffset, - keyName, keyEVR, keyFlags, rangeMatchesDepFlags)) { - break; - } - } - - if (i < dbiIndexSetCount(matches)) { - rpmMessage(RPMMESS_DEBUG, _("%s: %s satisfied by db provides.\n"), keyType, keyDepend); - goto exit; - } - } if (matches) { dbiFreeIndexSet(matches); matches = NULL; } -#else +#endif + { rpmdbMatchIterator mi; Header h2; @@ -973,7 +955,7 @@ static int unsatisfiedDepend(rpmTransactionSet rpmdep, rpmdep->numRemovedPackages, sizeof(int), intcmp)) continue; - if (headerMatchesDepFlags(h2, keyName, keyEVR, keyFlags)) + if (rangeMatchesDepFlags(h2, keyName, keyEVR, keyFlags)) break; } rpmdbFreeIterator(mi); @@ -982,7 +964,6 @@ static int unsatisfiedDepend(rpmTransactionSet rpmdep, goto exit; } } -#endif { rpmdbMatchIterator mi; Header h2; @@ -1027,10 +1008,12 @@ static int unsatisfiedDepend(rpmTransactionSet rpmdep, rc = 1; /* dependency is unsatisfied */ exit: - if (matches) { /* XXX DYING */ +#ifdef DYING + if (matches) { dbiFreeIndexSet(matches); matches = NULL; } +#endif return rc; } @@ -1177,41 +1160,12 @@ static int checkPackageDeps(rpmTransactionSet rpmdep, struct problemsSet * psp, /* Adding: check name/provides key against each conflict match. */ /* Erasing: check name/provides/filename key against each requiredby match. */ -#ifdef DYING -static int checkPackageSet(rpmTransactionSet rpmdep, struct problemsSet * psp, - const char * key, dbiIndexSet matches) -#else static int checkPackageSet(rpmTransactionSet rpmdep, struct problemsSet * psp, const char * key, /*@only@*/ rpmdbMatchIterator mi) -#endif { Header h; int rc = 0; -#ifdef DYING - int i; - - for (i = 0; i < dbiIndexSetCount(matches); i++) { - unsigned int recOffset = dbiIndexRecordOffset(matches, i); - if (bsearch(&recOffset, rpmdep->removedPackages, - rpmdep->numRemovedPackages, sizeof(int), intcmp)) - continue; - - h = rpmdbGetRecord(rpmdep->db, recOffset); - if (h == NULL) { - rpmError(RPMERR_DBCORRUPT, - _("cannot read header at %d for dependency check"), - rpmdep->removedPackages[i]); - return 1; - } - - if (checkPackageDeps(rpmdep, psp, h, key)) { - headerFree(h); - return 1; - } - headerFree(h); - } -#else while ((h = rpmdbNextIterator(mi)) != NULL) { unsigned int recOffset = rpmdbGetIteratorOffset(mi); if (bsearch(&recOffset, rpmdep->removedPackages, @@ -1224,7 +1178,6 @@ static int checkPackageSet(rpmTransactionSet rpmdep, struct problemsSet * psp, } } rpmdbFreeIterator(mi); -#endif return rc; } @@ -1233,20 +1186,9 @@ static int checkPackageSet(rpmTransactionSet rpmdep, struct problemsSet * psp, static int checkDependentPackages(rpmTransactionSet rpmdep, struct problemsSet * psp, const char * key) { -#ifdef DYING - dbiIndexSet matches = NULL; - int rc = 0; - - if (!rpmdbFindByRequiredBy(rpmdep->db, key, &matches)) - rc = checkPackageSet(rpmdep, psp, key, matches); - if (matches) - dbiFreeIndexSet(matches); - return rc; -#else rpmdbMatchIterator mi; mi = rpmdbInitIterator(rpmdep->db, RPMDBI_REQUIREDBY, key, 0); return checkPackageSet(rpmdep, psp, key, mi); -#endif } /* Adding: check name/provides key against conflicts matches. */ @@ -1256,17 +1198,9 @@ static int checkDependentConflicts(rpmTransactionSet rpmdep, int rc = 0; if (rpmdep->db) { /* XXX is this necessary? */ -#ifdef DYING - dbiIndexSet matches = NULL; - if (!rpmdbFindByConflicts(rpmdep->db, key, &matches)) - rc = checkPackageSet(rpmdep, psp, key, matches); - if (matches) - dbiFreeIndexSet(matches); -#else rpmdbMatchIterator mi; mi = rpmdbInitIterator(rpmdep->db, RPMDBI_CONFLICTS, key, 0); rc = checkPackageSet(rpmdep, psp, key, mi); -#endif } return rc; diff --git a/lib/rpmdb.c b/lib/rpmdb.c index f1d293477..bf0aef669 100644 --- a/lib/rpmdb.c +++ b/lib/rpmdb.c @@ -271,7 +271,7 @@ Header rpmdbGetRecord(rpmdb db, unsigned int offset) return headerLoad(uh); } -int rpmdbFindByFile(rpmdb db, const char * filespec, dbiIndexSet * matches) +static int rpmdbFindByFile(rpmdb db, const char * filespec, dbiIndexSet * matches) { const char * dirName; const char * baseName; @@ -372,20 +372,6 @@ int rpmdbFindByFile(rpmdb db, const char * filespec, dbiIndexSet * matches) return 0; } -#ifdef DYING -int rpmdbFindByProvides(rpmdb db, const char * filespec, dbiIndexSet * matches) { - return dbiSearchIndex(db->_dbi[RPMDBI_PROVIDES], filespec, 0, matches); -} - -int rpmdbFindByRequiredBy(rpmdb db, const char * filespec, dbiIndexSet * matches) { - return dbiSearchIndex(db->_dbi[RPMDBI_REQUIREDBY], filespec, 0, matches); -} - -int rpmdbFindByConflicts(rpmdb db, const char * filespec, dbiIndexSet * matches) { - return dbiSearchIndex(db->_dbi[RPMDBI_CONFLICTS], filespec, 0, matches); -} -#endif - int rpmdbFindPackage(rpmdb db, const char * name, dbiIndexSet * matches) { return dbiSearchIndex(db->_dbi[RPMDBI_NAME], name, 0, matches); } @@ -565,10 +551,14 @@ rpmdbMatchIterator rpmdbInitIterator(rpmdb db, int dbix, const void * key, size_ if (key) { int rc; - rc = dbiSearchIndex(dbi, key, keylen, &set); + if (dbix == RPMDBI_FILE) { + rc = rpmdbFindByFile(db, key, &set); + } else { + rc = dbiSearchIndex(dbi, key, keylen, &set); + } switch (rc) { default: - case -1: /* error */ + case -1: /* error */ case 1: /* not found */ if (set) dbiFreeIndexSet(set); diff --git a/lib/rpmlib.h b/lib/rpmlib.h index 827db5091..e4a685154 100644 --- a/lib/rpmlib.h +++ b/lib/rpmlib.h @@ -383,33 +383,18 @@ int rpmdbOpenForTraversal(const char * prefix, /*@out@*/ rpmdb * dbp); */ Header rpmdbGetRecord(rpmdb db, unsigned int offset); +#ifdef DYING /** * @param db rpm database */ int rpmdbFindByFile(rpmdb db, const char * filespec, /*@out@*/ dbiIndexSet * matches); +#endif /** * @param db rpm database */ int rpmdbFindPackage(rpmdb db, const char * name, /*@out@*/ dbiIndexSet * matches); -#ifdef DYING -/** - * @param db rpm database - */ -int rpmdbFindByProvides(rpmdb db, const char * provides, - /*@out@*/ dbiIndexSet * matches); -/** - * @param db rpm database - */ -int rpmdbFindByRequiredBy(rpmdb db, const char * requires, - /*@out@*/ dbiIndexSet * matches); -/** - * @param db rpm database - */ -int rpmdbFindByConflicts(rpmdb db, const char * conflicts, - /*@out@*/ dbiIndexSet * matches); -#endif /* these are just convenience functions */ /** @@ -558,10 +543,10 @@ typedef enum rpmProblemType_e { RPMPROB_BADARCH, typedef /*@abstract@*/ struct rpmProblem_s { Header h, altH; - /*@dependent@*/ const void * key; +/*@dependent@*/ const void * key; rpmProblemType type; int ignoreProblem; - /*@only@*/ const char * str1; +/*@only@*/ const char * str1; unsigned long ulong1; } rpmProblem; @@ -811,6 +796,7 @@ typedef struct rpmQVArguments QVA_t; * @param db rpm database */ typedef int (*QVF_t) (QVA_t *qva, rpmdb db, Header h); + /** * @param db rpm database */ |