Don't hardcode architectures - take it from the project

This commit is contained in:
Stephan Kulow 2019-01-16 10:32:09 +01:00
parent 3d387a5829
commit 1bae4083b2
3 changed files with 13 additions and 16 deletions

View File

@ -92,10 +92,6 @@ class CommandLineInterface(ToolBase.CommandLineInterface):
api = StagingAPI(apiurl, target_project)
archs_key = 'pkglistgen-archs'
if archs_key in target_config:
self.options.architectures = target_config.get(archs_key).split(' ')
main_repo = target_config['main-repo']
if apiurl.find('suse.de') > 0:

View File

@ -8,15 +8,13 @@ from lxml import etree as ET
import solv
ARCHITECTURES = ['x86_64', 'ppc64le', 's390x', 'aarch64']
class Group(object):
def __init__(self, name, pkglist):
self.name = name
self.safe_name = re.sub(r'\W', '_', name.lower())
self.pkglist = pkglist
self.architectures = pkglist.architectures
self.architectures = pkglist.all_architectures
self.conditional = None
self.packages = dict()
self.locked = set()
@ -25,7 +23,7 @@ class Group(object):
self.not_found = dict()
self.unresolvable = dict()
self.default_support_status = None
for a in ARCHITECTURES:
for a in self.architectures:
self.packages[a] = []
self.unresolvable[a] = dict()
@ -120,6 +118,7 @@ class Group(object):
self.srcpkgs = dict()
self.recommends = dict()
self.suggested = dict()
for arch in self.pkglist.filtered_architectures:
pool = self.pkglist._prepare_pool(arch)
solver = pool.Solver()
@ -182,6 +181,7 @@ class Group(object):
if n in self.expand_suggested:
for s in solver.get_suggested():
suggested[s.name] = group + ':suggested:' + n
self.suggested.setdefault(s.name, suggested[s.name])
trans = solver.transaction()
if trans.isempty():

View File

@ -34,7 +34,7 @@ except ImportError:
from urlparse import urlparse
from pkglistgen import file_utils, solv_utils
from pkglistgen.group import Group, ARCHITECTURES
from pkglistgen.group import Group
SCRIPT_PATH = os.path.dirname(os.path.realpath(__file__))
@ -59,10 +59,10 @@ class PkgListGen(ToolBase.ToolBase):
self.logger = logging.getLogger(__name__)
self.filtered_architectures = None
self.dry_run = False
self.architectures = ARCHITECTURES
self.all_architectures = None
def filter_architectures(self, architectures):
self.filtered_architectures = list(set(architectures) & set(self.architectures))
self.filtered_architectures = list(set(architectures) & set(self.all_architectures))
def _load_supportstatus(self):
# XXX
@ -110,7 +110,7 @@ class PkgListGen(ToolBase.ToolBase):
# required to generate release spec files (only)
def write_group_stubs(self):
archs = ['*'] + self.architectures
archs = ['*'] + self.all_architectures
for name in self.groups:
group = self.groups[name]
group.solved_packages = dict()
@ -124,7 +124,7 @@ class PkgListGen(ToolBase.ToolBase):
def write_all_groups(self):
self._check_supplements()
summary = dict()
archs = ['*'] + self.architectures
archs = ['*'] + self.all_architectures
for name in self.groups:
group = self.groups[name]
if not group.solved:
@ -373,10 +373,10 @@ class PkgListGen(ToolBase.ToolBase):
for prj in list(oldprjs) + [target]:
self.repos += self.expand_repos(prj, 'standard')
self.update_repos(self.architectures)
self.update_repos(self.all_architectures)
drops = dict()
for arch in self.architectures:
for arch in self.all_architectures:
pool = solv.Pool()
pool.setarch(arch)
@ -423,7 +423,7 @@ class PkgListGen(ToolBase.ToolBase):
if drops[name]['repo'] != '{}/{}'.format(project, repo):
#print(drops[name]['repo'], '!=', '{}/{}'.format(project, repo))
continue
if len(drops[name]['archs']) == len(self.architectures):
if len(drops[name]['archs']) == len(self.all_architectures):
print('Provides: weakremover({})'.format(name))
else:
jarch = ' '.join(sorted(drops[name]['archs']))
@ -587,6 +587,7 @@ class PkgListGen(ToolBase.ToolBase):
def update_and_solve_target(self, api, target_project, target_config, main_repo,
project, scope, force, no_checkout,
only_release_packages, stop_after_solve, drop_list=False):
self.all_architectures = target_config.get('pkglistgen-archs').split(' ')
self.repos = self.expand_repos(project, main_repo)
print('[{}] {}/{}: update and solve'.format(scope, project, main_repo))