[yum-commits] Branch 'yum-3_2_X' - 2 commits - rpmUtils/arch.py yum/depsolve.py yum/__init__.py yum/rpmsack.py yum/sqlitesack.py

skvidal at osuosl.org skvidal at osuosl.org
Thu Mar 12 05:36:00 UTC 2009


 rpmUtils/arch.py  |   20 +++++++++++++++++++-
 yum/__init__.py   |    3 ++-
 yum/depsolve.py   |   23 ++++++++++++-----------
 yum/rpmsack.py    |    2 +-
 yum/sqlitesack.py |   11 +++++++----
 5 files changed, 41 insertions(+), 18 deletions(-)

New commits:
commit 354f6cd296bb9b18d536f47b65e6f1f9412652c3
Merge: f7c1165... d8c8e83...
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Thu Mar 12 01:34:45 2009 -0400

    Merge branch 'yum-3_2_X' of ssh://yum.baseurl.org/srv/projects/yum/git/yum into yum-3_2_X
    
    * 'yum-3_2_X' of ssh://yum.baseurl.org/srv/projects/yum/git/yum:
      Speedup RepoConf.iterkeys() as we call it "a lot" - 20% speedup
      Convert to RawConfigParser from iniparse, as we don't use %blah 5-10%
      Remove exceptions from options processing, saves 5-10% noop

commit f7c1165badc3a10cf331c234fa797896c4aa3b7e
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Thu Mar 12 01:33:37 2009 -0400

    depsolving catch to fix 488224
    unicode handling catch to fix 487912

diff --git a/rpmUtils/arch.py b/rpmUtils/arch.py
index fb59ad4..e3a036e 100644
--- a/rpmUtils/arch.py
+++ b/rpmUtils/arch.py
@@ -88,7 +88,25 @@ def legitMultiArchesInSameLib(arch=None):
     return results        
 
 
-
+def canCoinstall(arch1, arch2):
+    """Take two arches and return True if it is possible that they can be
+       installed together with the same nevr. Ex: arch1=i386 and arch2=i686 then
+       it will return False. arch1=i386 and arch2=x86_64 will return True.
+       It does not determine whether or not the arches make any sense. Just whether
+       they could possibly install w/o conflict"""
+
+    # if both are a multlibarch then we can't coinstall  (x86_64, ia32e)
+    # if both are not multilibarches then we can't coinstall (i386, i686)
+    
+    if 'noarch' in [arch1, arch2]: # noarch can never coinstall
+        return False
+
+    if isMultiLibArch(arch=arch1) == isMultiLibArch(arch=arch2):
+        return False
+    # this section keeps arch1=x86_64 arch2=ppc from returning True
+    if arch1 in getArchList(arch2) or arch2 in getArchList(arch1):
+        return True
+    return False
 
 # this computes the difference between myarch and targetarch
 def archDifference(myarch, targetarch):
diff --git a/yum/__init__.py b/yum/__init__.py
index a7ea490..cf6bfc0 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -1848,6 +1848,7 @@ class YumBase(depsolve.Depsolve):
         
         matches = {}
         for arg in args:
+            arg = to_unicode(arg)
             if not misc.re_glob(arg):
                 isglob = False
                 if arg[0] != '/':
@@ -1921,7 +1922,7 @@ class YumBase(depsolve.Depsolve):
                 usedDepString = True
                 for po in where:
                     tmpvalues = []
-                    msg = _('Provides-match: %s') % arg
+                    msg = _('Provides-match: %s') % to_unicode(arg)
                     tmpvalues.append(msg)
 
                     if len(tmpvalues) > 0:
diff --git a/yum/depsolve.py b/yum/depsolve.py
index 9024957..26fb2c2 100644
--- a/yum/depsolve.py
+++ b/yum/depsolve.py
@@ -25,7 +25,7 @@ import logging
 import rpmUtils.transaction
 import rpmUtils.miscutils
 import rpmUtils.arch
