From 6bc5d87007bfe2ecfe6738f0575b3646a71361fd Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Mon, 21 Sep 2009 14:36:59 +0300 Subject: [PATCH] Rip out dependency caching - it doesn't speed up things that much, is broken in some chroot scenarios and is ugly ugly hardwired BDB hackery where it doesn't belong --- lib/depends.c | 91 ----------------------------------------------------------- lib/verify.c | 4 --- 2 files changed, 95 deletions(-) diff --git a/lib/depends.c b/lib/depends.c index f7af247..2cb8fd7 100644 --- a/lib/depends.c +++ b/lib/depends.c @@ -13,14 +13,10 @@ #include #include -#include "lib/rpmdb_internal.h" /* XXX response cache needs dbiOpen et al. */ #include "lib/rpmts_internal.h" #include "debug.h" - -RPM_GNUC_INTERNAL int _cacheDependsRC = 1; - const char * const rpmNAME = PACKAGE; const char * const rpmEVR = VERSION; @@ -346,12 +342,9 @@ int rpmtsAddEraseElement(rpmts ts, Header h, int dboffset) */ static int unsatisfiedDepend(rpmts ts, rpmds dep, int adding) { - DBT key; - DBT data; rpmdbMatchIterator mi; const char * Name; Header h; - int _cacheThisRC = 1; int rc; int xx; int retrying = 0; @@ -359,51 +352,6 @@ static int unsatisfiedDepend(rpmts ts, rpmds dep, int adding) if ((Name = rpmdsN(dep)) == NULL) return 0; /* XXX can't happen */ - /* - * Check if dbiOpen/dbiPut failed (e.g. permissions), we can't cache. - */ - if (_cacheDependsRC) { - dbiIndex dbi; - dbi = dbiOpen(rpmtsGetRdb(ts), RPMDBI_DEPENDS, 0); - if (dbi == NULL) - _cacheDependsRC = 0; - else { - const char * DNEVR; - - rc = -1; - if ((DNEVR = rpmdsDNEVR(dep)) != NULL) { - DBC * dbcursor = NULL; - void * datap = NULL; - size_t datalen = 0; - size_t DNEVRlen = strlen(DNEVR); - - xx = dbiCopen(dbi, dbi->dbi_txnid, &dbcursor, 0); - - memset(&key, 0, sizeof(key)); - key.data = (void *) DNEVR; - key.size = DNEVRlen; - memset(&data, 0, sizeof(data)); - data.data = datap; - data.size = datalen; -/* FIX: data->data may be NULL */ - xx = dbiGet(dbi, dbcursor, &key, &data, DB_SET); - DNEVR = key.data; - DNEVRlen = key.size; - datap = data.data; - datalen = data.size; - - if (xx == 0 && datap && datalen == 4) - memcpy(&rc, datap, datalen); - xx = dbiCclose(dbi, dbcursor, 0); - } - - if (rc >= 0) { - rpmdsNotify(dep, _("(cached)"), rc); - return rc; - } - } - } - retry: rc = 0; /* assume dependency is satisfied */ @@ -426,12 +374,6 @@ retry: /* Search added packages for the dependency. */ if (rpmalSatisfiesDepend(ts->addedPackages, dep) != NULL) { - /* - * XXX Ick, context sensitive answers from dependency cache. - * XXX Always resolve added dependencies within context to disambiguate. - */ - if (_rpmds_nopromote) - _cacheThisRC = 0; goto exit; } @@ -487,37 +429,6 @@ unsatisfied: rpmdsNotify(dep, NULL, rc); exit: - /* - * If dbiOpen/dbiPut fails (e.g. permissions), we can't cache. - */ - if (_cacheDependsRC && _cacheThisRC) { - dbiIndex dbi; - dbi = dbiOpen(rpmtsGetRdb(ts), RPMDBI_DEPENDS, 0); - if (dbi == NULL) { - _cacheDependsRC = 0; - } else { - const char * DNEVR; - xx = 0; - if ((DNEVR = rpmdsDNEVR(dep)) != NULL) { - DBC * dbcursor = NULL; - size_t DNEVRlen = strlen(DNEVR); - - xx = dbiCopen(dbi, dbi->dbi_txnid, &dbcursor, DB_WRITECURSOR); - - memset(&key, 0, sizeof(key)); - key.data = (void *) DNEVR; - key.size = DNEVRlen; - memset(&data, 0, sizeof(data)); - data.data = &rc; - data.size = sizeof(rc); - - xx = dbiPut(dbi, dbcursor, &key, &data, 0); - xx = dbiCclose(dbi, dbcursor, DB_WRITECURSOR); - } - if (xx) - _cacheDependsRC = 0; - } - } return rc; } @@ -798,7 +709,5 @@ exit: if (closeatexit) xx = rpmtsCloseDB(ts); - else if (_cacheDependsRC) - xx = rpmdbCloseDBI(rpmtsGetRdb(ts), RPMDBI_DEPENDS); return rc; } diff --git a/lib/verify.c b/lib/verify.c index 256b006..7383e14 100644 --- a/lib/verify.c +++ b/lib/verify.c @@ -467,7 +467,6 @@ int rpmcliVerify(rpmts ts, QVA_t qva, char * const * argv) rpmVSFlags vsflags, ovsflags; int ec = 0, xx; const char * rootDir = rpmtsRootDir(ts); - int cachingDeps = _cacheDependsRC; /* * Open the DB + indices explicitly before possible chroot, @@ -482,8 +481,6 @@ int rpmcliVerify(rpmts ts, QVA_t qva, char * const * argv) goto exit; } else { rpmtsSetChrootDone(ts, 1); - /* XXX temporary db path is wrong when chrooted, disable caching */ - _cacheDependsRC = 0; } } @@ -516,7 +513,6 @@ int rpmcliVerify(rpmts ts, QVA_t qva, char * const * argv) } exit: - _cacheDependsRC = cachingDeps; return ec; } -- 2.7.4