Author: jkupec
Date: Fri Oct 3 17:37:18 2008
New Revision: 11239
URL: http://svn.opensuse.org/viewcvs/zypp?rev=11239&view=rev
Log:
- install: correctly check for an update candidate (bnc #427105)
Modified:
trunk/zypper/doc/zypper.8
trunk/zypper/src/install.cc
Modified: trunk/zypper/doc/zypper.8
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/doc/zypper.8?rev=11239&r1=11238&r2=11239&view=diff
==============================================================================
--- trunk/zypper/doc/zypper.8 (original)
+++ trunk/zypper/doc/zypper.8 Fri Oct 3 17:37:18 2008
@@ -1,4 +1,4 @@
-.TH "zypper" "8" "0.12.7" "zypper" "System Tools"
+.TH "zypper" "8" "0.12.8" "zypper" "System Tools"
.SH "SYNTAX"
.LP
zypper [\fI\-\-global\-opts\fR] <\fBcommand\fR> [\fI\-\-command\-opts\fR] [\fBcommand-arguments\fR]
Modified: trunk/zypper/src/install.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/install.cc?rev=11239&r1=11238&r2=11239&view=diff
==============================================================================
--- trunk/zypper/src/install.cc (original)
+++ trunk/zypper/src/install.cc Fri Oct 3 17:37:18 2008
@@ -235,6 +235,58 @@
DBG << endl;
}
+#define USE_THE_ONE 0
+
+#if not USE_THE_ONE
+
+// ----------------------------------------------------------------------------
+
+class LookForUpdate : public zypp::resfilter::PoolItemFilterFunctor
+{
+public:
+ PoolItem best;
+
+ bool operator()( PoolItem provider )
+ {
+ if (!provider.status().isLocked() // is not locked (taboo)
+ && (!best // first match
+ // or a better edition than so-far-found
+ || best->edition().compare( provider->edition() ) < 0))
+ {
+ best = provider;
+ }
+ return true;
+ }
+};
+
+// ----------------------------------------------------------------------------
+
+// Find best (according to edition) uninstalled item
+// with same kind/name/arch as item.
+// Similar to zypp::solver::detail::Helper::findUpdateItem
+// but allows changing the vendor
+static
+PoolItem
+findUpdateItem( const ResPool & pool, PoolItem item )
+{
+ LookForUpdate info;
+
+ invokeOnEach( pool.byIdentBegin(item->kind(), item->name()),
+ pool.byIdentEnd(item->kind(), item->name()),
+ // get uninstalled, equal kind and arch, better edition
+ functor::chain (
+ functor::chain (
+ resfilter::ByUninstalled (),
+ resfilter::byArch