Do not export keyring if rpmdb is initialised, but target isn't (bnc#659494)
authorMichael Andres <ma@suse.de>
Thu, 16 Dec 2010 19:00:27 +0000 (20:00 +0100)
committerMichael Andres <ma@suse.de>
Thu, 16 Dec 2010 19:00:27 +0000 (20:00 +0100)
zypp/target/TargetImpl.cc
zypp/target/rpm/RpmDb.cc

index a6c10ea..c05353d 100644 (file)
@@ -1600,7 +1600,7 @@ namespace zypp
           try
           {
               tmprpmdb.reset( new rpm::RpmDb );
-              tmprpmdb->initDatabase( "/", Pathname(), false );
+              tmprpmdb->initDatabase( /*default ctor uses / but no additional keyring exports */ );
           }
           catch( ... )
           {
index 217ed30..a76ddac 100644 (file)
@@ -305,6 +305,8 @@ void RpmDb::initDatabase( Pathname root_r, Pathname dbPath_r, bool doRebuild_r )
   ///////////////////////////////////////////////////////////////////
   // Check arguments
   ///////////////////////////////////////////////////////////////////
+  bool quickinit( root_r.empty() );
+
   if ( root_r.empty() )
     root_r = "/";
 
@@ -318,7 +320,8 @@ void RpmDb::initDatabase( Pathname root_r, Pathname dbPath_r, bool doRebuild_r )
   }
 
   MIL << "Calling initDatabase: " << stringPath( root_r, dbPath_r )
-      << ( doRebuild_r ? " (rebuilddb)" : "" ) << endl;
+      << ( doRebuild_r ? " (rebuilddb)" : "" )
+      << ( quickinit ? " (quickinit)" : "" ) << endl;
 
   ///////////////////////////////////////////////////////////////////
   // Check whether already initialized
@@ -339,6 +342,13 @@ void RpmDb::initDatabase( Pathname root_r, Pathname dbPath_r, bool doRebuild_r )
   // init database
   ///////////////////////////////////////////////////////////////////
   librpmDb::unblockAccess();
+
+  if ( quickinit )
+  {
+    MIL << "QUICK initDatabase (no systemRoot set)" << endl;
+    return;
+  }
+
   DbStateInfoBits info = DbSI_NO_INIT;
   try
   {