Author: dmacvicar
Date: Tue Aug 28 18:51:34 2007
New Revision: 6942
URL: http://svn.opensuse.org/viewcvs/zypp?rev=6942&view=rev
Log:
reenable importing of keys in rpm from private keyring
Modified:
trunk/libzypp/zypp/target/rpm/RpmDb.cc
Modified: trunk/libzypp/zypp/target/rpm/RpmDb.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/rpm/RpmDb.cc?rev=6942&r1=6941&r2=6942&view=diff
==============================================================================
--- trunk/libzypp/zypp/target/rpm/RpmDb.cc (original)
+++ trunk/libzypp/zypp/target/rpm/RpmDb.cc Tue Aug 28 18:51:34 2007
@@ -456,7 +456,7 @@
MIL << "Syncronizing keys with zypp keyring" << endl;
// we do this one by one now.
- //importZyppKeyRingTrustedKeys();
+ importZyppKeyRingTrustedKeys();
exportTrustedKeysInZyppKeyRing();
// Close the database in case any write acces (create/convert)
@@ -886,6 +886,40 @@
}
}
+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();
+
+ for ( std::list<PublicKey>::const_iterator it = zypp_keys.begin(); it != zypp_keys.end(); ++it)
+ {
+ // we find only the left part of the long gpg key, as rpm does not support long ids
+ std::list<PublicKey>::iterator ik = find( rpm_keys.begin(), rpm_keys.end(), (*it));
+ if ( ik != rpm_keys.end() )
+ {
+ MIL << "Key " << (*it).id() << " (" << (*it).name() << ") is already in rpm database." << std::endl;
+ }
+ else
+ {
+ // now import the key in rpm
+ try
+ {
+ importPubkey((*it).path());
+ MIL << "Trusted key " << (*it).id() << " (" << (*it).name() << ") imported in rpm database." << std::endl;
+ }
+ catch (RpmException &e)
+ {
+ ERR << "Could not import key " << (*it).id() << " (" << (*it).name() << " from " << (*it).path() << " in rpm database" << std::endl;
+ }
+ }
+ }
+}
+
void RpmDb::exportTrustedKeysInZyppKeyRing()
{
MIL << "Exporting rpm keyring into zypp trusted keyring" <