do not ask user for checking existing of a file only
authorStanislav Visnovsky <visnov@suse.cz>
Fri, 3 Feb 2006 12:18:14 +0000 (12:18 +0000)
committerStanislav Visnovsky <visnov@suse.cz>
Fri, 3 Feb 2006 12:18:14 +0000 (12:18 +0000)
zypp/media/MediaManager.cc
zypp/source/SourceImpl.cc
zypp/source/SourceImpl.h
zypp/source/yum/YUMSourceImpl.cc

index 3377414..a80c09a 100644 (file)
@@ -380,8 +380,9 @@ namespace zypp
 
         while (!isDesiredMedia(mediaId, mediaNr))
         {
-          MediaChangeReport::Action user 
-           = report->requestMedia(media_access, mediaNr, MediaChangeReport::WRONG, "Wrong media");
+         // on checkonly don't ask user
+          MediaChangeReport::Action user = checkonly ? MediaChangeReport::RETRY :
+           report->requestMedia(media_access, mediaNr, MediaChangeReport::WRONG, "Wrong media");
        
          if (user != MediaChangeReport::RETRY)
          {
@@ -396,8 +397,9 @@ namespace zypp
           break;
         }
         catch ( Exception & exp ) {
-          MediaChangeReport::Action user 
-           = report->requestMedia(media_access, mediaNr, MediaChangeReport::NOT_FOUND, "File not found on the media");
+         // on checkonly don't ask user
+          MediaChangeReport::Action user = checkonly ? MediaChangeReport::RETRY :
+           report->requestMedia(media_access, mediaNr, MediaChangeReport::NOT_FOUND, "File not found on the media");
 
           if ( user != MediaChangeReport::RETRY )
             ZYPP_RETHROW( exp );
index 7181e03..3f8ad63 100644 (file)
@@ -92,9 +92,11 @@ media::MediaManager media_mgr;
      }
 
     const Pathname SourceImpl::provideFile(const Pathname & file_r,
-                                          const unsigned media_nr)
+                                          const unsigned media_nr, 
+                                          bool cached, 
+                                          bool checkonly )
     {
-      media_mgr.provideFile (_media, media_nr, file_r);
+      media_mgr.provideFile (_media, media_nr, file_r, cached, checkonly);
       return media_mgr.localPath(_media, file_r);
     }
 
index 251b616..a57447e 100644 (file)
@@ -72,7 +72,9 @@ namespace zypp
        *
        */
       const Pathname provideFile(const Pathname & file,
-                                const unsigned media_nr = 1);
+                                const unsigned media_nr = 1,
+                                bool cached = false,
+                                bool checkonly = false);
 
       /**
        * Provide a directory to local filesystem
index 0ac9be1..4812fc6 100644 (file)
@@ -53,8 +53,14 @@ namespace zypp
       : SourceImpl(media_r, path_r, alias_r)
       {
        try {
-       // first read list of all files in the reposotory
-        Pathname filename = provideFile(_path + "/repomd.xml");
+       // first read list of all files in the repository
+
+       // check only first
+        Pathname filename = provideFile(_path + "/repomd.xml", false, true);
+
+       // now, the file exists, try to read it
+       filename = provideFile(_path + "/repomd.xml");
+       
        DBG << "Reading file " << filename << endl;
        ifstream repo_st(filename.asString().c_str());
        YUMRepomdParser repomd(repo_st, "");