Author: jkupec
Date: Tue Oct 7 17:01:54 2008
New Revision: 11254
URL: http://svn.opensuse.org/viewcvs/zypp?rev=11254&view=rev
Log:
- use new libzypp API for findInstalledItemInRepos()
Modified:
trunk/zypper/src/install.cc
Modified: trunk/zypper/src/install.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/install.cc?rev=11254&r1=11253&r2=11254&view=diff
==============================================================================
--- trunk/zypper/src/install.cc (original)
+++ trunk/zypper/src/install.cc Tue Oct 7 17:01:54 2008
@@ -1,8 +1,10 @@
#include
-#include "zypp/base/Logger.h"
#include "zypp/ZYppFactory.h"
+#include "zypp/base/Logger.h"
#include "zypp/base/Algorithm.h"
+#include "zypp/base/Functional.h"
+#include "zypp/Filter.h"
#include "zypp/PoolQuery.h"
#include "utils/misc.h"
@@ -19,29 +21,18 @@
/** Use ui::Selectable::theObj() or candidateObj() */
#define USE_THE_ONE 0
-/** Simple functor remembering the first passed pool item and stopping the loop. */
-struct PoolItemGetter
-{
- PoolItem item;
- bool operator()(const PoolItem & pi)
- { item = pi; return false; }
-};
-
static PoolItem findInstalledItemInRepos(const PoolItem & installed)
{
- const zypp::ResPool& pool = God->pool();
- PoolItemGetter getter;
+ const zypp::ResPool & pool(zypp::ResPool::instance());
+ PoolItem result;
invokeOnEach(
- pool.byIdentBegin(installed->kind(), installed->name()),
- pool.byIdentEnd(installed->kind(), installed->name()),
+ pool.byIdentBegin(installed), pool.byIdentEnd(installed),
functor::chain(
- functor::chain(
- resfilter::ByUninstalled(),
- resfilter::byEdition(installed->edition())),
- resfilter::byArch(installed->arch())),
- functor::functorRef(getter));
- XXX << "findInstalledItemInRepos(" << installed << ") => " << getter.item << endl;
- return getter.item;
+ filter::SameItemAs(installed),
+ resfilter::ByUninstalled()),
+ functor::getFirst(result));
+ INT << "findInstalledItemInRepos(" << installed << ") => " << result << endl;
+ return result;
}
// TODO edition, arch ?
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org