diff options
-rw-r--r-- | lib/query.c | 83 | ||||
-rw-r--r-- | lib/rebuilddb.c | 29 | ||||
-rw-r--r-- | tools/dumpdb.c | 32 |
3 files changed, 3 insertions, 141 deletions
diff --git a/lib/query.c b/lib/query.c index 920f7de08..542e6fdf9 100644 --- a/lib/query.c +++ b/lib/query.c @@ -576,22 +576,6 @@ int rpmQueryVerify(QVA_t *qva, enum rpmQVSources source, const char * arg, } break; case RPMQV_ALL: -#ifdef DYING - { unsigned int offset; - for (offset = rpmdbFirstRecNum(db); - offset != 0; - offset = rpmdbNextRecNum(db, offset)) { - h = rpmdbGetRecord(db, offset); - if (h == NULL) { - fprintf(stderr, _("could not read database record!\n")); - return 1; - } - if ((rc = showPackage(qva, db, h)) != 0) - retcode = rc; - headerFree(h); - } - } -#else mi = rpmdbInitIterator(db, RPMDBI_PACKAGES, NULL, 0); if (mi == NULL) { fprintf(stderr, _("no packages\n")); @@ -599,18 +583,9 @@ int rpmQueryVerify(QVA_t *qva, enum rpmQVSources source, const char * arg, } else { retcode = XshowMatches(qva, mi, showPackage); } -#endif break; case RPMQV_GROUP: -#ifdef DYING - if (rpmdbFindByGroup(db, arg, &matches)) { - fprintf(stderr, _("group %s does not contain any packages\n"), arg); - retcode = 1; - } else { - retcode = showMatches(qva, db, matches, showPackage); - } -#else mi = rpmdbInitIterator(db, RPMDBI_GROUP, arg, 0); if (mi == NULL) { fprintf(stderr, _("group %s does not contain any packages\n"), arg); @@ -618,18 +593,9 @@ int rpmQueryVerify(QVA_t *qva, enum rpmQVSources source, const char * arg, } else { retcode = XshowMatches(qva, mi, showPackage); } -#endif break; case RPMQV_TRIGGEREDBY: -#ifdef DYING - if (rpmdbFindByTriggeredBy(db, arg, &matches)) { - fprintf(stderr, _("no package triggers %s\n"), arg); - retcode = 1; - } else { - retcode = showMatches(qva, db, matches, showPackage); - } -#else mi = rpmdbInitIterator(db, RPMDBI_TRIGGER, arg, 0); if (mi == NULL) { fprintf(stderr, _("no package triggers %s\n"), arg); @@ -637,18 +603,9 @@ int rpmQueryVerify(QVA_t *qva, enum rpmQVSources source, const char * arg, } else { retcode = XshowMatches(qva, mi, showPackage); } -#endif /* DYING */ break; case RPMQV_WHATREQUIRES: -#ifdef DYING - if (rpmdbFindByRequiredBy(db, arg, &matches)) { - fprintf(stderr, _("no package requires %s\n"), arg); - retcode = 1; - } else { - retcode = showMatches(qva, db, matches, showPackage); - } -#else mi = rpmdbInitIterator(db, RPMDBI_REQUIREDBY, arg, 0); if (mi == NULL) { fprintf(stderr, _("no package requires %s\n"), arg); @@ -656,19 +613,10 @@ int rpmQueryVerify(QVA_t *qva, enum rpmQVSources source, const char * arg, } else { retcode = XshowMatches(qva, mi, showPackage); } -#endif /* DYING */ break; case RPMQV_WHATPROVIDES: if (arg[0] != '/') { -#ifdef DYING - if (rpmdbFindByProvides(db, arg, &matches)) { - fprintf(stderr, _("no package provides %s\n"), arg); - retcode = 1; - } else { - retcode = showMatches(qva, db, matches, showPackage); - } -#else mi = rpmdbInitIterator(db, RPMDBI_PROVIDES, arg, 0); if (mi == NULL) { fprintf(stderr, _("no package provides %s\n"), arg); @@ -676,29 +624,10 @@ int rpmQueryVerify(QVA_t *qva, enum rpmQVSources source, const char * arg, } else { retcode = XshowMatches(qva, mi, showPackage); } -#endif /* DYING */ break; } /*@fallthrough@*/ case RPMQV_PATH: -#ifdef DYING - if (rpmdbFindByFile(db, arg, &matches)) { - int myerrno = 0; - if (access(arg, F_OK) != 0) - myerrno = errno; - switch (myerrno) { - default: - fprintf(stderr, _("file %s: %s\n"), arg, strerror(myerrno)); - break; - case 0: - fprintf(stderr, _("file %s is not owned by any package\n"), arg); - break; - } - retcode = 1; - } else { - retcode = showMatches(qva, db, matches, showPackage); - } -#else mi = rpmdbInitIterator(db, RPMDBI_FILE, arg, 0); if (mi == NULL) { int myerrno = 0; @@ -716,7 +645,6 @@ int rpmQueryVerify(QVA_t *qva, enum rpmQVSources source, const char * arg, } else { retcode = XshowMatches(qva, mi, showPackage); } -#endif /* DYING */ break; case RPMQV_DBOFFSET: @@ -736,16 +664,6 @@ int rpmQueryVerify(QVA_t *qva, enum rpmQVSources source, const char * arg, return 1; } rpmMessage(RPMMESS_DEBUG, _("package record number: %d\n"), recNumber); -#ifdef DYING - h = rpmdbGetRecord(db, recNumber); - if (h == NULL) { - fprintf(stderr, _("record %d could not be read\n"), recNumber); - retcode = 1; - } else { - retcode = showPackage(qva, db, h); - headerFree(h); - } -#else mi = rpmdbInitIterator(db, RPMDBI_PACKAGES, &recNumber, sizeof(recNumber)); if (mi == NULL) { fprintf(stderr, _("record %d could not be read\n"), recNumber); @@ -753,7 +671,6 @@ int rpmQueryVerify(QVA_t *qva, enum rpmQVSources source, const char * arg, } else { retcode = XshowMatches(qva, mi, showPackage); } -#endif } break; case RPMQV_PACKAGE: diff --git a/lib/rebuilddb.c b/lib/rebuilddb.c index 610d721bb..0f0d3fac3 100644 --- a/lib/rebuilddb.c +++ b/lib/rebuilddb.c @@ -96,30 +96,11 @@ fprintf(stderr, "*** rpmdbRebuild: filterdbdups %d preferdb %d\n", _filterDbDups { Header h = NULL; -#ifdef DYING - int recnum; -#define _RECNUM recnum - for (recnum = rpmdbFirstRecNum(olddb); - recnum > 0; - recnum = rpmdbNextRecNum(olddb, recnum)) - { - if (h) { - headerFree(h); - h = NULL; - } - if ((h = rpmdbGetRecord(olddb, recnum)) == NULL) { - rpmError(RPMERR_INTERNAL, - _("record number %d in database is bad -- skipping it"), - recnum); - continue; - } -#else rpmdbMatchIterator mi; #define _RECNUM rpmdbGetIteratorOffset(mi) mi = rpmdbInitIterator(olddb, RPMDBI_PACKAGES, NULL, 0); while ((h = rpmdbNextIterator(mi)) != NULL) { -#endif /* let's sanity check this record a bit, otherwise just skip it */ if (!(headerIsEntry(h, RPMTAG_NAME) && @@ -163,17 +144,9 @@ fprintf(stderr, "*** rpmdbRebuild: filterdbdups %d preferdb %d\n", _filterDbDups failed = 1; break; } -#ifndef DYING - } - rpmdbFreeIterator(mi); -#else } - if (h) { - headerFree(h); - h = NULL; - } -#endif + rpmdbFreeIterator(mi); } diff --git a/tools/dumpdb.c b/tools/dumpdb.c index 62a6c45a2..55c843eda 100644 --- a/tools/dumpdb.c +++ b/tools/dumpdb.c @@ -24,31 +24,12 @@ int main(int argc, char ** argv) { Header h = NULL; unsigned int blockNum = 0; -#ifdef DYING - unsigned int offset; -#define _RECNUM offset - - for (offset = rpmdbFirstRecNum(db); - offset > 0; - offset = rpmdbNextRecNum(db, offset)) - { - if (h) { - headerFree(h); - h = NULL; - } - h = rpmdbGetRecord(db, offset); - if (!h) { - fprintf(stderr, _("rpmdbGetRecord() failed at offset %d\n"), - offset); - exit(1); - } -#else rpmdbMatchIterator mi; #define _RECNUM rpmdbGetIteratorOffset(mi) mi = rpmdbInitIterator(db, RPMDBI_PACKAGES, NULL, 0); + while ((h = rpmdbNextIterator(mi)) != NULL) { -#endif blockNum++; if (!(dspBlockNum != 0 && dspBlockNum != blockNum)) @@ -59,18 +40,9 @@ int main(int argc, char ** argv) if (dspBlockNum && blockNum > dspBlockNum) exit(0); - -#ifndef DYING - } - rpmdbFreeIterator(mi); -#else } - if (h) { - headerFree(h); - h = NULL; - } -#endif + rpmdbFreeIterator(mi); } |