From: Michael Andres Date: Fri, 11 Jul 2014 06:51:19 +0000 (+0200) Subject: Enable --plus-content option (FATE#316287) X-Git-Tag: upstream/1.11.11~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=613c74d4150706abc235b12340b5d4a892d40afa;p=platform%2Fupstream%2Fzypper.git Enable --plus-content option (FATE#316287) --- diff --git a/src/RequestFeedback.cc b/src/RequestFeedback.cc index c27f86d..e412426 100644 --- a/src/RequestFeedback.cc +++ b/src/RequestFeedback.cc @@ -68,8 +68,13 @@ string SolverRequester::Feedback::asUserString( return str::form(_("Object '%s' not found in specified repositories."), _reqpkg.orig_str.c_str()); } case NOT_FOUND_CAP: + { // translators: meaning a package %s or provider of capability %s - return str::form(_("No provider of '%s' found."), _reqpkg.orig_str.c_str()); + std::string ret( str::form(_("No provider of '%s' found."), _reqpkg.orig_str.c_str()) ); + if ( _reqpkg.orig_str.find("debuginfo") != std::string::npos ) + ret += " ['--plus-content debug'?]"; + return ret; + } case NOT_INSTALLED: if (_reqpkg.orig_str.find_first_of("?*") != string::npos) // wildcards used diff --git a/src/repos.cc b/src/repos.cc index a859d82..065fd3f 100644 --- a/src/repos.cc +++ b/src/repos.cc @@ -262,7 +262,7 @@ static bool refresh_raw_metadata(Zypper & zypper, // --------------------------------------------------------------------------- -static bool build_cache(Zypper & zypper, const RepoInfo &repo, bool force_build) +static bool build_cache(Zypper & zypper, const RepoInfo & repo, bool force_build) { if (force_build) zypper.out().info(_("Forcing building of repository cache")); @@ -660,6 +660,25 @@ void do_init_repos(Zypper & zypper, const Container & container) RepoInfo repo(*it); MIL << "checking if to refresh " << repo.alias() << endl; + // disabled repos may get temp. enabled to check for --plus-content + bool contentcheck = false; + if ( ! ( gData.additional_content_repos.empty() + || repo.url().schemeIsVolatile() + || repo.enabled() ) ) + { + // Preliminarily enable if last content matches or no content info available. + // Final check is done after refresh. + if ( repo.hasContentAny( gData.additional_content_repos ) || ! repo.hasContent() ) + { + contentcheck = true; + repo.setEnabled( true ); + zypper.out().info( boost::format(_("Scanning content of disabled repository '%s'.")) + % repo.asUserString(), + " [--plus-content]" ); + MIL << "[--plus-content] check " << repo.alias() << endl; + } + } + bool do_refresh = repo.enabled() && repo.autorefresh() && @@ -682,6 +701,7 @@ void do_init_repos(Zypper & zypper, const Container & container) % repo.alias() << endl; it->setEnabled(false); + contentcheck = false; } } // non-root user @@ -719,6 +739,7 @@ void do_init_repos(Zypper & zypper, const Container & container) % repo.alias() << endl; it->setEnabled(false); + contentcheck = false; } } // non-root user @@ -741,9 +762,29 @@ void do_init_repos(Zypper & zypper, const Container & container) % repo.asUserString())); WAR << "Disabling repository '" << repo.alias() << "'" << endl; it->setEnabled(false); + contentcheck = false; } } } + + if ( contentcheck ) + { + if ( repo.hasContentAny( gData.additional_content_repos ) ) + { + zypper.out().info( boost::format(_("Temporarily enabling repository '%s'.")) + % repo.asUserString(), + " [--plus-content]" ); + it->setEnabled(true); + MIL << "[--plus-content] check says use " << repo.alias() << endl; + } + else + { + zypper.out().info( boost::format(_("Repository '%s' stays disabled.")) + % repo.asUserString(), + " [--plus-content]" ); + MIL << "[--plus-content] check says disable " << repo.alias() << endl; + } + } } }