fix retrieval of distributionVersion if target is not initialized
authorDominik Heidler <dheidler@suse.de>
Wed, 8 Dec 2010 12:53:29 +0000 (13:53 +0100)
committerDominik Heidler <dheidler@suse.de>
Wed, 8 Dec 2010 12:54:32 +0000 (13:54 +0100)
zypp/target/TargetImpl.cc

index 98f7bc8..aa1998d 100644 (file)
@@ -1594,6 +1594,12 @@ namespace zypp
         // On RHEL, Fedora and others the "product version" is determined by the first package
         // providing 'redhat-release'. This value is not hardcoded in YUM and can be configured
         // with the $distroverpkg variable.
+        scoped_ptr<rpm::RpmDb> tmprpmdb;
+        if ( ZConfig::instance().systemRoot() == Pathname() )
+        {
+          tmprpmdb.reset( new rpm::RpmDb );
+          tmprpmdb->initDatabase( "/", Pathname(), false );
+        }
         rpm::librpmDb::db_const_iterator it;
         if ( it.findByProvides( ZConfig::instance().distroverpkg() ) )
           distributionVersion = it->tag_version();