Skip to content

Commit 0d887d1

Browse files
committed
Fix RPMDB_KEEP_GPG_PUBKEY handling
1 parent b523d7f commit 0d887d1

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

ext/repo_rpmdb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,7 +1742,7 @@ repo_add_rpmdb(Repo *repo, Repo *ref, int flags)
17421742
memset(dircache, 0, sizeof(dircache));
17431743

17441744
/* get ids of installed rpms */
1745-
entries = getinstalledrpmdbids(&state, "Name", 0, &nentries, &namedata);
1745+
entries = getinstalledrpmdbids(&state, "Name", 0, &nentries, &namedata, flags & RPMDB_KEEP_GPG_PUBKEY);
17461746
if (!entries)
17471747
{
17481748
freestate(&state);
@@ -2396,7 +2396,7 @@ rpm_installedrpmdbids(void *rpmstate, const char *index, const char *match, Queu
23962396
struct rpmdbentry *entries;
23972397
int nentries, i;
23982398

2399-
entries = getinstalledrpmdbids(rpmstate, index ? index : "Name", match, &nentries, 0);
2399+
entries = getinstalledrpmdbids(rpmstate, index ? index : "Name", match, &nentries, 0, 0);
24002400
if (rpmdbidq)
24012401
{
24022402
queue_empty(rpmdbidq);

ext/repo_rpmdb_bdb.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ closepkgdb(struct rpmdbstate *state)
265265
/* get the rpmdbids of all installed packages from the Name index database.
266266
* This is much faster then querying the big Packages database */
267267
static struct rpmdbentry *
268-
getinstalledrpmdbids(struct rpmdbstate *state, const char *index, const char *match, int *nentriesp, char **namedatap)
268+
getinstalledrpmdbids(struct rpmdbstate *state, const char *index, const char *match, int *nentriesp, char **namedatap, int keep_gpg_pubkey)
269269
{
270270
DB_ENV *dbenv = 0;
271271
DB *db = 0;
@@ -321,7 +321,7 @@ getinstalledrpmdbids(struct rpmdbstate *state, const char *index, const char *ma
321321
}
322322
while (dbc->c_get(dbc, &dbkey, &dbdata, match ? DB_SET : DB_NEXT) == 0)
323323
{
324-
if (!match && dbkey.size == 10 && !memcmp(dbkey.data, "gpg-pubkey", 10))
324+
if (!match && !keep_gpg_pubkey && dbkey.size == 10 && !memcmp(dbkey.data, "gpg-pubkey", 10))
325325
continue;
326326
dl = dbdata.size;
327327
dp = dbdata.data;

ext/repo_rpmdb_librpm.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ closepkgdb(struct rpmdbstate *state)
111111
/* get the rpmdbids of all installed packages from the Name index database.
112112
* This is much faster then querying the big Packages database */
113113
static struct rpmdbentry *
114-
getinstalledrpmdbids(struct rpmdbstate *state, const char *index, const char *match, int *nentriesp, char **namedatap)
114+
getinstalledrpmdbids(struct rpmdbstate *state, const char *index, const char *match, int *nentriesp, char **namedatap, int keep_gpg_pubkey)
115115
{
116116
const void * key;
117117
size_t keylen, matchl = 0;
@@ -143,7 +143,7 @@ getinstalledrpmdbids(struct rpmdbstate *state, const char *index, const char *ma
143143
if (keylen != matchl || memcmp(key, match, keylen) != 0)
144144
continue;
145145
}
146-
else if (keylen == 10 && !memcmp(key, "gpg-pubkey", 10))
146+
else if (!keep_gpg_pubkey && keylen == 10 && !memcmp(key, "gpg-pubkey", 10))
147147
continue;
148148
nameoff = namedatal;
149149
if (namedatap)

0 commit comments

Comments
 (0)