1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-13 17:16:23 +01:00

less verbose results output by default

especially factoy results often fill the screen with lots of "blocked" errors. So don't display the details by default unless --verbose is given
This commit is contained in:
Ludwig Nussel 2010-05-06 14:23:27 +02:00
parent 14d4ece2fb
commit cd51a420d7
2 changed files with 19 additions and 14 deletions

View File

@ -3207,6 +3207,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
help='Show results only for specified repo(s)')
@cmdln.option('-a', '--arch', action='append', default = [],
help='Show results only for specified architecture(s)')
@cmdln.option('-v', '--verbose', action='store_true', default=False,
help='more verbose output')
@cmdln.option('', '--xml', action='store_true', default=False,
help='generate output in XML (former results_meta)')
@cmdln.option('', '--csv', action='store_true', default=False,
@ -3254,19 +3256,14 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if opts.xml and opts.csv:
raise oscerr.WrongOptions("--xml and --csv are mutual exclusive")
args = [ apiurl, project, package, opts.last_build, opts.repo, opts.arch ]
if opts.xml:
func = show_results_meta
delim = ''
return show_results_meta(*args)
elif opts.csv:
def _func(*args):
return format_results(get_package_results(*args), opts.format)
func = _func
delim = '\n'
return '\n'.join(format_results(get_package_results(*args), opts.format))
else:
func = get_results
delim = '\n'
print delim.join(func(apiurl, project, package, opts.last_build, opts.repo, opts.arch))
args.append(opts.verbose)
return '\n'.join(get_results(*args))
# WARNING: this function is also called by do_results. You need to set a default there
# as well when adding a new option!

View File

@ -3737,16 +3737,24 @@ def format_results(results, format):
"""apply selected format on each dict in results and return it as a list of strings"""
return [format % r for r in results]
def get_results(apiurl, prj, package, lastbuild=None, repository=[], arch=[]):
def get_results(apiurl, prj, package, lastbuild=None, repository=[], arch=[], verbose=False):
r = []
result_line_templ = '%(rep)-20s %(arch)-10s %(status)s'
for res in get_package_results(apiurl, prj, package, lastbuild, repository, arch):
res['status'] = res['code']
if res['details'] != '':
res['status'] += ': %s' % (res['details'], )
if verbose and res['details'] != '':
if res['status'] in ('unresolvable', 'expansion error'):
lines = res['details'].split(',')
res['status'] += ': ' + '\n '.join(lines)
else:
res['status'] += ': %s' % (res['details'], )
if res['dirty']:
res['status'] = 'state is outdated (was: %s)' % res['status']
if verbose:
res['status'] = 'state is outdated (was: %s)' % res['status']
else:
res['status'] += '*'
r.append(result_line_templ % res)