From: Michael Schroeder Date: Thu, 19 Jul 2018 13:31:00 +0000 (+0200) Subject: Fix RPMDB_KEEP_GPG_PUBKEY handling X-Git-Tag: 0.6.35~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0d887d1640c1d8829756755450d8c00311313019;p=thirdparty%2Flibsolv.git Fix RPMDB_KEEP_GPG_PUBKEY handling --- diff --git a/ext/repo_rpmdb.c b/ext/repo_rpmdb.c index f7e334f5..75bb6780 100644 --- a/ext/repo_rpmdb.c +++ b/ext/repo_rpmdb.c @@ -1742,7 +1742,7 @@ repo_add_rpmdb(Repo *repo, Repo *ref, int flags) memset(dircache, 0, sizeof(dircache)); /* get ids of installed rpms */ - entries = getinstalledrpmdbids(&state, "Name", 0, &nentries, &namedata); + entries = getinstalledrpmdbids(&state, "Name", 0, &nentries, &namedata, flags & RPMDB_KEEP_GPG_PUBKEY); if (!entries) { freestate(&state); @@ -2396,7 +2396,7 @@ rpm_installedrpmdbids(void *rpmstate, const char *index, const char *match, Queu struct rpmdbentry *entries; int nentries, i; - entries = getinstalledrpmdbids(rpmstate, index ? index : "Name", match, &nentries, 0); + entries = getinstalledrpmdbids(rpmstate, index ? index : "Name", match, &nentries, 0, 0); if (rpmdbidq) { queue_empty(rpmdbidq); diff --git a/ext/repo_rpmdb_bdb.h b/ext/repo_rpmdb_bdb.h index c34ff706..ed82a69c 100644 --- a/ext/repo_rpmdb_bdb.h +++ b/ext/repo_rpmdb_bdb.h @@ -265,7 +265,7 @@ closepkgdb(struct rpmdbstate *state) /* get the rpmdbids of all installed packages from the Name index database. * This is much faster then querying the big Packages database */ static struct rpmdbentry * -getinstalledrpmdbids(struct rpmdbstate *state, const char *index, const char *match, int *nentriesp, char **namedatap) +getinstalledrpmdbids(struct rpmdbstate *state, const char *index, const char *match, int *nentriesp, char **namedatap, int keep_gpg_pubkey) { DB_ENV *dbenv = 0; DB *db = 0; @@ -321,7 +321,7 @@ getinstalledrpmdbids(struct rpmdbstate *state, const char *index, const char *ma } while (dbc->c_get(dbc, &dbkey, &dbdata, match ? DB_SET : DB_NEXT) == 0) { - if (!match && dbkey.size == 10 && !memcmp(dbkey.data, "gpg-pubkey", 10)) + if (!match && !keep_gpg_pubkey && dbkey.size == 10 && !memcmp(dbkey.data, "gpg-pubkey", 10)) continue; dl = dbdata.size; dp = dbdata.data; diff --git a/ext/repo_rpmdb_librpm.h b/ext/repo_rpmdb_librpm.h index aa901ca1..79983d3a 100644 --- a/ext/repo_rpmdb_librpm.h +++ b/ext/repo_rpmdb_librpm.h @@ -111,7 +111,7 @@ closepkgdb(struct rpmdbstate *state) /* get the rpmdbids of all installed packages from the Name index database. * This is much faster then querying the big Packages database */ static struct rpmdbentry * -getinstalledrpmdbids(struct rpmdbstate *state, const char *index, const char *match, int *nentriesp, char **namedatap) +getinstalledrpmdbids(struct rpmdbstate *state, const char *index, const char *match, int *nentriesp, char **namedatap, int keep_gpg_pubkey) { const void * key; size_t keylen, matchl = 0; @@ -143,7 +143,7 @@ getinstalledrpmdbids(struct rpmdbstate *state, const char *index, const char *ma if (keylen != matchl || memcmp(key, match, keylen) != 0) continue; } - else if (keylen == 10 && !memcmp(key, "gpg-pubkey", 10)) + else if (!keep_gpg_pubkey && keylen == 10 && !memcmp(key, "gpg-pubkey", 10)) continue; nameoff = namedatal; if (namedatap)