mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-11 16:36:14 +01:00
added support for multibuild / locallink feature
new option -m shows all subpackages and results of the subpackages.
This commit is contained in:
parent
22d91a1064
commit
665d2bda72
@ -4977,6 +4977,10 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
help='Show results only for specified architecture(s)')
|
||||
@cmdln.option('-v', '--verbose', action='store_true', default=False,
|
||||
help='more verbose output')
|
||||
@cmdln.option('-m', '--multibuild', action='store_true', default=False,
|
||||
help='Show results for all packages in multibuild')
|
||||
@cmdln.option('-M', '--multibuild-package', action='append', default=[],
|
||||
help='Only show results for the specified multibuild package')
|
||||
@cmdln.option('-w', '--watch', action='store_true', default=False,
|
||||
help='watch the results until all finished building')
|
||||
@cmdln.option('', '--xml', action='store_true', default=False,
|
||||
@ -5035,6 +5039,10 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
kwargs = {'apiurl': apiurl, 'project': project, 'package': package,
|
||||
'lastbuild': opts.last_build, 'repository': opts.repo,
|
||||
'arch': opts.arch, 'wait': opts.watch}
|
||||
if opts.multibuild_package:
|
||||
opts.multibuild = True
|
||||
kwargs['multibuild_packages'] = opts.multibuild_package
|
||||
kwargs['multibuild'] = kwargs['locallink'] = opts.multibuild
|
||||
if opts.xml or opts.csv:
|
||||
for xml in get_package_results(**kwargs):
|
||||
if opts.xml:
|
||||
|
40
osc/core.py
40
osc/core.py
@ -5434,7 +5434,7 @@ def get_binarylist_published(apiurl, prj, repo, arch):
|
||||
return r
|
||||
|
||||
|
||||
def show_results_meta(apiurl, prj, package=None, lastbuild=None, repository=[], arch=[], oldstate=None):
|
||||
def show_results_meta(apiurl, prj, package=None, lastbuild=None, repository=[], arch=[], oldstate=None, multibuild=False, locallink=False):
|
||||
query = {}
|
||||
if package:
|
||||
query['package'] = package
|
||||
@ -5442,6 +5442,10 @@ def show_results_meta(apiurl, prj, package=None, lastbuild=None, repository=[],
|
||||
query['oldstate'] = oldstate
|
||||
if lastbuild:
|
||||
query['lastbuild'] = 1
|
||||
if multibuild:
|
||||
query['multibuild'] = 1
|
||||
if locallink:
|
||||
query['locallink'] = 1
|
||||
u = makeurl(apiurl, ['build', prj, '_result'], query=query)
|
||||
for repo in repository:
|
||||
u = u + '&repository=%s' % repo
|
||||
@ -5461,32 +5465,29 @@ def result_xml_to_dicts(xml):
|
||||
# assumption: xml contains at most one status element (maybe we should
|
||||
# generalize this to arbitrary status element)
|
||||
root = ET.fromstring(xml)
|
||||
r = []
|
||||
for node in root.findall('result'):
|
||||
rmap = {}
|
||||
rmap['project'] = rmap['prj'] = node.get('project')
|
||||
rmap['repository'] = rmap['repo'] = rmap['rep'] = node.get('repository')
|
||||
rmap['arch'] = node.get('arch')
|
||||
rmap['state'] = node.get('state')
|
||||
rmap['dirty'] = node.get('dirty')
|
||||
rmap['dirty'] = node.get('dirty') == 'true'
|
||||
rmap['repostate'] = node.get('code')
|
||||
rmap['pkg'] = rmap['package'] = rmap['pac'] = ''
|
||||
rmap['code'] = node.get('code')
|
||||
rmap['details'] = ''
|
||||
details = None
|
||||
statusnode = node.find('status')
|
||||
if statusnode is not None:
|
||||
# the way currently use this function, there should be
|
||||
# the way we currently use this function, there should be
|
||||
# always a status element
|
||||
rmap['pkg'] = rmap['package'] = rmap['pac'] = statusnode.get('package')
|
||||
rmap['code'] = statusnode.get('code', '')
|
||||
snodes = node.findall('status')
|
||||
is_multi = len(snodes) > 1
|
||||
for statusnode in snodes:
|
||||
smap = dict(rmap)
|
||||
smap['pkg'] = smap['package'] = smap['pac'] = statusnode.get('package')
|
||||
smap['code'] = statusnode.get('code', '')
|
||||
details = statusnode.find('details')
|
||||
if details is not None:
|
||||
rmap['details'] = details.text
|
||||
rmap['dirty'] = rmap['dirty'] == 'true'
|
||||
|
||||
r.append(rmap)
|
||||
return r
|
||||
smap['details'] = details.text
|
||||
yield smap, is_multi
|
||||
|
||||
|
||||
def format_results(results, format):
|
||||
@ -5500,14 +5501,20 @@ def get_results(apiurl, project, package, verbose=False, printJoin='', *args, **
|
||||
# get_package_results_human would be better, but this would break the existing
|
||||
# api (unless we keep get_results around as well)...
|
||||
result_line_templ = '%(rep)-20s %(arch)-10s %(status)s'
|
||||
result_line_mb_templ = '%(rep)-20s %(arch)-10s %(pkg)-30s %(status)s'
|
||||
r = []
|
||||
printed = False
|
||||
multibuild_packages = kwargs.pop('multibuild_packages', [])
|
||||
for results in get_package_results(apiurl, project, package, **kwargs):
|
||||
r = []
|
||||
for res in result_xml_to_dicts(results):
|
||||
for res, is_multi in result_xml_to_dicts(results):
|
||||
if '_oldstate' in res:
|
||||
oldstate = res['_oldstate']
|
||||
continue
|
||||
if multibuild_packages:
|
||||
l = res['pkg'].rsplit(':', 1)
|
||||
if len(l) != 2 or l[1] not in multibuild_packages:
|
||||
continue
|
||||
res['status'] = res['code']
|
||||
if verbose and res['details'] != '':
|
||||
if res['code'] in ('unresolvable', 'expansion error'):
|
||||
@ -5529,6 +5536,9 @@ def get_results(apiurl, project, package, verbose=False, printJoin='', *args, **
|
||||
else:
|
||||
res['status'] += '*'
|
||||
|
||||
if is_multi:
|
||||
r.append(result_line_mb_templ % res)
|
||||
else:
|
||||
r.append(result_line_templ % res)
|
||||
|
||||
if printJoin:
|
||||
|
Loading…
Reference in New Issue
Block a user