=== modified file 'smart/backends/rpm/base.py' --- smart/backends/rpm/base.py 2009-03-04 23:05:40 +0000 +++ smart/backends/rpm/base.py 2010-05-30 08:32:04 +0000 @@ -41,8 +41,6 @@ traceback.print_exc() raise Error, _("'rpm' python module is not available") -archscore = rpm.archscore - __all__ = ["RPMPackage", "RPMProvides", "RPMNameProvides", "RPMPreRequires", "RPMRequires", "RPMUpgrades", "RPMConflicts", "RPMObsoletes", "rpm", "getTS", "system_provides"] @@ -195,7 +193,7 @@ if selfver != otherver: rc = vercmp(self.version, other.version) if rc == 0: - rc = -cmp(archscore(selfarch), archscore(otherarch)) + rc = -cmp(getArchScore(selfarch), getArchScore(otherarch)) return rc == -1 class RPMProvides(Provides): __slots__ = () @@ -236,6 +234,17 @@ return False return checkdep(prvver, self.relation, selfver) +_SCOREMAP = {} +def getArchScore(arch, _sm=_SCOREMAP): + if arch not in _sm: + if hasattr(rpm, 'platformscore'): + platform = rpm.expandMacro(arch + "-%{_target_vendor}-%{_target_os}%{?_gnu}") + score = rpm.platformscore(platform) + else: + score = rpm.archscore(arch) + _sm[arch] = score + return _sm.get(arch, 0) + # TODO: Embed color into nameprovides and obsoletes relations. _COLORMAP = {"x86_64": 2, "ppc64": 2, "s390x": 2, "sparc64": 2} def getArchColor(arch, _cm=_COLORMAP): === modified file 'smart/backends/rpm/header.py' --- smart/backends/rpm/header.py 2010-02-03 11:47:52 +0000 +++ smart/backends/rpm/header.py 2010-05-29 11:08:39 +0000 @@ -25,6 +25,7 @@ from smart.cache import Loader, PackageInfo from smart.channel import FileChannel from smart.backends.rpm.base import * +from smart.backends.rpm.base import getArchScore from smart.progress import Progress from smart import * import locale @@ -247,7 +248,7 @@ if h[1106]: # RPMTAG_SOURCEPACKAGE continue arch = h[1022] # RPMTAG_ARCH - if rpm.archscore(arch) == 0: + if getArchScore(arch) == 0: continue name = h[1000] # RPMTAG_NAME === modified file 'smart/backends/rpm/metadata.py' --- smart/backends/rpm/metadata.py 2010-03-05 11:40:53 +0000 +++ smart/backends/rpm/metadata.py 2010-05-29 12:54:52 +0000 @@ -22,6 +22,7 @@ # from smart.cache import PackageInfo, Loader from smart.backends.rpm.base import * +from smart.backends.rpm.base import getArchScore try: from xml.etree import cElementTree @@ -190,7 +191,7 @@ skip = None elif tag == ARCH: - if rpm.archscore(elem.text) == 0: + if getArchScore(elem.text) == 0: skip = PACKAGE else: arch = elem.text === modified file 'smart/backends/rpm/redcarpet.py' --- smart/backends/rpm/redcarpet.py 2006-11-07 22:22:46 +0000 +++ smart/backends/rpm/redcarpet.py 2010-05-29 12:55:06 +0000 @@ -21,6 +21,7 @@ # from smart.cache import PackageInfo, Loader from smart.backends.rpm.base import * +from smart.backends.rpm.base import getArchScore from smart import * import posixpath import locale @@ -191,7 +192,7 @@ self._release = data def handleArchEnd(self, name, attrs, data): - if rpm.archscore(data) == 0: + if getArchScore(data) == 0: self._skip = self.PACKAGE else: self._arch = data === modified file 'smart/backends/rpm/synthesis.py' --- smart/backends/rpm/synthesis.py 2006-11-07 22:22:46 +0000 +++ smart/backends/rpm/synthesis.py 2010-05-29 12:55:13 +0000 @@ -25,6 +25,7 @@ from smart.backends.rpm.rpmver import splitarch from smart.cache import PackageInfo, Loader from smart.backends.rpm.base import * +from smart.backends.rpm.base import getArchScore from smart import * import posixpath import os @@ -165,7 +166,7 @@ version, arch = version[:dot], version[dot+1:] versionarch = "@".join((version, arch)) - if rpm.archscore(arch) == 0: + if getArchScore(arch) == 0: continue name = "-".join(rpmnameparts[0:-2]) === modified file 'smart/backends/rpm/yast2.py' --- smart/backends/rpm/yast2.py 2007-10-08 01:42:30 +0000 +++ smart/backends/rpm/yast2.py 2010-05-29 12:55:47 +0000 @@ -22,6 +22,7 @@ from smart.backends.rpm.rpmver import splitarch from smart.cache import PackageInfo, Loader from smart.backends.rpm.base import * +from smart.backends.rpm.base import getArchScore from smart import * import posixpath import locale @@ -188,7 +189,7 @@ raise Error("Error loading YaST2 channel info. Possibly " \ "corrupted file.\n%s" % self._pkginfofile) - if rpm.archscore(arch) <= 0: + if getArchScore(arch) == 0: return name = nameparts[0] self.curpkgname = name