Never refresh repositories from CD/DVD, once they are created. (bnc #476429)
authorMichael Andres <ma@suse.de>
Sun, 22 Feb 2009 14:17:42 +0000 (15:17 +0100)
committerMichael Andres <ma@suse.de>
Sun, 22 Feb 2009 14:25:57 +0000 (15:25 +0100)
zypp/RepoManager.cc

index 96657e4..f14291d 100644 (file)
@@ -713,22 +713,25 @@ namespace zypp
     {
       MIL << "Going to try to check whether refresh is needed for " << url << endl;
 
-      repo::RepoType repokind = info.type();
+      // first check old (cached) metadata
+      Pathname rawpath = rawmetadata_path_for_repoinfo( _pimpl->options, info );
+      filesystem::assert_dir(rawpath);
+      oldstatus = metadataStatus(info);
 
-      // if the type is unknown, try probing.
-      switch ( repokind.toEnum() )
+      if ( oldstatus.empty() )
       {
-        case RepoType::NONE_e:
-          // unknown, probe it
-          repokind = probe(url);
-        break;
-        default:
-        break;
+        MIL << "No cached metadata, going to refresh" << endl;
+        return REFRESH_NEEDED;
       }
 
-      Pathname rawpath = rawmetadata_path_for_repoinfo( _pimpl->options, info );
-      filesystem::assert_dir(rawpath);
-      oldstatus = metadataStatus(info);
+      {
+        std::string scheme( url.getScheme() );
+        if ( scheme == "cd" || scheme == "dvd" )
+        {
+          MIL << "never refresh CD/DVD" << endl;
+          return REPO_UP_TO_DATE;
+        }
+      }
 
       // now we've got the old (cached) status, we can decide repo.refresh.delay
       if (policy != RefreshForced && policy != RefreshIfNeededIgnoreDelay)
@@ -752,9 +755,21 @@ namespace zypp
         }
       }
 
-      // create temp dir as sibling of rawpath
+      // To test the new matadta create temp dir as sibling of rawpath
       filesystem::TmpDir tmpdir( filesystem::TmpDir::makeSibling( rawpath ) );
 
+      repo::RepoType repokind = info.type();
+      // if the type is unknown, try probing.
+      switch ( repokind.toEnum() )
+      {
+        case RepoType::NONE_e:
+          // unknown, probe it
+          repokind = probe(url);
+        break;
+        default:
+        break;
+      }
+
       if ( ( repokind.toEnum() == RepoType::RPMMD_e ) ||
            ( repokind.toEnum() == RepoType::YAST2_e ) )
       {