From a103ce42f0032075668fb78a7737868e1136fb45 Mon Sep 17 00:00:00 2001 From: Jan Kupec Date: Wed, 15 Aug 2007 11:46:17 +0000 Subject: [PATCH] - touch the repo index file after checking if to refresh so that on the next check it gets the timestamp of last check (finished FATE #301991) --- zypp/RepoManager.cc | 44 +++++++++++++++++++++++++++++++++++++++++++- zypp/RepoManager.h | 6 ++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/zypp/RepoManager.cc b/zypp/RepoManager.cc index e17a726..b7ae81a 100644 --- a/zypp/RepoManager.cc +++ b/zypp/RepoManager.cc @@ -244,7 +244,7 @@ namespace zypp static shared_ptr _nullimpl( new Impl ); return _nullimpl; } - + private: friend Impl * rwcowClone( const Impl * rhs ); /** clone for RWCOW_pointer */ @@ -347,6 +347,42 @@ namespace zypp return status; } + void RepoManager::touchIndexFile(const RepoInfo & info) + { + Pathname rawpath = rawcache_path_for_repoinfo( _pimpl->options, info ); + + RepoType repokind = info.type(); + if ( repokind.toEnum() == RepoType::NONE_e ) + // unknown, probe the local metadata + repokind = probe(rawpath.asUrl()); + // if still unknown, just return + if (repokind == RepoType::NONE_e) + return; + + Pathname p; + switch ( repokind.toEnum() ) + { + case RepoType::RPMMD_e : + p = Pathname(rawpath + "/repodata/repomd.xml"); + break; + + case RepoType::YAST2_e : + p = Pathname(rawpath + "/content"); + break; + + case RepoType::RPMPLAINDIR_e : + p = Pathname(rawpath + "/cookie"); + break; + + case RepoType::NONE_e : + default: + break; + } + + // touch the file, ignore error (they are logged anyway) + filesystem::touch(p); + } + bool RepoManager::checkIfToRefreshMetadata( const RepoInfo &info, const Url &url, RawMetadataRefreshPolicy policy ) @@ -430,6 +466,9 @@ namespace zypp refresh = true; } + if (!refresh) + touchIndexFile(info); + return refresh; } else if ( repokind.toEnum() == RepoType::RPMPLAINDIR_e ) @@ -451,6 +490,9 @@ namespace zypp refresh = true; } + if (!refresh) + touchIndexFile(info); + return refresh; } else diff --git a/zypp/RepoManager.h b/zypp/RepoManager.h index e05763b..0d73c28 100644 --- a/zypp/RepoManager.h +++ b/zypp/RepoManager.h @@ -362,6 +362,12 @@ namespace zypp protected: RepoStatus rawMetadataStatus( const RepoInfo &info ); RepoStatus cacheStatus( const RepoInfo &info ); + + /** + * Update timestamp of repository index file for the specified repository \a info. + * Used in \ref checkIfToRefreshMetadata() for repo.refresh.delay feature. + */ + void touchIndexFile(const RepoInfo & info); public: -- 2.7.4