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/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)