From: Josef Reidinger Date: Thu, 20 Mar 2008 13:57:20 +0000 (+0000) Subject: return more information from checking if metadata need refresh, so user can get bette... X-Git-Tag: BASE-SuSE-Linux-11_0-Branch~405 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1fe79789f02a6017aeef216c28e20551fd232217;p=platform%2Fupstream%2Flibzypp.git return more information from checking if metadata need refresh, so user can get better info. (bnc #307249) --- 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);