revert commit don't check for existence of keys,
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Fri, 23 May 2008 23:27:00 +0000 (23:27 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Fri, 23 May 2008 23:27:00 +0000 (23:27 +0000)
to avoid a non needed HEAD request. (related bnc#381280)
as it creates popup error callbacks due to the 404's in
the keys. Leave however the OnMediaLocation::optional()
API to look for another fix strategy.

package/libzypp.changes
zypp/Fetcher.cc
zypp/MediaSetAccess.cc
zypp/MediaSetAccess.h
zypp/repo/susetags/Downloader.cc
zypp/repo/yum/Downloader.cc

index c560a7e..3061cad 100644 (file)
@@ -1,4 +1,13 @@
 -------------------------------------------------------------------
+Sat May 24 01:23:44 CEST 2008 - dmacvicar@suse.de
+
+- revert commit don't check for existence of keys,
+  to avoid a non needed HEAD request. (related bnc#381280)
+  as it creates popup error callbacks due to the 404's in
+  the keys. Leave however the OnMediaLocation::optional()
+  API to look for another fix strategy.
+
+-------------------------------------------------------------------
 Fri May 23 15:52:20 CEST 2008 - dmacvicar@suse.de
 
 - define path for messages and scripts and document
index 0ce3982..5267b3c 100644 (file)
@@ -213,14 +213,6 @@ namespace zypp
         catch (Exception & excpt_r)
         {
           ZYPP_CAUGHT(excpt_r);
-
-          // do not error on optional files
-          if ((*it_res)->location.optional() )
-          {
-              MIL << "Skipping optional file " << (*it_res)->location << endl;
-              continue;
-          }
-          
           excpt_r.remember("Can't provide " + (*it_res)->location.filename().asString() + " : " + excpt_r.msg());
           ZYPP_RETHROW(excpt_r);
         }
index f28b3d1..3cd0745 100644 (file)
@@ -69,6 +69,16 @@ IMPL_PTR_TYPE(MediaSetAccess);
     }
   }
 
+//       callback::SendReport<source::DownloadFileReport> report;
+//       DownloadProgressFileReceiver download_report( report );
+//       SourceFactory source_factory;
+//       Url file_url( url().asString() + file_r.asString() );
+//       report->start( source_factory.createFrom(this), file_url );
+//       callback::TempConnect<media::DownloadProgressReport> tmp_download( download_report );
+//       Pathname file = provideJustFile( file_r, media_nr, cached, checkonly );
+//       report->finish( file_url, source::DownloadFileReport::NO_ERROR, "" );
+//       return file;
+
   void MediaSetAccess::releaseFile( const OnMediaLocation & on_media_file )
   {
     releaseFile( on_media_file.filename(), on_media_file.medianr() );
@@ -91,23 +101,13 @@ IMPL_PTR_TYPE(MediaSetAccess);
 
   Pathname MediaSetAccess::provideFile( const OnMediaLocation & on_media_file )
   {
-    // if the file is optional we don't want a retry, ignore, abort
-    // callback, but just abort inmediately if it does not exist
-    // therefore we pass checkonly true
-    if (on_media_file.optional() )
-      return provideFileInternal( on_media_file.filename(), 
-                                  on_media_file.medianr(),
-                                  true, true);
-          
-    return provideFileInternal( on_media_file.filename(),
-                                on_media_file.medianr(),
-                                true, false );
+    return provideFile( on_media_file.filename(), on_media_file.medianr() );
   }
 
 
   Pathname MediaSetAccess::provideFile(const Pathname & file, unsigned media_nr )
   {
-    return provideFileInternal( file, media_nr, false, false );
+    return provideFileInternal( file, media_nr, false, false);
   }
 
   bool MediaSetAccess::doesFileExist(const Pathname & file, unsigned media_nr )
index 00847ec..09ec05d 100644 (file)
@@ -113,11 +113,6 @@ namespace zypp
        * \param on_media_file location of the file on media
        * \return local pathname of the requested file
        *
-       * If \p on_media_file is marked as optional, then
-       * in case of failure the user interaction callbacks
-       * will be ignored and the exception will throw
-       * inmediately.
-       *
        * \throws MediaException if a problem occurs,
        *        see \ref media::MediaManager::provideFile()
        */
index b29ae41..6b5ccb8 100644 (file)
@@ -49,22 +49,24 @@ void Downloader::download( MediaSetAccess &media,
   SignatureFileChecker sigchecker;
 
   Pathname sig = _path + "/content.asc";
+  if ( media.doesFileExist(sig) )
+  {
+    this->enqueue( OnMediaLocation( sig, 1 ) );
+    this->start( dest_dir, media );
+    this->reset();
 
-  this->enqueue( OnMediaLocation( sig, 1 ).setOptional(true) );
-  this->start( dest_dir, media );
-  this->reset();
-
-  if ( PathInfo(dest_dir + sig).isExist() )
-      sigchecker = SignatureFileChecker( dest_dir + sig );
+    sigchecker = SignatureFileChecker( dest_dir + sig );
+  }
 
   Pathname key = _path + "/content.key";
+  if ( media.doesFileExist(key) )
+  {
+    this->enqueue( OnMediaLocation( key, 1 ) );
+    this->start( dest_dir, media );
+    this->reset();
+    sigchecker.addPublicKey(dest_dir + key);
+  }
 
-  // the key may not exist
-  this->enqueue( OnMediaLocation( key, 1 ).setOptional(true) );
-  this->start( dest_dir, media );
-  this->reset();
-  if ( PathInfo(dest_dir + key).isExist() )
-      sigchecker.addPublicKey(dest_dir + key);
 
   this->enqueue( OnMediaLocation( _path + "/content", 1 ), sigchecker );
   this->start( dest_dir, media );
index 9af9e59..add26b8 100644 (file)
@@ -107,23 +107,24 @@ void Downloader::download( MediaSetAccess &media,
   
   SignatureFileChecker sigchecker;
 
-  // this file is optional, may be the signature is not there
-  this->enqueue( OnMediaLocation(sigpath,1).setOptional(true) );
-  this->start( dest_dir, *_media_ptr);
-  this->reset();
-
-  // only need a checker if the signature exist.
-  if ( PathInfo(dest_dir + sigpath).isExist() )
-      sigchecker = SignatureFileChecker(dest_dir + sigpath);
+  if ( _media_ptr->doesFileExist(sigpath) )
+  {
+      this->enqueue( OnMediaLocation(sigpath,1).setOptional(true) );
+     this->start( dest_dir, *_media_ptr);
+     this->reset();
+     sigchecker = SignatureFileChecker(dest_dir + sigpath);
+  }
 
-  // the key path may also not be there
-  this->enqueue( OnMediaLocation(keypath,1).setOptional(true) );
-  this->start( dest_dir, *_media_ptr);
-  this->reset();
-  
-  if ( PathInfo(dest_dir + keypath).isExist() )
-      sigchecker.addPublicKey(dest_dir + keypath);
+  if ( _media_ptr->doesFileExist(keypath) )
+  {
+      this->enqueue( OnMediaLocation(keypath,1).setOptional(true) );
+    this->start( dest_dir, *_media_ptr);
+    this->reset();
+    sigchecker.addPublicKey(dest_dir + keypath);
+  }
 
   this->start( dest_dir, *_media_ptr );
 
   if ( ! progress.tick() )