Hack to give native packages slightly higher priority to get them
authorPanu Matilainen <pmatilai@laiskiainen.org>
Fri, 16 Nov 2007 09:57:30 +0000 (11:57 +0200)
committerPanu Matilainen <pmatilai@laiskiainen.org>
Fri, 16 Nov 2007 09:57:30 +0000 (11:57 +0200)
preferred over compat arch (ie .32bit) packages.

apt-pkg/policy.cc
apt-pkg/rpm/rpmpackagedata.cc

index 70b392a..3d4574f 100644 (file)
@@ -295,6 +295,13 @@ signed short pkgPolicy::GetPkgPriority(const pkgCache::PkgIterator &Pkg)
            Max = Prio;
       }      
    }
+
+   /* XXX HACK alert: give non-native packages slightly lower priority */
+   string CAS = _config->Find("RPM::CompatArchSuffix");
+   if (!CAS.empty() && 
+       string(Pkg.Name()).rfind(CAS) != string::npos) {
+        Max--;
+   }
    return Max;
 }
                                                                        /*}}}*/
index 7dbac3a..24060e2 100644 (file)
@@ -42,6 +42,10 @@ RPMPackageData::RPMPackageData()
       PreferredArch = _config->Find(PA.c_str(), BaseArch.c_str());
       string CAS = MLBase + "::CompatArchSuffix";
       CompatArchSuffix = _config->Find(CAS.c_str(), ".32bit");
+
+      // Blech, export for easy use elsewhere .. for now 
+      _config->Set("RPM::PreferredArch", PreferredArch);
+      _config->Set("RPM::CompatArchSuffix", CompatArchSuffix);
    }
 
    // Populate priorities