ref: refs/heads/master
commit cba415f4071e0690ec260751a342476f598b005d
Author: Michael Andres
Date: Fri Oct 30 11:42:21 2009 +0100
Fix 'zypper in --from' selecting the wrong packages. (bnc #548392)
---
src/install.cc | 28 ++++++++++++++++------------
zypper.spec.cmake | 2 +-
2 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/src/install.cc b/src/install.cc
index 5452a02..324b05a 100755
--- a/src/install.cc
+++ b/src/install.cc
@@ -1,11 +1,12 @@
#include
//#include <iostream>
#include "zypp/ZYppFactory.h"
-#include "zypp/base/Logger.h"
+#include "zypp/base/LogTools.h"
#include "zypp/base/Algorithm.h"
#include "zypp/base/Functional.h"
#include "zypp/Filter.h"
#include "zypp/PoolQuery.h"
+#include "zypp/PoolItemBest.h"
#include "utils/misc.h"
@@ -511,23 +512,26 @@ void install_remove(Zypper & zypper,
// for each argument search (glob) & mark
for_(strit, argsnew.begin(), argsnew.end())
{
- bool found = false;
- for_(it, repos.begin(), repos.end())
+ PoolQuery q;
+ q.addKind(kind);
+ q.addAttribute(sat::SolvAttr::name, *strit);
+ for_( it, repos.begin(), repos.end() )
{
- PoolQuery q;
- q.addAttribute(sat::SolvAttr::name, *strit);
- q.setMatchGlob();
q.addRepo(it->alias());
- q.addKind(kind);
+ }
+ q.setMatchGlob();
- for_(sit, q.selectableBegin(), q.selectableEnd())
+ // Get the best matching items and tag them for
+ // installation.
+ PoolItemBest bestMatches( q.begin(), q.end() );
+ if ( ! bestMatches.empty() )
+ {
+ for_( sit, bestMatches.begin(), bestMatches.end() )
{
- mark_by_name(zypper, true, kind, (*sit)->name(), it->alias(), "", false);
- found = true;
+ ui::asSelectable()( *sit )->setOnSystem( *sit, ResStatus::USER );
}
}
-
- if (!found)
+ else
{
// translators: meaning a package %s or provider of capability %s
zypper.out().error(str::form(_("'%s' not found."), strit->c_str()));
diff --git a/zypper.spec.cmake b/zypper.spec.cmake
index ba252b6..600be44 100644
--- a/zypper.spec.cmake
+++ b/zypper.spec.cmake
@@ -11,7 +11,7 @@
# norootforbuild
Name: @PACKAGE@
-BuildRequires: libzypp-devel >= 6.17.1 boost-devel >= 1.33.1 gettext-devel >= 0.15
+BuildRequires: libzypp-devel >= 6.21.0 boost-devel >= 1.33.1 gettext-devel >= 0.15
BuildRequires: readline-devel >= 5.1 augeas-devel >= 0.5.0
BuildRequires: gcc-c++ >= 4.1 cmake >= 2.4.6
Requires: procps
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org