-from rpmUtils.arch import archDifference, isMultiLibArch, getBestArch
+from rpmUtils.arch import archDifference, isMultiLibArch, getBestArch, canCoinstall
 import misc
 from misc import unique, version_tuple_to_string
 import rpm
@@ -489,20 +489,21 @@ class Depsolve(object):
             tspkgs = []
             if not self.allowedMultipleInstalls(pkg):
                 # from ts
-                tspkgs = self.tsInfo.matchNaevr(name=pkg.name, arch=pkg.arch)
+                tspkgs = self.tsInfo.matchNaevr(name=pkg.name)
                 for tspkg in tspkgs:
-                    if tspkg.po.verGT(pkg):
-                        msg = _('Potential resolving package %s has newer instance in ts.') % pkg
-                        self.verbose_logger.log(logginglevels.DEBUG_2, msg)
-                        provSack.delPackage(pkg)
-                        continue
-                    elif tspkg.po.verLT(pkg):
-                        upgraded.setdefault(pkg.pkgtup, []).append(tspkg.pkgtup)
+                    if not canCoinstall(pkg.arch, tspkg.po.arch): # a comparable arch
+                        if tspkg.po.verGT(pkg):
+                            msg = _('Potential resolving package %s has newer instance in ts.') % pkg
+                            self.verbose_logger.log(logginglevels.DEBUG_2, msg)
+                            provSack.delPackage(pkg)
+                            continue
+                        elif tspkg.po.verLT(pkg):
+                            upgraded.setdefault(pkg.pkgtup, []).append(tspkg.pkgtup)
                 
                 # from rpmdb
-                dbpkgs = self.rpmdb.searchNevra(name=pkg.name, arch=pkg.arch)
+                dbpkgs = self.rpmdb.searchNevra(name=pkg.name)
                 for dbpkg in dbpkgs:
-                    if dbpkg.verGT(pkg):
+                    if dbpkg.verGT(pkg) and not canCoinstall(pkg.arch, tspkg.arch):
                         msg = _('Potential resolving package %s has newer instance installed.') % pkg
                         self.verbose_logger.log(logginglevels.DEBUG_2, msg)
                         provSack.delPackage(pkg)
diff --git a/yum/rpmsack.py b/yum/rpmsack.py
index c9a6d81..171ae92 100644
--- a/yum/rpmsack.py
+++ b/yum/rpmsack.py
@@ -207,7 +207,7 @@ class RPMDBPackageSack(PackageSackBase):
         ts = self.readOnlyTS()
         result = {}
         tag = self.DEP_TABLE[prcotype][0]
-        mi = ts.dbMatch(tag, name)
+        mi = ts.dbMatch(tag, misc.to_utf8(name))
         for hdr in mi:
             po = self._makePackageObject(hdr, mi.instance())
             result[po.pkgid] = po
diff --git a/yum/sqlitesack.py b/yum/sqlitesack.py
index aa9fec4..07f402b 100644
--- a/yum/sqlitesack.py
+++ b/yum/sqlitesack.py
@@ -34,7 +34,7 @@ import sqlutils
 import constants
 import operator
 import time
-from yum.misc import seq_max_split, to_utf8
+from yum.misc import seq_max_split, to_utf8, to_unicode
 import sys
 
 def catchSqliteException(func):
@@ -769,9 +769,11 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack):
 
     @catchSqliteException
     def _search(self, prcotype, name, flags, version):
+
         if self._skip_all():
             return {}
-
+        
+        name = to_unicode(name)
         if flags == 0:
             flags = None
         if type(version) in (str, type(None), unicode):
@@ -883,7 +885,7 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack):
         
         if self._skip_all():
             return []
-
+        
         returnList = []
         max_entries = constants.PATTERNS_INDEXED_MAX
         if len(names) > max_entries:
@@ -911,7 +913,8 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack):
         """return list of packages having prcotype name (any evr and flag)"""
         if self._skip_all():
             return []
-
+        
+        name = to_unicode(name)
         glob = True
         querytype = 'glob'
         if not misc.re_glob(name):


More information about the Yum-commits mailing list