Fix handling of noarch and 32 vs 64 arch problems

This commit is contained in:
Denis Silakov 2014-02-27 06:23:55 -05:00
parent 23fc962440
commit 136621e4b8

View file

@ -158,7 +158,7 @@ class NEVR(object):
@staticmethod @staticmethod
def from_filename(rpmname, E=None): def from_filename(rpmname, E=None):
''' Returns [name, version] for given rpm file or package name ''' ''' Returns [name, version] for given rpm file or package name '''
suffix = ['.x86_64', '.noarch'] + ['.i%s86' % i for i in range(3,6)] suffix = ['.x86_64', '.noarch', '.i386', '.i486', '.i586', '.i686']
for s in suffix: for s in suffix:
if(rpmname.endswith(s)): if(rpmname.endswith(s)):
rpmname = rpmname[:-len(s)] rpmname = rpmname[:-len(s)]
@ -322,7 +322,7 @@ class PackageSet:
global fields global fields
fields = {"provides":[], "requires":[], "obsoletes":[], "suggests":[], fields = {"provides":[], "requires":[], "obsoletes":[], "suggests":[],
"conflicts":[], "info":[], "summary":[]} "conflicts":[], "info":[], "summary":[]}
arches32 = ['i%d86' for i in range(3,6)] arches32 = ['i386', 'i486', 'i586', 'i686']
for tag in PackageSet.tags: for tag in PackageSet.tags:
self.what[tag] = {} self.what[tag] = {}
@ -348,7 +348,7 @@ class PackageSet:
shutil.rmtree(tmppath) shutil.rmtree(tmppath)
elif(synthesis_list.startswith("/")): #local file elif(synthesis_list.startswith("/")): #local file
if not os.path.exists(synthesis_list): if not os.path.exists(synthesis_list):
eprint(_('Could not read synthesis file. (File %s not found)') % synthesis_list) print(_('Could not read synthesis file. (File %s not found)') % synthesis_list)
continue continue
r = open(synthesis_list) r = open(synthesis_list)
s = r.read() s = r.read()
@ -379,11 +379,11 @@ class PackageSet:
nevr.DE = items[7] nevr.DE = items[7]
arch = items[2].split('.')[-1] arch = items[2].split('.')[-1]
if arch in arches32 and ARCH in arches: if arch in arches32 and ARCH in arches32:
arch = ARCH arch = ARCH
in_repo = nevr.N in self.packages in_repo = nevr.N in self.packages
new_arch_correct = (arch == ARCH or arch == 'noarch' or ARCH == 'noarch') new_arch_correct = (arch == ARCH or arch == 'noarch')
if in_repo: if in_repo:
if nevr.DE == self.packages[nevr.N]['nevr'].DE: if nevr.DE == self.packages[nevr.N]['nevr'].DE:
@ -391,7 +391,7 @@ class PackageSet:
else: else:
ver_newer = (nevr.DE > self.packages[nevr.N]['nevr'].DE) ver_newer = (nevr.DE > self.packages[nevr.N]['nevr'].DE)
old_arch_correct = (self.packages[nevr.N]['arch'] == ARCH or self.packages[nevr.N]['arch'] == 'noarch' or ARCH == 'noarch') old_arch_correct = (self.packages[nevr.N]['arch'] == ARCH or self.packages[nevr.N]['arch'] == 'noarch')
else: else:
ver_newer = None ver_newer = None
old_arch_correct = None old_arch_correct = None
@ -427,7 +427,7 @@ class PackageSet:
self.packages[nevr.N]['medium'] = medium_by_synth[synthesis_list] self.packages[nevr.N]['medium'] = medium_by_synth[synthesis_list]
clear_data() clear_data()
except (HTTPError,URLError): except (HTTPError,URLError):
eprint(_("File can not be processed! Url: ") + synthesis_list) print(_("File can not be processed! Url: ") + synthesis_list)
def whattag(self, tag, val): def whattag(self, tag, val):