From 99e58c5af2260c99a7fc2e53090977100ff91bfc Mon Sep 17 00:00:00 2001 From: Jan Kupec Date: Mon, 28 Apr 2008 14:12:49 +0000 Subject: [PATCH] - fix status of patters/patches/products --- src/zypper-info.cc | 15 +++++---------- src/zypper-search.cc | 8 ++++++-- src/zypper.cc | 3 ++- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/zypper-info.cc b/src/zypper-info.cc index 23e5d73..488233a 100644 --- a/src/zypper-info.cc +++ b/src/zypper-info.cc @@ -15,6 +15,8 @@ #include "zypper-tabulator.h" #include "zypper-info.h" #include "zypper-richtext.h" +#include "zypper-search.h" + using namespace std; using namespace zypp; @@ -205,14 +207,9 @@ atom: xv = 3.10a-1091.2 void printPatchInfo(const Zypper & zypper, const ui::Selectable & s ) { const PoolItem & pool_item = s.theObj(); - const PoolItem & ins_pool_item = s.installedObj(); printNVA(pool_item.resolvable()); - cout << _("Status: "); // TODO debug - bool i = bool(ins_pool_item); - if (pool_item.isBroken ()) - cout << (i ? _("broken"): _("satisfied")); - cout << endl; + cout << _("Status: ") << string_ppp_status(pool_item) << endl; Patch::constPtr patch = asKind(pool_item.resolvable()); cout << _("Category: ") << patch->category() << endl; @@ -274,7 +271,6 @@ This pattern provides a graphical application and a command line tool for keepin void printPatternInfo(const Zypper & zypper, const ui::Selectable & s) { const PoolItem & pool_item = s.theObj(); - const PoolItem & ins_pool_item = s.installedObj(); cout << (zypper.globalOpts().is_rug_compatible ? _("Catalog: ") : _("Repository: ")) << pool_item.resolvable()->repository().info().name() << endl; @@ -336,8 +332,7 @@ Description: */ void printProductInfo(const Zypper & zypper, const ui::Selectable & s) { - const PoolItem & pool_item = s.theObj(); - const PoolItem & ins_pool_item = s.installedObj(); + const PoolItem & pool_item = s.theObj(); // should be the only one cout << (zypper.globalOpts().is_rug_compatible ? _("Catalog: ") : _("Repository: ")) << pool_item.resolvable()->repository().info().name() << endl; @@ -346,7 +341,7 @@ void printProductInfo(const Zypper & zypper, const ui::Selectable & s) Product::constPtr product = asKind(pool_item.resolvable()); cout << _("Category: ") << product->type() << endl; - cout << _("Installed: ") << (!ins_pool_item ? "No" : "Yes") << endl; + cout << _("Installed: ") << (pool_item.status().isSatisfied() ? "Yes" : "No") << endl; cout << _("Short Name: ") << product->shortName() << endl; cout << _("Long Name: ") << product->longName() << endl; diff --git a/src/zypper-search.cc b/src/zypper-search.cc index 477d696..84a4f16 100644 --- a/src/zypper-search.cc +++ b/src/zypper-search.cc @@ -42,17 +42,21 @@ string selectable_search_repo_str(const ui::Selectable & s) string string_ppp_status(const PoolItem & pi) { + // make sure this will not happen + if (pi.isUndetermined()) + return _("Unknown"); + if (pi.isRelevant()) { if (pi.isSatisfied()) - return _("Installed"); + return _("Installed"); //! \todo make this "Applied" instead? if (pi.isBroken()) return _("Needed"); // can this ever happen? return ""; } - return _("Not Applicable"); + return _("Not Applicable"); //! \todo make this "Not Needed" after 11.0 } diff --git a/src/zypper.cc b/src/zypper.cc index 11507b7..c5961fb 100644 --- a/src/zypper.cc +++ b/src/zypper.cc @@ -2954,7 +2954,8 @@ void Zypper::doCommand() if (exitCode() != ZYPPER_EXIT_OK) return; load_resolvables(*this); - resolve(*this); // needed to compute status of PPP? + // needed to compute status of PPP + resolve(*this); printInfo(*this, kind); -- 2.7.4