- A missing cookie file must not be treated as an error. Simply
authorMichael Andres <ma@suse.de>
Wed, 9 Jul 2008 11:24:02 +0000 (11:24 +0000)
committerMichael Andres <ma@suse.de>
Wed, 9 Jul 2008 11:24:02 +0000 (11:24 +0000)
  rebuild the cache (bnc #405867)

package/libzypp.changes
zypp/RepoManager.cc
zypp/RepoStatus.cc
zypp/RepoStatus.h

index 02fdf30..059a41d 100644 (file)
@@ -1,8 +1,10 @@
 -------------------------------------------------------------------
-Wed Jul  9 12:13:58 CEST 2008 - ma@suse.de
+Wed Jul  9 13:13:58 CEST 2008 - ma@suse.de
 
 - Provide Package::url() if available in solv file. (bnc #402434)
-- revision 10523
+- A missing cookie file must not be treated as an error. Simply 
+  rebuild the cache (bnc #405867)
+- revision 10525
 
 -------------------------------------------------------------------
 Mon Jul  7 13:39:09 CEST 2008 - schubi@suse.de
index 3db671f..c162cc8 100644 (file)
@@ -253,7 +253,7 @@ namespace zypp
     RepoManagerOptions options;
 
     RepoSet repos;
-    
+
     ServiceSet services;
 
   public:
@@ -265,10 +265,10 @@ namespace zypp
     }
 
     void saveService( const Service& service ) const;
-  
+
     Pathname generateNonExistingName( const Pathname &dir,
                                          const std::string &basefilename ) const;
-  
+
     std::string generateFilename( const RepoInfo &info ) const;
     std::string generateFilename( const Service &info ) const;
 
@@ -753,7 +753,6 @@ namespace zypp
     if ( isCached( info ) )
     {
       MIL << info.alias() << " is already cached." << endl;
-      //data::RecordId id = store.lookupRepository(info.alias());
       RepoStatus cache_status = cacheStatus(info);
 
       if ( cache_status.checksum() == raw_metadata_status.checksum() )
@@ -1334,7 +1333,7 @@ namespace zypp
     info.setBaseUrl(url);
     ZYPP_THROW(RepoNotFoundException(info));
   }
-  
+
   void RepoManager::addService( const std::string& name, const Url& url )
   {
     addService( Service(name,url) );
@@ -1396,7 +1395,7 @@ namespace zypp
     }
 
     //now remove all repositories added by this service
-    getRepositoriesInService( name, 
+    getRepositoriesInService( name,
       boost::make_function_output_iterator(bind(&RepoManager::removeRepository, this, _1, ProgressData::ReceiverFnc()) ) );
   }
 
@@ -1483,7 +1482,7 @@ namespace zypp
 
     //compare old and new repositories (hope not to much, if it change
     // then construct set and use set operation on it)
-    
+
     std::list<RepoInfo> oldRepos;
     getRepositoriesInService(service.name(),
         insert_iterator<std::list<RepoInfo> >
@@ -1585,7 +1584,7 @@ namespace zypp
       str::regex allowedServiceExt("^\\.service(_[0-9]+)?$");
       for_(it, entries.begin(), entries.end() )
       {
-        parser::ServiceFileReader reader(*it, 
+        parser::ServiceFileReader reader(*it,
             bind(&ServiceCollector::collect, collector, _1) );
       }
     }
index d9c2ef9..0cb6c53 100644 (file)
 */
 #include <iostream>
 #include <sstream>
-#include <vector>
-#include <algorithm>
 #include <fstream>
-//#include "zypp/base/Logger.h"
+#include "zypp/base/Logger.h"
 #include "zypp/base/String.h"
 #include "zypp/RepoStatus.h"
 #include "zypp/PathInfo.h"
@@ -84,13 +82,13 @@ namespace zypp
 
   RepoStatus RepoStatus::fromCookieFile( const Pathname &cookiefile )
   {
-    RepoStatus status;
-
     std::ifstream file(cookiefile.c_str());
     if (!file) {
-      ZYPP_THROW (Exception( "Can't open " + cookiefile.asString() ) );
+      WAR << "No cookie file " << cookiefile << endl;
+      return RepoStatus();
     }
 
+    RepoStatus status;
     std::string buffer;
     file >> buffer;
     status.setChecksum(buffer);
index 71f57cb..3436ee0 100644 (file)
@@ -39,15 +39,16 @@ namespace zypp
     friend std::ostream & operator<<( std::ostream & str, const RepoStatus & obj );
 
   public:
-    
+
     /**
      * reads the status from a file which contains the
      * checksum and timestamp in each line.
      *
-     * \throws Exception If the file is not valid or accessible
+     * \returns An empty \ref RepoStatus if the file does not
+     * exist or is not readable.
      */
     static RepoStatus fromCookieFile( const Pathname &path );
-  
+
     /**
      * save the status information to a cookie file
      * \throws Exception if the file can't be saved
@@ -61,14 +62,14 @@ namespace zypp
      * in any way is sufficient.
      */
     std::string checksum() const;
-    
+
     /**
      * timestamp of the repository. If the repository
      * changes, it has to be updated as well with the
      * new timestamp.
      */
     Date timestamp() const;
-    
+
     /**
      * \short Is the status empty?
      *
@@ -82,7 +83,7 @@ namespace zypp
      * \param checksum
      */
     RepoStatus & setChecksum( const std::string &checksum );
-    
+
     /**
      * set the repository timestamp \see timestamp
      * \param timestamp
@@ -95,7 +96,7 @@ namespace zypp
   public:
     /** Default ctor */
     RepoStatus();
-    
+
     /**
      * \short Status from a single file
      * As most repository state is represented
@@ -106,7 +107,7 @@ namespace zypp
      * file will result in an empty status
      */
     RepoStatus( const Pathname &file );
-    
+
     /** Dtor */
     ~RepoStatus();