return info.uninstalled;
}
+
+//----------------------------------------------------------------------------
+
+class LookForReinstall : public resfilter::OnCapMatchCallbackFunctor, public resfilter::PoolItemFilterFunctor
+{
+ public:
+ PoolItem_Ref uninstalled;
+
+ bool operator()( PoolItem_Ref provider )
+ {
+ uninstalled = provider;
+ return false; // stop here, we found it
+ }
+};
+
+
+PoolItem_Ref
+Helper::findReinstallItem (const ResPool & pool, PoolItem_Ref item)
+{
+ LookForReinstall info;
+#warning FIXME, should not report locked update candidates.
+ invokeOnEach( pool.byNameBegin( item->name() ),
+ pool.byNameEnd( item->name() ),
+ functor::chain (functor::chain (resfilter::ByUninstalled (), // ByUninstalled
+ resfilter::ByKind( item->kind() ) ), // equal kind
+ resfilter::byEdition<CompareByEQ<Edition> >( item->edition() )),
+ functor::functorRef<bool,PoolItem> (info) );
+MIL << "Helper::findReinstallItem(" << item << ") => " << info.uninstalled << endl;
+ return info.uninstalled;
+}
+
///////////////////////////////////////////////////////////////////
};// namespace detail
/////////////////////////////////////////////////////////////////////
// for item, find uninstalled item which has same name and higher edition
static PoolItem_Ref findUninstalledItem (const ResPool & pool, PoolItem_Ref item);
+ // for item, find uninstalled item which has same name and equal edition
+ static PoolItem_Ref findReinstallItem (const ResPool & pool, PoolItem_Ref item);
+
static PoolItem_Ref findUpdateItem (const ResPool & pool, PoolItem_Ref item);
friend std::ostream& operator<<(std::ostream&, const PoolItemList & itemlist);