mirror of
https://github.com/openSUSE/osc.git
synced 2025-08-23 14:48:53 +02:00
- legend in prjresults is default enabled
- added status-filter and name-filter option to prjresults
This commit is contained in:
@@ -1297,10 +1297,15 @@ class Osc(cmdln.Cmdln):
|
|||||||
print '\n'.join(get_results(pac.apiurl, pac.prjname, pac.name))
|
print '\n'.join(get_results(pac.apiurl, pac.prjname, pac.name))
|
||||||
|
|
||||||
|
|
||||||
@cmdln.option('-l', '--legend', action='store_true',
|
@cmdln.option('-q', '--hide-legend', action='store_true',
|
||||||
help='show the legend')
|
help='hide the legend')
|
||||||
@cmdln.option('-c', '--csv', action='store_true',
|
@cmdln.option('-c', '--csv', action='store_true',
|
||||||
help='csv output')
|
help='csv output')
|
||||||
|
@cmdln.option('-s', '--status-filter', metavar='STATUS',
|
||||||
|
help='show only packages with buildstatus STATUS (see legend)')
|
||||||
|
@cmdln.option('-n', '--name-filter', metavar='EXPR',
|
||||||
|
help='show only packages whos name matches EXPR')
|
||||||
|
|
||||||
def do_prjresults(self, subcmd, opts, *args):
|
def do_prjresults(self, subcmd, opts, *args):
|
||||||
"""${cmd_name}: Shows project-wide build results
|
"""${cmd_name}: Shows project-wide build results
|
||||||
|
|
||||||
@@ -1328,7 +1333,7 @@ class Osc(cmdln.Cmdln):
|
|||||||
project = store_read_project(wd)
|
project = store_read_project(wd)
|
||||||
apiurl = store_read_apiurl(wd)
|
apiurl = store_read_apiurl(wd)
|
||||||
|
|
||||||
print '\n'.join(get_prj_results(apiurl, project, show_legend=opts.legend, csv=opts.csv))
|
print '\n'.join(get_prj_results(apiurl, project, hide_legend=opts.hide_legend, csv=opts.csv, status_filter=opts.status_filter, name_filter=opts.name_filter))
|
||||||
|
|
||||||
|
|
||||||
@cmdln.alias('bl')
|
@cmdln.alias('bl')
|
||||||
|
33
osc/core.py
33
osc/core.py
@@ -150,7 +150,7 @@ buildstatus_symbols = {'succeeded': '.',
|
|||||||
'broken': 'B',
|
'broken': 'B',
|
||||||
'blocked': 'b',
|
'blocked': 'b',
|
||||||
'building': '%',
|
'building': '%',
|
||||||
'finished': '%',
|
'finished': 'f',
|
||||||
'scheduled': 's',
|
'scheduled': 's',
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2451,7 +2451,7 @@ def get_results(apiurl, prj, package):
|
|||||||
r.append(result_line_templ % rmap)
|
r.append(result_line_templ % rmap)
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def get_prj_results(apiurl, prj, show_legend=False, csv=False):
|
def get_prj_results(apiurl, prj, hide_legend=False, csv=False, status_filter=None, name_filter=None):
|
||||||
#print '----------------------------------------'
|
#print '----------------------------------------'
|
||||||
|
|
||||||
r = []
|
r = []
|
||||||
@@ -2482,6 +2482,33 @@ def get_prj_results(apiurl, prj, show_legend=False, csv=False):
|
|||||||
status[pac][tg] = pacnode.get('code')
|
status[pac][tg] = pacnode.get('code')
|
||||||
targets.sort()
|
targets.sort()
|
||||||
|
|
||||||
|
# filter option
|
||||||
|
if status_filter or name_filter:
|
||||||
|
|
||||||
|
pacs_to_show = []
|
||||||
|
|
||||||
|
#filtering for Package Status
|
||||||
|
if status_filter:
|
||||||
|
if status_filter in buildstatus_symbols.values():
|
||||||
|
for txt, sym in buildstatus_symbols.items():
|
||||||
|
if sym == status_filter:
|
||||||
|
filt_txt = txt
|
||||||
|
for pkg in status.keys():
|
||||||
|
for repo in status[pkg].keys():
|
||||||
|
if status[pkg][repo] == filt_txt:
|
||||||
|
if not name_filter:
|
||||||
|
pacs_to_show.append(pkg)
|
||||||
|
elif name_filter in pkg:
|
||||||
|
pacs_to_show.append(pkg)
|
||||||
|
|
||||||
|
#filtering for Package Name
|
||||||
|
elif name_filter:
|
||||||
|
for pkg in pacs:
|
||||||
|
if name_filter in pkg:
|
||||||
|
pacs_to_show.append(pkg)
|
||||||
|
|
||||||
|
pacs = [ i for i in pacs if i in pacs_to_show ]
|
||||||
|
|
||||||
# csv output
|
# csv output
|
||||||
if csv:
|
if csv:
|
||||||
# TODO: option to disable the table header
|
# TODO: option to disable the table header
|
||||||
@@ -2525,7 +2552,7 @@ def get_prj_results(apiurl, prj, show_legend=False, csv=False):
|
|||||||
|
|
||||||
r.append('')
|
r.append('')
|
||||||
|
|
||||||
if show_legend:
|
if not hide_legend:
|
||||||
r.append(' Legend:')
|
r.append(' Legend:')
|
||||||
for i, j in buildstatus_symbols.items():
|
for i, j in buildstatus_symbols.items():
|
||||||
r.append(' %s %s' % (j, i))
|
r.append(' %s %s' % (j, i))
|
||||||
|
Reference in New Issue
Block a user