bugfix 153577, look for best architecture during upgrade
authorKlaus Kaempf <kkaempf@suse.de>
Mon, 27 Feb 2006 11:49:22 +0000 (11:49 +0000)
committerKlaus Kaempf <kkaempf@suse.de>
Mon, 27 Feb 2006 11:49:22 +0000 (11:49 +0000)
zypp/solver/detail/Helper.cc
zypp/solver/detail/ResolverUpgrade.cc

index 4a90ab6a4bc5ddcced354a3a855b374e6de52c19..55abcd8de9ff3da9966fc7d932179f76d864a229 100644 (file)
@@ -125,7 +125,8 @@ class LookForUpdate : public resfilter::PoolItemFilterFunctor
     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 
@@ -147,7 +148,7 @@ Helper::findUpdateItem (const ResPool & pool, PoolItem_Ref item)
                  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);
index a84130e497b7f67b29f2322750dc87a4ccd32801..0505d49e706806812a57fd63fec5c9d787619432 100644 (file)
@@ -255,14 +255,14 @@ MIL << "target at " << target << endl;
       ++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;
@@ -289,7 +289,8 @@ MIL << "item " << item << " is installed, candidate is " << candidate << 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 !
        }