From: Michael Andres Date: Tue, 13 Sep 2011 11:02:50 +0000 (+0200) Subject: Fix 'zypper info's report of package support status (bnc#651614) X-Git-Tag: 1.6.16~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6f831a18847453095da008a342da168338303603;p=platform%2Fupstream%2Fzypper.git Fix 'zypper info's report of package support status (bnc#651614) --- diff --git a/src/info.cc b/src/info.cc index e1c8d31..a95f5e7 100644 --- a/src/info.cc +++ b/src/info.cc @@ -9,7 +9,7 @@ #include -#include +// #include #include #include #include @@ -171,11 +171,18 @@ Copy and modify /usr/share/vim/current/gvimrc to ~/.gvimrc if needed. */ void printPkgInfo(Zypper & zypper, const ui::Selectable & s) { - PoolItem installed = s.installedObj(); - PoolItem theone = s.updateCandidateObj(); - if (!theone) - theone = installed; - Package::constPtr pkg = asKind(theone.resolvable()); + PoolItem installed( s.installedObj() ); + PoolItem updateCand( s.updateCandidateObj() ); + // An updateCandidate is always better than any installed object. + // If the best version is already installed try to look it up in + // the repo it came from, otherwise use the installed one. + PoolItem theone( updateCand ); + if ( !theone ) + { + theone = s.identicalAvailableObj( installed ); + if ( !theone ) + theone = installed; + } cout << (zypper.globalOpts().is_rug_compatible ? _("Catalog: ") : _("Repository: ")) << (zypper.config().show_alias ? @@ -187,22 +194,26 @@ void printPkgInfo(Zypper & zypper, const ui::Selectable & s) // if running on SUSE Linux Enterprise, report unsupported packages Product::constPtr platform = God->target()->baseProduct(); if (platform && platform->name().find("SUSE_SLE") != string::npos) + { + Package::constPtr pkg = asKind(theone.resolvable()); cout << _("Support Level: ") << asUserString(pkg->vendorSupport()) << endl; + } cout << _("Installed: ") << (installed ? _("Yes") : _("No")) << endl; - //! \todo fix this - arch? cout << _("Status: "); - if (installed && - installed.resolvable()->edition() >= theone.resolvable()->edition()) - { - cout << _("up-to-date") << endl; - } - else if (installed) + if ( installed ) { - cout << str::form(_("out-of-date (version %s installed)"), - installed.resolvable()->edition().asString().c_str()) - << endl; + if ( updateCand ) + { + cout << str::form(_("out-of-date (version %s installed)"), + installed.resolvable()->edition().asString().c_str()) + << endl; + } + else + { + cout << _("up-to-date") << endl; + } } else cout << _("not installed") << endl; diff --git a/zypper.spec.cmake b/zypper.spec.cmake index 5d9322e..0d63bb3 100644 --- a/zypper.spec.cmake +++ b/zypper.spec.cmake @@ -11,7 +11,7 @@ # norootforbuild Name: @PACKAGE@ -BuildRequires: libzypp-devel >= 9.8.0 +BuildRequires: libzypp-devel >= 9.11.0 BuildRequires: boost-devel >= 1.33.1 BuildRequires: gettext-devel >= 0.15 BuildRequires: readline-devel >= 5.1