bool operator()( PoolItem_Ref provider )
{
if ((!uninstalled // none yet
- || uninstalled->edition().compare( provider->edition() ) < 0) // or a better one
+ || (uninstalled->edition().compare( provider->edition() ) < 0) // or a better edition
+ || (uninstalled->arch().compare( provider->arch() ) < 0) ) // or a better architecture
&& !provider.status().isLocked()) // is not locked
{
uninstalled = provider; // store
pool.byNameEnd( item->name() ),
functor::chain (functor::chain (resfilter::ByUninstalled (), // ByUninstalled
resfilter::ByKind( item->kind() ) ), // equal kind
- resfilter::byEdition<CompareByGT<Edition> >( item->edition() )),
+ resfilter::byEdition<CompareByGT<Edition> >( item->edition() )), // only look at better editions
functor::functorRef<bool,PoolItem> (info) );
_XDEBUG("Helper::findUpdateItem(" << item << ") => " << info.uninstalled);
++opt_stats_r.pre_todel;
continue;
}
- if ( item.status().staysInstalled() ) {
+ if ( item.status().staysInstalled() ) { // installed item
installed = item;
CandidateMap::const_iterator cand_it = candidatemap.find(installed);
if (cand_it != candidatemap.end()) {
- candidate = cand_it->second;
+ candidate = cand_it->second; // found candidate already
}
else {
- candidate = Helper::findUpdateItem( _pool, installed);
+ candidate = Helper::findUpdateItem( _pool, installed); // find 'best' upgrade candidate
}
if (!candidate) {
MIL << "doUpgrade available: SKIP no candidate for " << installed << endl;
MIL << "found installed " << installed << " for item " << candidate << endl;
CandidateMap::const_iterator cand_it = candidatemap.find(installed);
if (cand_it == candidatemap.end() // not in map yet
- || cand_it->second->edition().compare (candidate->edition()) < 0) // or the new is better!
+ || (cand_it->second->edition().compare (candidate->edition()) < 0) // or the new has better edition
+ || (cand_it->second->arch().compare (candidate->arch()) < 0) ) // or the new has better architecture
{
candidatemap[installed] = candidate; // put it in !
}