From: Ján Kupec Date: Tue, 19 Oct 2010 14:20:44 +0000 (+0200) Subject: Proper hint for forcing downgrade (bnc #620377) X-Git-Tag: 1.5.1~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=58188449170ecaf1e96fb30993d81df677a956b7;p=platform%2Fupstream%2Fzypper.git Proper hint for forcing downgrade (bnc #620377) --- diff --git a/src/RequestFeedback.cc b/src/RequestFeedback.cc index 4bac772..3948b5e 100644 --- a/src/RequestFeedback.cc +++ b/src/RequestFeedback.cc @@ -156,6 +156,10 @@ string SolverRequester::Feedback::asUserString( case SELECTED_IS_OLDER: { + ostringstream cmdhint; + cmdhint << "zypper install --force " << _objsel->name() << "-" << _objsel->edition() + << "." << _objsel->arch(); + ostringstream msg; msg << str::form(_( "The selected package '%s' from repository '%s' has lower" @@ -166,8 +170,8 @@ string SolverRequester::Feedback::asUserString( _objsel->repoInfo().name().c_str()); msg << " "; msg << str::form( - // translators: %s = "--force" - _("Use '%s' to force installation of the package."), "--force"); + // translators: %s = "zypper install --force package-version.arch" + _("Use '%s' to force installation of the package."), cmdhint.str().c_str()); return msg.str(); } diff --git a/src/SolverRequester.cc b/src/SolverRequester.cc index 790610b..8052bdb 100644 --- a/src/SolverRequester.cc +++ b/src/SolverRequester.cc @@ -526,6 +526,9 @@ void SolverRequester::updateTo( } else if (installed->edition() > selected->edition()) { + if (_opts.force) + return; + addFeedback(Feedback::SELECTED_IS_OLDER, pkg, selected, installed); MIL << "Selected is older than the installed." " Will not downgrade unless --force is used" << endl;