Lock rpms architecture only on distupgrade of the running system. (bnc #458520)
authorMichael Andres <ma@suse.de>
Fri, 4 Sep 2009 10:19:24 +0000 (12:19 +0200)
committerMichael Andres <ma@suse.de>
Fri, 4 Sep 2009 10:19:24 +0000 (12:19 +0200)
zypp/solver/detail/SATResolver.cc

index 6439718..94f9fe4 100644 (file)
@@ -1387,36 +1387,22 @@ void SATResolver::setSystemRequirements()
        MIL << "SYSTEM Conflicts " << *iter << endl;
     }
 
-    // try to prefer none architecture change if possible
-    // So the architecture of the "rpm" package should be prefered
-
-    Capability cap("rpm");
-    sat::WhatProvides rpmProviders(cap);
-    for_( iter2, rpmProviders.begin(), rpmProviders.end() ) {
-       if (iter2->isSystem()) {
-           sat::detail::IdType nid = iter2->ident().id();
-           nid = rel2id(_SATPool,
-                        nid,
-                        iter2->arch().id(), REL_ARCH, true);
-           if (_distupgrade)
-           {
-               bool addRule = false;
-               Capability cap(nid);
-               sat::WhatProvides rpmProviders(cap);
-               for_( iter3, rpmProviders.begin(), rpmProviders.end() ) {
-                   if ( !(iter3->isSystem())) {
-                       addRule = true;
-                       break;
-                   }
-               }
-               if (!addRule)
-                   break;
-           }
+    // Lock the architecture of the running systems rpm
+    // package on distupgrade.
+    if ( _distupgrade && ZConfig::instance().systemRoot() == "/" )
+    {
+      ResPool pool( ResPool::instance() );
+      IdString rpm( "rpm" );
+      for_( it, pool.byIdentBegin(rpm), pool.byIdentEnd(rpm) )
+      {
+        if ( (*it)->isSystem() )
+        {
+          Capability archrule( (*it)->arch(), rpm.c_str(), Capability::PARSED );
+          queue_push( &(_jobQueue), SOLVER_INSTALL|SOLVABLE_NAME|SOLVER_ESSENTIAL );
+          queue_push( &(_jobQueue), archrule.id() );
 
-           queue_push(&(_jobQueue), SOLVER_INSTALL|SOLVABLE_NAME|SOLVER_ESSENTIAL);
-           queue_push(&(_jobQueue), nid);
-           break;
-       }
+        }
+      }
     }
 }