diff options
author | jbj <devnull@localhost> | 2000-04-27 01:11:48 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2000-04-27 01:11:48 +0000 |
commit | 113948c75c111b27d168719573d5c29c92e7dc0d (patch) | |
tree | 075e5f5b2f25bdb9319648610b99a466eab33136 /lib | |
parent | 24a64f27394fcf24e3e3f3d9d2f7b321f603a6a8 (diff) | |
download | librpm-tizen-113948c75c111b27d168719573d5c29c92e7dc0d.tar.gz librpm-tizen-113948c75c111b27d168719573d5c29c92e7dc0d.tar.bz2 librpm-tizen-113948c75c111b27d168719573d5c29c92e7dc0d.zip |
Sanity and API clean up. (make dist)
CVS patchset: 3705
CVS date: 2000/04/27 01:11:48
Diffstat (limited to 'lib')
-rw-r--r-- | lib/depends.c | 11 | ||||
-rw-r--r-- | lib/install.c | 15 | ||||
-rw-r--r-- | lib/query.c | 54 | ||||
-rw-r--r-- | lib/rpmdb.c | 12 | ||||
-rw-r--r-- | lib/rpmdb.h | 40 | ||||
-rw-r--r-- | lib/rpminstall.c | 44 | ||||
-rw-r--r-- | lib/rpmlib.h | 149 | ||||
-rw-r--r-- | lib/transaction.c | 68 | ||||
-rw-r--r-- | lib/uninstall.c | 2 |
9 files changed, 117 insertions, 278 deletions
diff --git a/lib/depends.c b/lib/depends.c index c9fb40bad..fe47b4d99 100644 --- a/lib/depends.c +++ b/lib/depends.c @@ -612,7 +612,6 @@ int rpmtransAddPackage(rpmTransactionSet rpmdep, Header h, FD_t fd, const void * key, int upgrade, rpmRelocation * relocs) { /* this is an install followed by uninstalls */ - dbiIndexSet matches = NULL; const char * name; int count; const char ** obsoletes; @@ -670,11 +669,6 @@ int rpmtransAddPackage(rpmTransactionSet rpmdep, Header h, FD_t fd, for (j = 0; j < count; j++) { - if (matches) { - dbiFreeIndexSet(matches); - matches = NULL; - } - /* XXX avoid self-obsoleting packages. */ if (!strcmp(name, obsoletes[j])) continue; @@ -708,11 +702,6 @@ int rpmtransAddPackage(rpmTransactionSet rpmdep, Header h, FD_t fd, free(obsoletes); } - if (matches) { - dbiFreeIndexSet(matches); - matches = NULL; - } - return 0; } diff --git a/lib/install.c b/lib/install.c index bef1d7f74..09b986ee0 100644 --- a/lib/install.c +++ b/lib/install.c @@ -7,7 +7,6 @@ #include "cpio.h" #include "install.h" #include "misc.h" -#include "rpmdb.h" /* XXX for rpmdbAdd/rpmdbRemove/rpmdbUpdateRecord */ struct callbackInfo { unsigned long archiveSize; @@ -677,9 +676,8 @@ int rpmInstallSourcePackage(const char * rootdir, FD_t fd, rpmInstallLoadMacros(h); rc = installSources(h, rootdir, fd, specFile, notify, notifyData); - if (h != NULL) { + if (h) headerFree(h); - } return rc; } @@ -701,7 +699,6 @@ int installBinaryPackage(const char * rootdir, rpmdb db, FD_t fd, Header h, char * fileStates = NULL; int i; int otherOffset = 0; - dbiIndexSet matches = NULL; int scriptArg; int stripSize = 1; /* strip at least first / for cpio */ struct fileMemory *fileMem = NULL; @@ -939,17 +936,13 @@ int installBinaryPackage(const char * rootdir, rpmdb db, FD_t fd, Header h, rc = 0; exit: - if (matches) { - dbiFreeIndexSet(matches); - matches = NULL; - } if (rootdir && currDir) { /*@-unrecog@*/ chroot("."); /*@=unrecog@*/ chdir(currDir); } - if (fileMem) freeFileMemory(fileMem); - if (rc) { + if (fileMem) + freeFileMemory(fileMem); + if (rc) headerFree(h); - } return rc; } diff --git a/lib/query.c b/lib/query.c index ed5174ba6..3f1a8312f 100644 --- a/lib/query.c +++ b/lib/query.c @@ -418,7 +418,6 @@ void rpmDisplayQueryTags(FILE * f) } } -#ifndef DYING int showMatches(QVA_t *qva, rpmdbMatchIterator mi, QVF_t showPackage) { Header h; @@ -432,48 +431,22 @@ int showMatches(QVA_t *qva, rpmdbMatchIterator mi, QVF_t showPackage) rpmdbFreeIterator(mi); return ec; } -#else -int showMatches(QVA_t *qva, rpmdb db, dbiIndexSet matches, QVF_t showPackage) -{ - Header h; - int ec = 0; - int i; - - for (i = 0; i < dbiIndexSetCount(matches); i++) { - int rc; - unsigned int recOffset = dbiIndexRecordOffset(matches, i); - if (recOffset == 0) - continue; - rpmMessage(RPMMESS_DEBUG, _("package record number: %u\n"), recOffset); - - h = rpmdbGetRecord(db, recOffset); - if (h == NULL) { - fprintf(stderr, _("error: could not read database record\n")); - ec = 1; - } else { - if ((rc = showPackage(qva, db, h)) != 0) - ec = rc; - headerFree(h); - } - } - return ec; -} -#endif /* * XXX Eliminate linkage loop into librpmbuild.a */ +/** + */ int (*parseSpecVec) (Spec *specp, const char *specFile, const char *rootdir, const char *buildRoot, int inBuildArch, const char *passPhrase, char *cookie, int anyarch, int force) = NULL; +/** + */ void (*freeSpecVec) (Spec spec) = NULL; int rpmQueryVerify(QVA_t *qva, enum rpmQVSources source, const char * arg, rpmdb db, QVF_t showPackage) { -#ifdef DYING - dbiIndexSet matches = NULL; /* XXX DYING */ -#endif rpmdbMatchIterator mi = NULL; Header h; int rc; @@ -682,18 +655,6 @@ int rpmQueryVerify(QVA_t *qva, enum rpmQVSources source, const char * arg, } break; case RPMQV_PACKAGE: -#ifdef DYING - rc = rpmdbFindByLabel(db, arg, &matches); - if (rc == 1) { - retcode = 1; - fprintf(stderr, _("package %s is not installed\n"), arg); - } else if (rc == 2) { - retcode = 1; - fprintf(stderr, _("error looking for package %s\n"), arg); - } else { - retcode = showMatches(qva, db, matches, showPackage); - } -#else /* XXX HACK to get rpmdbFindByLabel out of the API */ mi = rpmdbInitIterator(db, RPMDBI_LABEL, arg, 0); if (mi == NULL) { @@ -702,16 +663,9 @@ int rpmQueryVerify(QVA_t *qva, enum rpmQVSources source, const char * arg, } else { retcode = showMatches(qva, mi, showPackage); } -#endif break; } -#ifdef DYING - if (matches) { /* XXX DYING */ - dbiFreeIndexSet(matches); - matches = NULL; - } -#endif return retcode; } diff --git a/lib/rpmdb.c b/lib/rpmdb.c index 80ae931a6..1dc5e5a4a 100644 --- a/lib/rpmdb.c +++ b/lib/rpmdb.c @@ -454,12 +454,12 @@ static inline int dbiRemoveIndexRecord(dbiIndexSet set, dbiIndexRecord rec) { return (numCopied == num); } -/* XXX rpminstall.c, transaction.c */ +/* XXX transaction.c */ unsigned int dbiIndexSetCount(dbiIndexSet set) { return set->count; } -/* XXX rpminstall.c, transaction.c */ +/* XXX transaction.c */ unsigned int dbiIndexRecordOffset(dbiIndexSet set, int recno) { return set->recs[recno].recOffset; } @@ -479,7 +479,7 @@ static inline void dbiIndexRecordOffsetSave(dbiIndexSet set, int recno, unsigned set->recs[recno].recOffset = recoff; } -/* XXX depends.c, install.c, query.c, rpminstall.c, transaction.c */ +/* XXX transaction.c */ void dbiFreeIndexSet(dbiIndexSet set) { if (set) { if (set->recs) free(set->recs); @@ -683,12 +683,6 @@ exit: return rc; } -/* XXX python/upgrade.c */ -int rpmdbOpenForTraversal(const char * prefix, rpmdb * dbp) -{ - return openDatabase(prefix, NULL, dbp, O_RDONLY, 0644, RPMDB_FLAG_MINIMAL); -} - /* XXX python/rpmmodule.c */ int rpmdbOpen (const char * prefix, rpmdb *dbp, int mode, int perms) { diff --git a/lib/rpmdb.h b/lib/rpmdb.h index 4a44ce9f0..7aacbac00 100644 --- a/lib/rpmdb.h +++ b/lib/rpmdb.h @@ -357,37 +357,43 @@ int dbiByteSwapped(dbiIndex dbi); char * db0basename(int rpmtag); /** - * Remove package header from rpm database and indices. - * @param rpmdb rpm database - * @param offset location in Packages dbi - * @param tolerant (legacy) print error messages? - * @return 0 on success */ -int rpmdbRemove(rpmdb db, unsigned int offset, int tolerant); +unsigned int rpmdbGetIteratorFileNum(rpmdbMatchIterator mi); /** - * Add package header to rpm database and indices. * @param rpmdb rpm database - * @param rpmtag rpm tag */ -int rpmdbAdd(rpmdb rpmdb, Header dbentry); +int rpmdbFindFpList(rpmdb rpmdb, fingerPrint * fpList, /*@out@*/dbiIndexSet * matchList, + int numItems); /** + * Destroy set of index database items. + * @param set set of index database items */ -unsigned int rpmdbGetIteratorFileNum(rpmdbMatchIterator mi); +void dbiFreeIndexSet(/*@only@*/ /*@null@*/ dbiIndexSet set); /** - * @param rpmdb rpm database + * Count items in index database set. + * @param set set of index database items + * @return number of items */ -int rpmdbFindFpList(rpmdb rpmdb, fingerPrint * fpList, /*@out@*/dbiIndexSet * matchList, - int numItems); +unsigned int dbiIndexSetCount(dbiIndexSet set); -/* XXX only for the benefit of runTransactions() */ /** - * @param rpmdb rpm database + * Return record offset of header from element in index database set. + * @param set set of index database items + * @param recno index of item in set + * @return record offset of header + */ +unsigned int dbiIndexRecordOffset(dbiIndexSet set, int recno); + +/** + * Return file index from element in index database set. + * @param set set of index database items + * @param recno index of item in set + * @return file index */ -int findMatches(rpmdb rpmdb, const char * name, const char * version, - const char * release, /*@out@*/ dbiIndexSet * matches); +unsigned int dbiIndexRecordFileNumber(dbiIndexSet set, int recno); #ifdef __cplusplus } diff --git a/lib/rpminstall.c b/lib/rpminstall.c index e9b931c40..29a5d152b 100644 --- a/lib/rpminstall.c +++ b/lib/rpminstall.c @@ -400,9 +400,6 @@ int rpmErase(const char * rootdir, const char ** argv, int transFlags, int interfaceFlags) { rpmdb db; -#ifdef DYING - dbiIndexSet matches = NULL; -#endif int mode; int count; const char ** arg; @@ -429,46 +426,6 @@ int rpmErase(const char * rootdir, const char ** argv, int transFlags, rpmdep = rpmtransCreateSet(db, rootdir); for (arg = argv; *arg; arg++) { -#ifdef DYING - int rc; - int i; - - rc = rpmdbFindByLabel(db, *arg, &matches); - switch (rc) { - case 1: - rpmMessage(RPMMESS_ERROR, _("package %s is not installed\n"), *arg); - numFailed++; - break; - case 2: - rpmMessage(RPMMESS_ERROR, _("searching for package %s\n"), *arg); - numFailed++; - break; - default: - count = 0; - for (i = 0; i < dbiIndexSetCount(matches); i++) - if (dbiIndexRecordOffset(matches, i)) count++; - - if (count > 1 && !(interfaceFlags & UNINSTALL_ALLMATCHES)) { - rpmMessage(RPMMESS_ERROR, _("\"%s\" specifies multiple packages\n"), - *arg); - numFailed++; - break; - } - for (i = 0; i < dbiIndexSetCount(matches); i++) { - unsigned int recOffset = dbiIndexRecordOffset(matches, i); - if (recOffset) { - rpmtransRemovePackage(rpmdep, recOffset); - numPackages++; - } - } - - break; - } - if (matches) { - dbiFreeIndexSet(matches); - matches = NULL; - } -#else /* DYING */ rpmdbMatchIterator mi; /* XXX HACK to get rpmdbFindByLabel out of the API */ @@ -492,7 +449,6 @@ int rpmErase(const char * rootdir, const char ** argv, int transFlags, } } rpmdbFreeIterator(mi); -#endif /* DYING */ } if (!(interfaceFlags & UNINSTALL_NODEPS)) { diff --git a/lib/rpmlib.h b/lib/rpmlib.h index 8a9eae20b..17bf5710f 100644 --- a/lib/rpmlib.h +++ b/lib/rpmlib.h @@ -16,38 +16,6 @@ extern "C" { #endif /** - * Destroy set of index database items. - * @param set set of index database items - */ -void dbiFreeIndexSet(/*@only@*/ /*@null@*/ dbiIndexSet set); - -/* XXX API compatibility */ -#define dbiFreeIndexRecord(_a) dbiFreeIndexSet(_a) - -/** - * Count items in index database set. - * @param set set of index database items - * @return number of items - */ -unsigned int dbiIndexSetCount(dbiIndexSet set); - -/** - * Return record offset of header from element in index database set. - * @param set set of index database items - * @param recno index of item in set - * @return record offset of header - */ -unsigned int dbiIndexRecordOffset(dbiIndexSet set, int recno); - -/** - * Return file index from element in index database set. - * @param set set of index database items - * @param recno index of item in set - * @return file index - */ -unsigned int dbiIndexRecordFileNumber(dbiIndexSet set, int recno); - -/** */ int rpmReadPackageInfo(FD_t fd, /*@out@*/ Header * signatures, /*@out@*/ Header * hdr); @@ -358,6 +326,7 @@ typedef enum rpmCallbackType_e { RPMCALLBACK_TRANS_PROGRESS, RPMCALLBACK_TRANS_START, RPMCALLBACK_TRANS_STOP, RPMCALLBACK_UNINST_PROGRESS, RPMCALLBACK_UNINST_START, RPMCALLBACK_UNINST_STOP } rpmCallbackType; + typedef void * (*rpmCallbackFunction)(const Header h, const rpmCallbackType what, const unsigned long amount, @@ -366,51 +335,28 @@ typedef void * (*rpmCallbackFunction)(const Header h, void urlSetCallback(rpmCallbackFunction notify, void *notifyData, int notifyCount); +/* ==================================================================== */ /** * @param dbp address of rpm database */ int rpmdbOpen (const char * root, /*@out@*/ rpmdb * dbp, int mode, int perms); /* 0 on error */ -int rpmdbInit(const char * root, int perms); - /* nonzero on error */ /** - * @param db rpm database */ -void rpmdbClose ( /*@only@*/ rpmdb db); - -/* Databases like this should only have rpmdb*RecNum and rpmdbGetRecord - used on them. Anything else could fail! */ -/** - * @param dbp address of rpm database - */ -int rpmdbOpenForTraversal(const char * prefix, /*@out@*/ rpmdb * dbp); - -#ifdef DYING -/** - * @param db rpm database - */ -Header rpmdbGetRecord(rpmdb db, unsigned int offset); - -/** - * @param db rpm database - */ -int rpmdbFindPackage(rpmdb db, const char * name, - /*@out@*/ dbiIndexSet * matches); +int rpmdbInit(const char * root, int perms); + /* nonzero on error */ -/* these are just convenience functions */ /** * @param db rpm database */ -int rpmdbFindByLabel(rpmdb db, const char * label, - /*@out@*/ dbiIndexSet * matches); -#endif +void rpmdbClose ( /*@only@*/ rpmdb db); /** * Return number of instances of package in rpm database. * @param db rpm database * @param name rpm package name - * @return number of instances of package in database + * @return number of instances */ int rpmdbCountPackages(rpmdb db, const char *name); @@ -480,6 +426,27 @@ Header rpmdbNextIterator(rpmdbMatchIterator mi); /*@only@*/ /*@null@*/ rpmdbMatchIterator rpmdbInitIterator(rpmdb rpmdb, int rpmtag, const void * key, size_t keylen); +/** + * Remove package header from rpm database and indices. + * @param rpmdb rpm database + * @param offset location in Packages dbi + * @param tolerant (legacy) print error messages? + * @return 0 on success + */ +int rpmdbRemove(rpmdb db, unsigned int offset, int tolerant); + +/** + * Add package header to rpm database and indices. + * @param rpmdb rpm database + * @param rpmtag rpm tag + */ +int rpmdbAdd(rpmdb rpmdb, Header dbentry); + +/** + */ +int rpmdbRebuild(const char * root); + +/* ==================================================================== */ /* we pass these around as an array with a sentinel */ typedef struct rpmRelocation_s { const char * oldPath; /* NULL here evals to RPMTAG_DEFAULTPREFIX, */ @@ -487,14 +454,25 @@ typedef struct rpmRelocation_s { const char * newPath; /* NULL means to omit the file completely! */ } rpmRelocation; + +/** + */ int rpmInstallSourcePackage(const char * root, FD_t fd, const char ** specFile, rpmCallbackFunction notify, void * notifyData, char ** cookie); + +/** + */ int rpmVersionCompare(Header first, Header second); -int rpmdbRebuild(const char * root); + +/** + */ int rpmVerifyFile(const char * root, Header h, int filenum, /*@out@*/ int * result, int omitMask); + +/** + */ int rpmVerifyScript(const char * root, Header h, FD_t err); /* Transaction sets are inherently unordered! RPM may reorder transaction @@ -527,16 +505,34 @@ struct rpmDependencyConflict { returns 0 on success, 1 on I/O error, 2 if the package needs capabilities which are not implemented */ + +/** + */ int rpmtransAddPackage(rpmTransactionSet rpmdep, Header h, FD_t fd, /*@owned@*/ const void * key, int update, rpmRelocation * relocs); + +/** + */ void rpmtransAvailablePackage(rpmTransactionSet rpmdep, Header h, /*@owned@*/ const void * key); + +/** + */ void rpmtransRemovePackage(rpmTransactionSet rpmdep, int dboffset); + +/** + */ void rpmtransFree( /*@only@*/ rpmTransactionSet rpmdep); + +/** + */ void rpmtransSetScriptFd(rpmTransactionSet ts, FD_t fd); /* this checks for dependency satisfaction, but *not* ordering */ + +/** + */ int rpmdepCheck(rpmTransactionSet rpmdep, /*@exposed@*/ /*@out@*/ struct rpmDependencyConflict ** conflicts, /*@exposed@*/ /*@out@*/ int * numConflicts); @@ -544,7 +540,13 @@ int rpmdepCheck(rpmTransactionSet rpmdep, /* Orders items, returns error on circle, finals keys[] is NULL. No dependency check is done, use rpmdepCheck() for that. If dependencies are not satisfied a "best-try" ordering is returned. */ + +/** + */ int rpmdepOrder(rpmTransactionSet order); + +/** + */ void rpmdepFreeConflicts( /*@only@*/ struct rpmDependencyConflict * conflicts, int numConflicts); @@ -827,11 +829,8 @@ typedef int (*QVF_t) (QVA_t *qva, rpmdb db, Header h); /** */ -#ifdef DYING -int showMatches(QVA_t *qva, rpmdb db, dbiIndexSet matches, QVF_t showPackage); -#else -int showMatches(QVA_t *qva, /*@only@*/ rpmdbMatchIterator mi, QVF_t showPackage); -#endif +int showMatches(QVA_t *qva, /*@only@*/ /*@null@*/ rpmdbMatchIterator mi, + QVF_t showPackage); #define QUERY_FOR_LIST (1 << 1) #define QUERY_FOR_STATE (1 << 2) @@ -869,6 +868,9 @@ extern struct poptOption rpmVerifyPoptTable[]; * @param db rpm database */ int showVerifyPackage(QVA_t *qva, /*@only@*/ rpmdb db, Header h); + +/** + */ int rpmVerify(QVA_t *qva, enum rpmQVSources source, const char *arg); /* ==================================================================== */ @@ -884,10 +886,19 @@ int rpmVerify(QVA_t *qva, enum rpmQVSources source, const char *arg); #define UNINSTALL_NODEPS (1 << 0) #define UNINSTALL_ALLMATCHES (1 << 1) + +/** + */ int rpmInstall(const char * rootdir, const char ** argv, int installFlags, int interfaceFlags, int probFilter, rpmRelocation * relocations); + +/** + */ int rpmInstallSource(const char * prefix, const char * arg, const char ** specFile, char ** cookie); + +/** + */ int rpmErase(const char * rootdir, const char ** argv, int uninstallFlags, int interfaceFlags); @@ -898,7 +909,13 @@ int rpmErase(const char * rootdir, const char ** argv, int uninstallFlags, #define CHECKSIG_MD5 (1 << 1) #define CHECKSIG_GPG (1 << 2) + +/** + */ int rpmCheckSig(int flags, const char **argv); + +/** + */ int rpmReSign(int add, char *passPhrase, const char **argv); #define ADD_SIGNATURE 1 diff --git a/lib/transaction.c b/lib/transaction.c index e0ae617c7..b266696e6 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -756,11 +756,6 @@ static int handleInstInstalledFiles(TFI_t * fi, rpmdb db, uint_16 * otherModes; int numReplaced = 0; -#ifdef DYING - h = rpmdbGetRecord(db, shared->otherPkg); - if (h == NULL) - return 1; -#else rpmdbMatchIterator mi; mi = rpmdbInitIterator(db, RPMDBI_PACKAGES, &shared->otherPkg, sizeof(shared->otherPkg)); @@ -769,7 +764,6 @@ static int handleInstInstalledFiles(TFI_t * fi, rpmdb db, rpmdbFreeIterator(mi); return 1; } -#endif headerGetEntryMinMemory(h, RPMTAG_FILEMD5S, NULL, (void **) &otherMd5s, NULL); @@ -831,11 +825,7 @@ static int handleInstInstalledFiles(TFI_t * fi, rpmdb db, free(otherMd5s); free(otherLinks); -#ifdef DYING - headerFree(h); -#else rpmdbFreeIterator(mi); -#endif fi->replaced = xrealloc(fi->replaced, /* XXX memory leak */ sizeof(*fi->replaced) * (numReplaced + 1)); @@ -852,11 +842,6 @@ static int handleRmvdInstalledFiles(TFI_t * fi, rpmdb db, const char * otherStates; int i; -#ifdef DYING - h = rpmdbGetRecord(db, shared->otherPkg); - if (h == NULL) - return 1; -#else rpmdbMatchIterator mi; mi = rpmdbInitIterator(db, RPMDBI_PACKAGES, &shared->otherPkg, sizeof(shared->otherPkg)); @@ -865,7 +850,6 @@ static int handleRmvdInstalledFiles(TFI_t * fi, rpmdb db, rpmdbFreeIterator(mi); return 1; } -#endif headerGetEntryMinMemory(h, RPMTAG_FILESTATES, NULL, (void **) &otherStates, NULL); @@ -881,11 +865,7 @@ static int handleRmvdInstalledFiles(TFI_t * fi, rpmdb db, fi->actions[fileNum] = FA_SKIP; } -#ifdef DYING - headerFree(h); -#else rpmdbFreeIterator(mi); -#endif return 0; } @@ -1127,11 +1107,6 @@ static void skipFiles(TFI_t * fi, int noDocs) if (s) { languages = (const char **) splitString(s, strlen(s), ':'); xfree(s); -#ifdef DYING - /* XXX LINGUAS/LANG is used by the installer so leave alone for now */ - } else if ((s = getenv("LINGUAS")) || (s = getenv("LANG")) || (s = "en")) { - languages = (const char **) splitString(s, strlen(s), ':'); -#endif } else languages = NULL; @@ -1213,9 +1188,6 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify, int rc, ourrc = 0; struct availablePackage * alp; rpmProblemSet probs; -#ifdef DYING - dbiIndexSet dbi = NULL; -#endif Header * hdrs; int fileCount; int totalFileCount = 0; @@ -1314,29 +1286,6 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify, rpmdbFreeIterator(mi); } -#ifdef DYING - rc = findMatches(ts->db, alp->name, alp->version, alp->release, &dbi); - switch (rc) { - case 2: - if (dbi) { - dbiFreeIndexSet(dbi); - dbi = NULL; - } - return -1; - /*@notreached@*/ break; - case 0: - if (!(ignoreSet & RPMPROB_FILTER_REPLACEPKG)) - psAppend(probs, RPMPROB_PKG_INSTALLED, alp->key, alp->h, NULL, - NULL, 0); - break; - default: - break; - } - if (dbi) { - dbiFreeIndexSet(dbi); - dbi = NULL; - } -#else if (!(ignoreSet & RPMPROB_FILTER_REPLACEPKG)) { rpmdbMatchIterator mi; mi = rpmdbInitIterator(ts->db, RPMTAG_NAME, alp->name, 0); @@ -1349,7 +1298,6 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify, } rpmdbFreeIterator(mi); } -#endif if (headerGetEntry(alp->h, RPMTAG_BASENAMES, NULL, NULL, &fileCount)) totalFileCount += fileCount; @@ -1357,17 +1305,6 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify, /* FIXME: it seems a bit silly to read in all of these headers twice */ /* The ordering doesn't matter here */ -#ifdef DYING - for (i = 0; i < ts->numRemovedPackages; i++) { - Header h; - - if ((h = rpmdbGetRecord(ts->db, ts->removedPackages[i]))) { - if (headerGetEntry(h, RPMTAG_BASENAMES, NULL, NULL, &fileCount)) - totalFileCount += fileCount; - headerFree(h); - } - } -#else { rpmdbMatchIterator mi; Header h; @@ -1380,7 +1317,6 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify, } rpmdbFreeIterator(mi); } -#endif /* =============================================== * Initialize file list: @@ -1416,9 +1352,6 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify, break; case TR_REMOVED: fi->record = ts->order[oc].u.removed.dboffset; -#ifdef DYING - fi->h = rpmdbGetRecord(ts->db, fi->record); -#else { rpmdbMatchIterator mi; mi = rpmdbInitIterator(ts->db, RPMDBI_PACKAGES, &fi->record, sizeof(fi->record)); @@ -1426,7 +1359,6 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify, fi->h = headerLink(fi->h); rpmdbFreeIterator(mi); } -#endif if (fi->h == NULL) { /* ACK! */ continue; diff --git a/lib/uninstall.c b/lib/uninstall.c index 63d8fd934..9c8d7dccb 100644 --- a/lib/uninstall.c +++ b/lib/uninstall.c @@ -7,7 +7,6 @@ #include "depends.h" /* XXX for headerMatchesDepFlags */ #include "install.h" #include "misc.h" /* XXX for makeTempFile, doputenv */ -#include "rpmdb.h" /* XXX for rpmdbRemove */ static char * SCRIPT_PATH = "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin"; @@ -452,7 +451,6 @@ static int handleOneTrigger(const char * root, rpmdb db, int sense, Header sourc if (!headerGetEntry(triggeredH, RPMTAG_TRIGGERNAME, NULL, (void **) &triggerNames, &numTriggers)) { - headerFree(triggeredH); return 0; } |