ref: refs/heads/SuSE-Code-11-Branch
commit f4367b3cdc5e454f6d695b3d3db13d6f0ce43e54
Author: Ján Kupec
Date: Fri Sep 25 18:34:04 2009 +0200
Fixed incorrect selection of update candidate (bnc #539360)
- uses new zypp::ui::Selectable::updateCandidateObj() method instead
of zypper's findTheBest which ignored repo priorities and vendors
---
src/info.cc | 9 +++++++--
src/install.cc | 16 ++++++++++++----
src/update.cc | 8 +++++++-
3 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/src/info.cc b/src/info.cc
index a6a3e8c..db733d1 100644
--- a/src/info.cc
+++ b/src/info.cc
@@ -33,7 +33,8 @@ using boost::format;
extern ZYpp::Ptr God;
-#define USE_THE_ONE 0
+/** Use ui::Selectable::updateCandidateObj() */
+#define USE_THE_ONE 1
void printNVA(const ResObject::constPtr & res)
{
@@ -153,7 +154,11 @@ void printPkgInfo(Zypper & zypper, const ui::Selectable & s)
PoolItem installed = s.installedObj();
#if USE_THE_ONE
- PoolItem theone = s.theObj();
+ PoolItem theone = s.updateCandidateObj();
+ // if there's no update candidate, then there must be an installed object
+ // otherwise there would be no selectable of this name & kind
+ if (!theone)
+ theone = installed;
#else
PoolItem theone = findTheBest(God->pool(), s);
#endif
diff --git a/src/install.cc b/src/install.cc
index 8b72666..5b48e6b 100755
--- a/src/install.cc
+++ b/src/install.cc
@@ -19,8 +19,8 @@ using namespace boost;
extern ZYpp::Ptr God;
-/** Use ui::Selectable::theObj() or candidateObj() */
-#define USE_THE_ONE 0
+/** Use ui::Selectable::updateCandidateObj() */
+#define USE_THE_ONE 1
static PoolItem findInstalledItemInRepos(const PoolItem & installed)
{
@@ -89,7 +89,11 @@ mark_for_install(Zypper & zypper,
#if USE_THE_ONE
- PoolItem candidate = s->candidateObj();
+ PoolItem candidate = s->updateCandidateObj();
+ // if there's no update candidate, then there must be an installed object
+ // otherwise there would be no selectable of this name & kind
+ if (!candidate)
+ candidate = s->installedObj();
#else
PoolItem candidate = findTheBest(God->pool(), *s);
#endif
@@ -301,7 +305,11 @@ mark_selectable(Zypper & zypper,
const string & arch = "")
{
#if USE_THE_ONE
- PoolItem theone = s.theObj();
+ PoolItem theone = s.updateCandidateObj();
+ // if there's no update candidate, then there must be an installed object
+ // otherwise there would be no selectable of this name & kind
+ if (!theone)
+ theone = s.installedObj();
#else
PoolItem theone = findTheBest(God->pool(), s);
#endif
diff --git a/src/update.cc b/src/update.cc
index edeadfb..1c79ab1 100755
--- a/src/update.cc
+++ b/src/update.cc
@@ -18,6 +18,8 @@ using namespace boost;
extern ZYpp::Ptr God;
+/** Use ui::Selectable::updateCandidateObj() */
+#define USE_THE_ONE 1
// ----------------------------------------------------------------------------
//
@@ -719,7 +721,11 @@ void mark_updates(Zypper & zypper, const ResKindSet & kinds, bool skip_interacti
{
ui::Selectable::Ptr s = *solvit;
#if USE_THE_ONE
- PoolItem theone = s.theObj();
+ PoolItem theone = s.updateCandidateObj();
+ // if there's no update candidate, then there must be an installed object
+ // otherwise there would be no selectable of this name & kind
+ if (!theone)
+ theone = s.installedObj();
#else
PoolItem theone = findTheBest(God->pool(), *s);
#endif
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org