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)')
|
help='Show results only for specified architecture(s)')
|
||||||
@cmdln.option('-v', '--verbose', action='store_true', default=False,
|
@cmdln.option('-v', '--verbose', action='store_true', default=False,
|
||||||
help='more verbose output')
|
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,
|
@cmdln.option('-w', '--watch', action='store_true', default=False,
|
||||||
help='watch the results until all finished building')
|
help='watch the results until all finished building')
|
||||||
@cmdln.option('', '--xml', action='store_true', default=False,
|
@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,
|
kwargs = {'apiurl': apiurl, 'project': project, 'package': package,
|
||||||
'lastbuild': opts.last_build, 'repository': opts.repo,
|
'lastbuild': opts.last_build, 'repository': opts.repo,
|
||||||
'arch': opts.arch, 'wait': opts.watch}
|
'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:
|
if opts.xml or opts.csv:
|
||||||
for xml in get_package_results(**kwargs):
|
for xml in get_package_results(**kwargs):
|
||||||
if opts.xml:
|
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
|
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 = {}
|
query = {}
|
||||||
if package:
|
if package:
|
||||||
query['package'] = package
|
query['package'] = package
|
||||||
@ -5442,6 +5442,10 @@ def show_results_meta(apiurl, prj, package=None, lastbuild=None, repository=[],
|
|||||||
query['oldstate'] = oldstate
|
query['oldstate'] = oldstate
|
||||||
if lastbuild:
|
if lastbuild:
|
||||||
query['lastbuild'] = 1
|
query['lastbuild'] = 1
|
||||||
|
if multibuild:
|
||||||
|
query['multibuild'] = 1
|
||||||
|
if locallink:
|
||||||
|
query['locallink'] = 1
|
||||||
u = makeurl(apiurl, ['build', prj, '_result'], query=query)
|
u = makeurl(apiurl, ['build', prj, '_result'], query=query)
|
||||||
for repo in repository:
|
for repo in repository:
|
||||||
u = u + '&repository=%s' % repo
|
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
|
# assumption: xml contains at most one status element (maybe we should
|
||||||
# generalize this to arbitrary status element)
|
# generalize this to arbitrary status element)
|
||||||
root = ET.fromstring(xml)
|
root = ET.fromstring(xml)
|
||||||
r = []
|
|
||||||
for node in root.findall('result'):
|
for node in root.findall('result'):
|
||||||
rmap = {}
|
rmap = {}
|
||||||
rmap['project'] = rmap['prj'] = node.get('project')
|
rmap['project'] = rmap['prj'] = node.get('project')
|
||||||
rmap['repository'] = rmap['repo'] = rmap['rep'] = node.get('repository')
|
rmap['repository'] = rmap['repo'] = rmap['rep'] = node.get('repository')
|
||||||
rmap['arch'] = node.get('arch')
|
rmap['arch'] = node.get('arch')
|
||||||
rmap['state'] = node.get('state')
|
rmap['state'] = node.get('state')
|
||||||
rmap['dirty'] = node.get('dirty')
|
rmap['dirty'] = node.get('dirty') == 'true'
|
||||||
rmap['repostate'] = node.get('code')
|
rmap['repostate'] = node.get('code')
|
||||||
rmap['pkg'] = rmap['package'] = rmap['pac'] = ''
|
rmap['pkg'] = rmap['package'] = rmap['pac'] = ''
|
||||||
rmap['code'] = node.get('code')
|
rmap['code'] = node.get('code')
|
||||||
rmap['details'] = ''
|
rmap['details'] = ''
|
||||||
details = None
|
# the way we currently use this function, there should be
|
||||||
statusnode = node.find('status')
|
|
||||||
if statusnode is not None:
|
|
||||||
# the way currently use this function, there should be
|
|
||||||
# always a status element
|
# always a status element
|
||||||
rmap['pkg'] = rmap['package'] = rmap['pac'] = statusnode.get('package')
|
snodes = node.findall('status')
|
||||||
rmap['code'] = statusnode.get('code', '')
|
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')
|
details = statusnode.find('details')
|
||||||
if details is not None:
|
if details is not None:
|
||||||
rmap['details'] = details.text
|
smap['details'] = details.text
|
||||||
rmap['dirty'] = rmap['dirty'] == 'true'
|
yield smap, is_multi
|
||||||
|
|
||||||
r.append(rmap)
|
|
||||||
return r
|
|
||||||
|
|
||||||
|
|
||||||
def format_results(results, format):
|
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
|
# get_package_results_human would be better, but this would break the existing
|
||||||
# api (unless we keep get_results around as well)...
|
# api (unless we keep get_results around as well)...
|
||||||
result_line_templ = '%(rep)-20s %(arch)-10s %(status)s'
|
result_line_templ = '%(rep)-20s %(arch)-10s %(status)s'
|
||||||
|
result_line_mb_templ = '%(rep)-20s %(arch)-10s %(pkg)-30s %(status)s'
|
||||||
r = []
|
r = []
|
||||||
printed = False
|
printed = False
|
||||||
|
multibuild_packages = kwargs.pop('multibuild_packages', [])
|
||||||
for results in get_package_results(apiurl, project, package, **kwargs):
|
for results in get_package_results(apiurl, project, package, **kwargs):
|
||||||
r = []
|
r = []
|
||||||
for res in result_xml_to_dicts(results):
|
for res, is_multi in result_xml_to_dicts(results):
|
||||||
if '_oldstate' in res:
|
if '_oldstate' in res:
|
||||||
oldstate = res['_oldstate']
|
oldstate = res['_oldstate']
|
||||||
continue
|
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']
|
res['status'] = res['code']
|
||||||
if verbose and res['details'] != '':
|
if verbose and res['details'] != '':
|
||||||
if res['code'] in ('unresolvable', 'expansion error'):
|
if res['code'] in ('unresolvable', 'expansion error'):
|
||||||
@ -5529,6 +5536,9 @@ def get_results(apiurl, project, package, verbose=False, printJoin='', *args, **
|
|||||||
else:
|
else:
|
||||||
res['status'] += '*'
|
res['status'] += '*'
|
||||||
|
|
||||||
|
if is_multi:
|
||||||
|
r.append(result_line_mb_templ % res)
|
||||||
|
else:
|
||||||
r.append(result_line_templ % res)
|
r.append(result_line_templ % res)
|
||||||
|
|
||||||
if printJoin:
|
if printJoin:
|
||||||
|
Loading…
Reference in New Issue
Block a user