Blob Blame History Raw
commit 3e05536ef876fc761553b632495449fd96bb4b9e
Author: James Antill <james@and.org>
Date:   Tue Sep 14 09:48:23 2010 -0400

     Can't keep ts around, due to rpmdb.auto_close. BZ 622179.
     This kind of sucks as we have to remember in all future code not to
    keep a ts over any .rpmdb call, it's even better because almost nobody
    will hit it. It works though, and is simple.
    
     We could maybe fix this "better" by using a weakref in rpmdb, and doing
    it that way. Or having some manual way to mark auto_close as off. Or
    just rm'ing auto_close as a bad idea.

diff --git a/yum/__init__.py b/yum/__init__.py
index b5e9213..5c689e5 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -4301,12 +4301,11 @@ class YumBase(depsolve.Depsolve):
         keyurls = repo.gpgkey
         key_installed = False
 
-        ts = self.rpmdb.readOnlyTS()
-
         for keyurl in keyurls:
             keys = self._retrievePublicKey(keyurl, repo)
 
             for info in keys:
+                ts = self.rpmdb.readOnlyTS()
                 # Check if key is already installed
                 if misc.keyInstalled(ts, info['keyid'], info['timestamp']) >= 0:
                     self.logger.info(_('GPG key at %s (0x%s) is already installed') % (
@@ -4331,6 +4330,7 @@ class YumBase(depsolve.Depsolve):
                     raise Errors.YumBaseError, _("Not installing key")
                 
                 # Import the key
+                ts = self.rpmdb.readOnlyTS()
                 result = ts.pgpImportPubkey(misc.procgpgkey(info['raw_key']))
                 if result != 0:
                     raise Errors.YumBaseError, \