From 1fe79789f02a6017aeef216c28e20551fd232217 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Thu, 20 Mar 2008 13:57:20 +0000 Subject: [PATCH] return more information from checking if metadata need refresh, so user can get better info. (bnc #307249) --- VERSION.cmake | 4 ++-- zypp/RepoManager.cc | 11 ++++++----- zypp/RepoManager.h | 15 +++++++++++++-- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/VERSION.cmake b/VERSION.cmake index 3acc634..2f56ffe 100644 --- a/VERSION.cmake +++ b/VERSION.cmake @@ -45,6 +45,6 @@ # SET(LIBZYPP_MAJOR "4") -SET(LIBZYPP_MINOR "5") -SET(LIBZYPP_COMPATMINOR "5") +SET(LIBZYPP_MINOR "6") +SET(LIBZYPP_COMPATMINOR "6") SET(LIBZYPP_PATCH "0") diff --git a/zypp/RepoManager.cc b/zypp/RepoManager.cc index 258dfe2..423fbe1 100644 --- a/zypp/RepoManager.cc +++ b/zypp/RepoManager.cc @@ -386,7 +386,8 @@ namespace zypp filesystem::touch(p); } - bool RepoManager::checkIfToRefreshMetadata( const RepoInfo &info, + RepoManager::RefreshCheckStatus RepoManager::checkIfToRefreshMetadata( + const RepoInfo &info, const Url &url, RawMetadataRefreshPolicy policy ) { @@ -434,7 +435,7 @@ namespace zypp << "' has been refreshed less than repo.refresh.delay (" << ZConfig::instance().repo_refresh_delay() << ") minutes ago. Advising to skip refresh" << endl; - return false; + return REPO_DELAYED; } } @@ -472,7 +473,7 @@ namespace zypp if (!refresh) touchIndexFile(info); - return refresh; + return refresh ? REFRESH_NEEDED : REPO_UP_TO_DATE; } #if 0 else if ( repokind.toEnum() == RepoType::RPMPLAINDIR_e ) @@ -512,7 +513,7 @@ namespace zypp ZYPP_RETHROW(e); } - return true; // default + return REFRESH_NEEDED; // default } void RepoManager::refreshMetadata( const RepoInfo &info, @@ -534,7 +535,7 @@ namespace zypp // check whether to refresh metadata // if the check fails for this url, it throws, so another url will be checked - if (!checkIfToRefreshMetadata(info, url, policy)) + if (checkIfToRefreshMetadata(info, url, policy)!=REFRESH_NEEDED) return; MIL << "Going to refresh metadata from " << url << endl; diff --git a/zypp/RepoManager.h b/zypp/RepoManager.h index 4d5f3af..caff680 100644 --- a/zypp/RepoManager.h +++ b/zypp/RepoManager.h @@ -106,6 +106,15 @@ namespace zypp RepoStatus metadataStatus( const RepoInfo &info ) const; /** + * Possibly return state of checkIfRefreshMEtadata function + */ + enum RefreshCheckStatus { + REFRESH_NEEDED, /**< refresh is needed */ + REPO_UP_TO_DATE, /**< repository not changed */ + REPO_DELAYED /**< refresh is delayed due to settings */ + }; + + /** * Checks whether to refresh metadata for specified repository and url. *

* The need for refresh is evaluated according to the following conditions, @@ -133,7 +142,7 @@ namespace zypp * { * // check whether to refresh metadata * // if the check fails for this url, it throws, so another url will be checked - * if (!checkIfToRefreshMetadata(info, *it, policy)) + * if (checkIfToRefreshMetadata(info, *it, policy)!=RepoInfo::REFRESH_NEEDED) * return; * * // do the actual refresh @@ -152,12 +161,14 @@ namespace zypp * \param info * \param url * \param policy + * \return state of repository + * \see RefreshCheckStatus * \throws RepoUnknownTypeException * \throws repo::RepoNoAliasException if can't figure an alias * \throws Exception on unknown error * */ - bool checkIfToRefreshMetadata( const RepoInfo &info, + RefreshCheckStatus checkIfToRefreshMetadata( const RepoInfo &info, const Url &url, RawMetadataRefreshPolicy policy = RefreshIfNeeded); -- 2.7.4