repos: Store platform word size in a special repo field

This commit is contained in:
Ivan A. Melnikov 2021-09-03 18:15:20 +04:00
parent 18f0d27ffa
commit c658864543

View File

@ -127,17 +127,22 @@ class Binary:
class Repository:
def __init__(self, repo_name, sources, binaries):
def __init__(self, repo_name, sources, binaries, bits=None):
self.name = repo_name
self.sources = sources
self.binaries = binaries
if bits is not None:
self.bits = bits
else:
self.bits = 64 if ('64' in self.name) else 32
self.reverse_prov = {} # name -> [(provide, binary)]
self.update_indexes()
def copy(self, new_name):
return Repository(new_name,
dict(self.sources),
dict(self.binaries))
dict(self.binaries),
self.bits)
def update_indexes(self):
rprov = collections.defaultdict(list)
@ -242,7 +247,8 @@ def _raw_build_report(from_repo, to_repo, source_name):
result = set()
srpm = from_repo.sources[source_name]
# XXX: assumes from_repo is x86_64
translate = '64' not in to_repo.name
assert from_repo.bits == 64
translate = (to_repo.bits != 64)
missing_buidreqs = (dep for dep in srpm.requires
if not any(to_repo.providers(dep)))
@ -361,4 +367,5 @@ if __name__ == '__main__':
CONFIG = interactive_setup()
riscv64 = Repository.load_from_config('sisyphus_riscv64', CONFIG)
x86_64 = Repository.load_from_config('sisyphus', CONFIG)
x86_64.bits = 64
mipsel = Repository.load_from_config('sisyphus_mipsel', CONFIG)