]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Fix RPMDB_KEEP_GPG_PUBKEY handling
authorMichael Schroeder <mls@suse.de>
Thu, 19 Jul 2018 13:31:00 +0000 (15:31 +0200)
committerMichael Schroeder <mls@suse.de>
Thu, 19 Jul 2018 13:31:00 +0000 (15:31 +0200)
ext/repo_rpmdb.c
ext/repo_rpmdb_bdb.h
ext/repo_rpmdb_librpm.h

index f7e334f569e4c3fd06d4a924e3f11f7153ad9f4b..75bb6780c38910c6df603cd3fceed8916ae9a294 100644 (file)
@@ -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);
index c34ff706db96e9841aca554e2d2dec507cf2c8d6..ed82a69cbd3e5e829a176921eb73d391a7ce8d45 100644 (file)
@@ -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;
index aa901ca1acef78a6477b2b06386cf0f7cbe71be0..79983d3a640d63b2dbe826c70799093c130891ad 100644 (file)
@@ -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)