From 89b3b386123ae81b31a07400b02eae2e779985cf Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Fri, 19 Mar 2010 16:55:27 +0200 Subject: [PATCH] Lose unused temporary/pseudo rpmdbi tags - we haven't had any temporary dbis since rpm 4.8.0 where Depends got axed, the rest were just nonexistent fluff anyway --- lib/backend/dbconfig.c | 1 - lib/rpmdb.c | 53 ++++++------------------------------------ lib/rpmtag.h | 4 ---- lib/tagname.c | 24 ------------------- macros.in | 5 +--- 5 files changed, 8 insertions(+), 79 deletions(-) diff --git a/lib/backend/dbconfig.c b/lib/backend/dbconfig.c index 989e6b541..749605ca7 100644 --- a/lib/backend/dbconfig.c +++ b/lib/backend/dbconfig.c @@ -371,7 +371,6 @@ dbiIndex dbiNew(rpmdb rpmdb, rpmTag rpmtag) */ switch (rpmtag) { case RPMDBI_PACKAGES: - case RPMDBI_DEPENDS: dbi->dbi_jlen = 1 * sizeof(int32_t); break; default: diff --git a/lib/rpmdb.c b/lib/rpmdb.c index ba36eb0bf..ae5a011f5 100644 --- a/lib/rpmdb.c +++ b/lib/rpmdb.c @@ -112,7 +112,7 @@ static int dbiTagToDbix(rpmTag rpmtag) static void dbiTagsInit(void) { static const char * const _dbiTagStr_default = - "Packages:Name:Basenames:Group:Requirename:Providename:Conflictname:ObsoleteName:Triggername:Dirnames:Requireversion:Provideversion:Installtid:Sigmd5:Sha1header:Filedigests:Depends:Pubkeys"; + "Packages:Name:Basenames:Group:Requirename:Providename:Conflictname:ObsoleteName:Triggername:Dirnames:Requireversion:Provideversion:Installtid:Sigmd5:Sha1header:Filedigests:Pubkeys"; char * dbiTagStr = NULL; char * o, * oe; rpmTag rpmtag; @@ -643,22 +643,6 @@ static struct rpmdb_s const dbTemplate = { _DB_MAJOR, _DB_ERRPFX }; -static int isTemporaryDB(rpmTag rpmtag) -{ - int rc = 0; - switch (rpmtag) { - case RPMDBI_AVAILABLE: - case RPMDBI_ADDED: - case RPMDBI_REMOVED: - case RPMDBI_DEPENDS: - rc = 1; - break; - default: - break; - } - return rc; -} - rpmop rpmdbOp(rpmdb rpmdb, rpmdbOpX opx) { rpmop op = NULL; @@ -708,9 +692,6 @@ int rpmdbOpenAll(rpmdb db) for (dbix = 0; dbix < dbiTags.max; dbix++) { if (db->_dbi[dbix] != NULL) continue; - /* Filter out temporary databases */ - if (isTemporaryDB(dbiTags.tags[dbix])) - continue; (void) dbiOpen(db, dbiTags.tags[dbix], db->db_flags); } return rc; @@ -894,14 +875,9 @@ static int openDatabase(const char * prefix, rc = 0; if (dbiTags.tags != NULL) for (dbix = 0; rc == 0 && dbix < dbiTags.max; dbix++) { - dbiIndex dbi; - rpmTag rpmtag; + rpmTag rpmtag = dbiTags.tags[dbix]; + dbiIndex dbi = dbiOpen(db, rpmtag, 0); - /* Filter out temporary databases */ - if (isTemporaryDB((rpmtag = dbiTags.tags[dbix]))) - continue; - - dbi = dbiOpen(db, rpmtag, 0); if (dbi == NULL) { rc = -2; break; @@ -2446,10 +2422,6 @@ int rpmdbRemove(rpmdb db, int rid, unsigned int hdrNum, dbi = NULL; rpmtag = dbiTags.tags[dbix]; - /* Filter out temporary databases */ - if (isTemporaryDB(rpmtag)) - continue; - if (rpmtag == RPMDBI_PACKAGES) { dbi = dbiOpen(db, rpmtag, 0); if (dbi == NULL) /* XXX shouldn't happen */ @@ -2692,10 +2664,6 @@ int rpmdbAdd(rpmdb db, int iid, Header h, dbi = NULL; rpmtag = dbiTags.tags[dbix]; - /* Filter out temporary databases */ - if (isTemporaryDB(rpmtag)) - continue; - switch (rpmtag) { case RPMDBI_PACKAGES: dbi = dbiOpen(db, rpmtag, 0); @@ -2943,17 +2911,10 @@ static int rpmdbMoveDatabase(const char * prefix, case 3: if (dbiTags.tags != NULL) for (i = 0; i < dbiTags.max; i++) { - const char * base; - char *src, *dest; - rpmTag rpmtag; - - /* Filter out temporary databases */ - if (isTemporaryDB((rpmtag = dbiTags.tags[i]))) - continue; - - base = rpmTagGetName(rpmtag); - src = rpmGetPath(prefix, "/", olddbpath, "/", base, NULL); - dest = rpmGetPath(prefix, "/", newdbpath, "/", base, NULL); + rpmTag rpmtag = dbiTags.tags[i]; + const char *base = rpmTagGetName(rpmtag); + char *src = rpmGetPath(prefix, "/", olddbpath, "/", base, NULL); + char *dest = rpmGetPath(prefix, "/", newdbpath, "/", base, NULL); if (access(src, F_OK) != 0) goto cont; diff --git a/lib/rpmtag.h b/lib/rpmtag.h index 32b249599..204ee5f20 100644 --- a/lib/rpmtag.h +++ b/lib/rpmtag.h @@ -11,11 +11,7 @@ extern "C" { * Pseudo-tags used by the rpmdb and rpmgi iterator API's. */ #define RPMDBI_PACKAGES 0 /* Installed package headers. */ -#define RPMDBI_DEPENDS 1 /* Dependency resolution cache. */ #define RPMDBI_LABEL 2 /* Fingerprint search marker. */ -#define RPMDBI_ADDED 3 /* Added package headers. */ -#define RPMDBI_REMOVED 4 /* Removed package headers. */ -#define RPMDBI_AVAILABLE 5 /* Available package headers. */ #define RPMDBI_ARGLIST 6 /* (rpmgi) Argument list. */ /** diff --git a/lib/tagname.c b/lib/tagname.c index 593098938..c578b323a 100644 --- a/lib/tagname.c +++ b/lib/tagname.c @@ -129,18 +129,6 @@ static const char * _tagName(rpmTag tag) case RPMDBI_PACKAGES: name = "Packages"; break; - case RPMDBI_DEPENDS: - name = "Depends"; - break; - case RPMDBI_ADDED: - name = "Added"; - break; - case RPMDBI_REMOVED: - name = "Removed"; - break; - case RPMDBI_AVAILABLE: - name = "Available"; - break; case RPMDBI_ARGLIST: name = "Arglist"; break; @@ -195,10 +183,6 @@ static rpmTagType _tagType(rpmTag tag) switch (tag) { case RPMDBI_PACKAGES: - case RPMDBI_DEPENDS: - case RPMDBI_ADDED: - case RPMDBI_REMOVED: - case RPMDBI_AVAILABLE: case RPMDBI_ARGLIST: break; default: @@ -238,14 +222,6 @@ static rpmTag _tagValue(const char * tagstr) if (!rstrcasecmp(tagstr, "Packages")) return RPMDBI_PACKAGES; - if (!rstrcasecmp(tagstr, "Depends")) - return RPMDBI_DEPENDS; - if (!rstrcasecmp(tagstr, "Added")) - return RPMDBI_ADDED; - if (!rstrcasecmp(tagstr, "Removed")) - return RPMDBI_REMOVED; - if (!rstrcasecmp(tagstr, "Available")) - return RPMDBI_AVAILABLE; if (!rstrcasecmp(tagstr, "Arglist")) return RPMDBI_ARGLIST; diff --git a/macros.in b/macros.in index 43b059eec..93cd06346 100644 --- a/macros.in +++ b/macros.in @@ -647,14 +647,11 @@ print (t)\ %{nil} # The list of tags for which indices will be built. -%_dbi_tags Packages:Name:Basenames:Group:Requirename:Providename:Conflictname:Obsoletename:Triggername:Dirnames:Requireversion:Provideversion:Installtid:Sigmd5:Sha1header:Filedigests:Depends:Pubkeys +%_dbi_tags Packages:Name:Basenames:Group:Requirename:Providename:Conflictname:Obsoletename:Triggername:Dirnames:Requireversion:Provideversion:Installtid:Sigmd5:Sha1header:Filedigests:Pubkeys # "Packages" should have shared/exclusive fcntl(2) lock using "lockdbfd". %_dbi_config_Packages %{_dbi_htconfig} lockdbfd -# "Depends" is a per-transaction cache of known dependency resolutions. -%_dbi_config_Depends %{_dbi_htconfig} temporary private - %_dbi_config_Dirnames %{_dbi_btconfig} %_dbi_config_Requireversion %{_dbi_btconfig} %_dbi_config_Provideversion %{_dbi_btconfig}