Shovel off a number of useless calls to external programs.
authorMichael Matz <matz@suse.de>
Wed, 14 May 2008 23:30:04 +0000 (23:30 +0000)
committerMichael Matz <matz@suse.de>
Wed, 14 May 2008 23:30:04 +0000 (23:30 +0000)
zypp/target/rpm/RpmDb.cc

index e5ac884..22cbb8d 100644 (file)
@@ -898,11 +898,15 @@ void RpmDb::importZyppKeyRingTrustedKeys()
 {
   MIL << "Importing zypp trusted keyring" << std::endl;
 
-  std::list<PublicKey> rpm_keys = pubkeys();
-
   std::list<PublicKey> zypp_keys;
-
   zypp_keys = getZYpp()->keyRing()->trustedPublicKeys();
+  /* The pubkeys() call below is expensive.  It calls gpg2 for each
+     gpg-pubkey in the rpm db.  Useless if we don't have any keys in
+     zypp yet.  */
+  if (zypp_keys.empty())
+    return;
+
+  std::list<PublicKey> rpm_keys = pubkeys();
 
   for ( std::list<PublicKey>::const_iterator it = zypp_keys.begin(); it != zypp_keys.end(); ++it)
     {