From 866e0f22044e567c990c679285918fc391ac1a65 Mon Sep 17 00:00:00 2001 From: Michael Andres Date: Wed, 9 Jul 2008 11:24:02 +0000 Subject: [PATCH] - A missing cookie file must not be treated as an error. Simply rebuild the cache (bnc #405867) --- package/libzypp.changes | 6 ++++-- zypp/RepoManager.cc | 15 +++++++-------- zypp/RepoStatus.cc | 10 ++++------ zypp/RepoStatus.h | 17 +++++++++-------- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/package/libzypp.changes b/package/libzypp.changes index 02fdf30..059a41d 100644 --- a/package/libzypp.changes +++ b/package/libzypp.changes @@ -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 diff --git a/zypp/RepoManager.cc b/zypp/RepoManager.cc index 3db671f..c162cc8 100644 --- a/zypp/RepoManager.cc +++ b/zypp/RepoManager.cc @@ -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 oldRepos; getRepositoriesInService(service.name(), insert_iterator > @@ -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) ); } } diff --git a/zypp/RepoStatus.cc b/zypp/RepoStatus.cc index d9c2ef9..0cb6c53 100644 --- a/zypp/RepoStatus.cc +++ b/zypp/RepoStatus.cc @@ -11,10 +11,8 @@ */ #include #include -#include -#include #include -//#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); diff --git a/zypp/RepoStatus.h b/zypp/RepoStatus.h index 71f57cb..3436ee0 100644 --- a/zypp/RepoStatus.h +++ b/zypp/RepoStatus.h @@ -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(); -- 2.7.4