[Yum-devel] [PATCH] Fix bugs where we want to install old versions of multiarch packages, which just upsets everything.

James Antill james at and.org
Thu Dec 10 16:42:43 UTC 2009


 This is mostly a revert of:

 commit f6317aabb2734357311b6103286a76054c3cd0e9
 Author: James Antill <james at and.org>
 Date:   Sat May 31 17:08:44 2008 -0400

 We want to keep other arches in the multilib_policy=all case. bug#449056

...but that was because of the confusing name, and the fact we had
another bug which caused the problem, which we fixed a few weeks later:

 commit 40471d1d681f62415487def517ac90f253fafa9b
 Author: James Antill <james at and.org>
 Date:   Tue Jun 24 17:21:26 2008 -0400

      Fix packagesNewestByName() to use comparePoEVR as pkg.__cmp__ uses
 .arch in
        thus we'd only get one pkg from the alph sorted arch.
        kind of a weird interface, not quite the "same" as
 packageNewestByNameArch

...with that fix I believe the original bug#449056 wouldn't have
happened.
---
 yum/__init__.py    |    8 ++++----
 yum/packageSack.py |   17 +++++++++++++----
 yum/sqlitesack.py  |    5 +++++
 3 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/yum/__init__.py b/yum/__init__.py
index 2aaa66a..3c324d8 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -51,7 +51,7 @@ import transactioninfo
 import urlgrabber
 from urlgrabber.grabber import URLGrabber, URLGrabError
 from urlgrabber.progress import format_number
-from packageSack import packagesNewestByNameArch, ListPackageSack
+from packageSack import packagesNewestByName, ListPackageSack
 import depsolve
 import plugins
 import logginglevels
@@ -2329,7 +2329,7 @@ class YumBase(depsolve.Depsolve):
                                         use.append(pkg)
                                 pkgs = use
                                
-                        pkgs = packagesNewestByNameArch(pkgs)
+                        pkgs = packagesNewestByName(pkgs)
 
                         if not self.tsInfo.conditionals.has_key(cond):
                             self.tsInfo.conditionals[cond] = []
@@ -2772,7 +2772,7 @@ class YumBase(depsolve.Depsolve):
                            
                             pkgs = use
                            
-                pkgs = packagesNewestByNameArch(pkgs)
+                pkgs = packagesNewestByName(pkgs)
 
                 pkgbyname = {}
                 for pkg in pkgs:
@@ -3087,7 +3087,7 @@ class YumBase(depsolve.Depsolve):
                 # This is done so we don't have to returnObsoletes(newest=True)
                 # It's a minor UI problem for RHEL, but might as well dtrt.
                 obs_pkgs = [self.getPackageObject(tup) for tup in obs_tups]
-                for obsoleting_pkg in packagesNewestByNameArch(obs_pkgs):
+                for obsoleting_pkg in packagesNewestByName(obs_pkgs):
                     tx_return.extend(self.install(po=obsoleting_pkg))
             for available_pkg in availpkgs:
                 for obsoleted in self.up.obsoleting_dict.get(available_pkg.pkgtup, []):
diff --git a/yum/packageSack.py b/yum/packageSack.py
index 7f563dc..1e99661 100644
--- a/yum/packageSack.py
+++ b/yum/packageSack.py
@@ -233,7 +233,9 @@ class PackageSackBase(object):
     def returnNewestByName(self, name=None, patterns=None, ignore_case=False):
         """return list of newest packages based on name matching
            this means(in name.arch form): foo.i386 and foo.noarch will
-           be compared to each other for highest version"""
+           be compared to each other for highest version.
+           Note that given: foo-1.i386; foo-2.i386 and foo-3.x86_64
+           The last _two_ pkgs will be returned, not just one of them. """
         raise NotImplementedError()
 
     def simplePkgList(self, patterns=None, ignore_case=False):
@@ -507,7 +509,9 @@ class MetaSack(PackageSackBase):
     def returnNewestByName(self, name=None, patterns=None, ignore_case=False):
         """return list of newest packages based on name matching
            this means(in name.arch form): foo.i386 and foo.noarch will
-           be compared to each other for highest version"""
+           be compared to each other for highest version.
+           Note that given: foo-1.i386; foo-2.i386 and foo-3.x86_64
+           The last _two_ pkgs will be returned, not just one of them. """
         pkgs = self._computeAggregateListResult("returnNewestByName", name,
                                                 patterns, ignore_case)
         pkgs = packagesNewestByName(pkgs)
@@ -912,7 +916,10 @@ class PackageSack(PackageSackBase):
     def returnNewestByName(self, name=None, patterns=None, ignore_case=False):
         """return list of newest packages based on name matching
            this means(in name.arch form): foo.i386 and foo.noarch will
-           be compared to each other for highest version"""
+           be compared to each other for highest version.
+           Note that given: foo-1.i386; foo-2.i386 and foo-3.x86_64
+           The last _two_ pkgs will be returned, not just one of them. """
+
         highdict = {}
         for pkg in self.returnPackages(patterns=patterns,
                                        ignore_case=ignore_case):
@@ -975,7 +982,9 @@ class PackageSack(PackageSackBase):
         return matches
 
 def packagesNewestByName(pkgs):
-    """ Does the same as PackageSack.returnNewestByName() """
+    """ Does the same as PackageSack.returnNewestByName().
+        Note that given: foo-1.i386; foo-2.i386 and foo-3.x86_64
+        The last _two_ pkgs will be returned, not just one of them. """
     newest = {}
     for pkg in pkgs:
         key = pkg.name
diff --git a/yum/sqlitesack.py b/yum/sqlitesack.py
index 7b8d202..e249c26 100644
--- a/yum/sqlitesack.py
+++ b/yum/sqlitesack.py
@@ -1426,6 +1426,11 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack):
 
     @catchSqliteException
     def returnNewestByName(self, name=None, patterns=None, ignore_case=False):
+        """return list of newest packages based on name matching
+           this means(in name.arch form): foo.i386 and foo.noarch will
+           be compared to each other for highest version.
+           Note that given: foo-1.i386; foo-2.i386 and foo-3.x86_64
+           The last _two_ pkgs will be returned, not just one of them. """
         # If name is set do it from the database otherwise use our parent's
         # returnNewestByName
         if self._skip_all():
-- 
1.6.5.2



More information about the Yum-devel mailing list