[Yum-devel] [PATCH] Use rpmsack returnGPGPubkeyPackages() in YumBase.gpgKeyCheck()

Panu Matilainen pmatilai at laiskiainen.org
Tue Feb 15 09:54:37 UTC 2011


Reduces code duplication and unnecessary rpmdb reopens. The rpmdb
gets opened shortly afterwards anyway and closed before any downloads
so there should be no unwanted side-effects.
---
 yum/__init__.py |    9 +--------
 1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/yum/__init__.py b/yum/__init__.py
index c160201..d764bf4 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -2962,14 +2962,7 @@ class YumBase(depsolve.Depsolve):
         if os.path.exists(gpgkeyschecked):
             return 1
             
-        myts = rpmUtils.transaction.initReadOnlyTransaction(root=self.conf.installroot)
-        myts.pushVSFlags(~(rpm._RPMVSF_NOSIGNATURES|rpm._RPMVSF_NODIGESTS))
-        idx = myts.dbMatch('name', 'gpg-pubkey')
-        keys = idx.count()
-        del idx
-        del myts
-        
-        if keys == 0:
+        if not self.rpmdb.returnGPGPubkeyPackages():
             return 0
         else:
             mydir = os.path.dirname(gpgkeyschecked)
-- 
1.7.4



More information about the Yum-devel mailing list