def check_data(self, fpo, code): """see if a package is multilib in the testdata""" if fpo.arch in self.archmap.keys(): # fpo is 64-bit package key32 = '%s.%s' % (fpo.name, self.archmap[fpo.arch]) data = self.packages.has_key(key32) else: # fpo is 32-bit key64 = '%s.%s' % (fpo.name, self.revarchmap[fpo.arch]) data = self.packages.has_key(key64) if data: # Both arches of packages are found, so this could be multilib, # however if a package was brought in because of dependencies and # not because of multilib-ness, we need to consider that and return # False instead for pkg in self.packages.values(): escape = False other_po = fakepo.FakePackageObject(d=pkg) if other_po.name == fpo.name: continue for (p_name, p_flag, (p_e, p_v, p_r)) in fpo.provides: for (r_name, r_flag, (r_e, r_v, r_r)) in other_po.requires: if p_name == r_name: print ' %s requires this (%s)' % (other_po.name, p_name) data = code escape = True break if escape: break if escape: break print ' data says %s' % data return data
def test_yaboot(self): meth = multilib.YabootMultilibMethod(None) for pinfo in self.packages.values(): fpo = fakepo.FakePackageObject(d=pinfo) if fpo.arch == 'ppc' and fpo.name.startswith('yaboot'): self.confirm_true(fpo, meth) else: self.confirm_false(fpo, meth)
def test_file(self): sect = 'multilib' self.list = self.conf.get(sect, 'packages') meth = multilib.FileMultilibMethod(self.conffile) for pinfo in self.packages.values(): fpo = fakepo.FakePackageObject(d=pinfo) for item in meth.list: if fnmatch(fpo.name, item): self.confirm_true(fpo, meth) break self.confirm_false(fpo, meth)
def test_kernel(self): meth = multilib.KernelMultilibMethod(None) for pinfo in self.packages.values(): fpo = fakepo.FakePackageObject(d=pinfo) if fpo.arch.find('64') != -1: if fpo.name.startswith('kernel'): provides = False for (p_name, p_flag, (p_e, p_v, p_r)) in fpo.provides: if p_name == 'kernel' or p_name == 'kernel-devel': provides = True if provides: self.confirm_true(fpo, meth) continue self.confirm_false(fpo, meth)
def test_devel(self): sect = 'devel' wl = self.conf.get(sect, 'white') bl = self.conf.get(sect, 'black') meth = multilib.DevelMultilibMethod() for pinfo in self.packages.values(): fpo = fakepo.FakePackageObject(d=pinfo) if fpo.name in bl: self.confirm_false(fpo, meth, 'Blacklisted, should be False') elif fpo.name in wl: self.confirm_true(fpo, meth, 'Whitelisted, should be True') elif self.do_runtime(fpo, meth): # returns True if a value was identified and asserted # False otherwise pass elif fpo.name.startswith('ghc-'): self.confirm_false(fpo, meth, 'ghc package, should be False') elif fpo.name.startswith('kernel'): # looks redundant, but we're not 64-bit here is_kd, is_dev = False, False for (p_name, p_flag, (p_e, p_v, p_r)) in fpo.provides: if p_name == 'kernel-devel': is_kd = True break if p_name.endswith('-devel') or p_name.endswith('-static'): is_dev = True break if is_kd: self.confirm_false(fpo, meth, 'kernel-devel, should be False') elif is_dev: self.confirm_true(fpo, meth, 'kernel-*-devel, should be True') elif fpo.name.endswith('-devel'): self.confirm_true(fpo, meth, '-devel package, should be True') elif fpo.name.endswith('-static'): self.confirm_true(fpo, meth, '-static package, should be True') else: self.confirm_false(fpo, meth)
def test_runtime(self): meth = multilib.RuntimeMultilibMethod() for pinfo in self.packages.values(): fpo = fakepo.FakePackageObject(d=pinfo) if not self.do_runtime(fpo, meth): self.confirm_false(fpo, meth)
def test_all(self): meth = multilib.AllMultilibMethod(None) for pinfo in self.packages.values(): fpo = fakepo.FakePackageObject(d=pinfo) self.confirm_true(fpo, meth)
def test_no(self): meth = multilib.NoMultilibMethod(None) for pinfo in self.packages.values(): fpo = fakepo.FakePackageObject(d=pinfo) self.confirm_false(fpo, meth)