From 58188449170ecaf1e96fb30993d81df677a956b7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A1n=20Kupec?= Date: Tue, 19 Oct 2010 16:20:44 +0200 Subject: [PATCH] Proper hint for forcing downgrade (bnc #620377) --- src/RequestFeedback.cc | 8 ++++++-- src/SolverRequester.cc | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) 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; -- 2.7.4