From 5ef036a5785f92d389095f70ff3a14eca8afbf71 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Thu, 15 Oct 2009 14:24:12 +0000 Subject: [PATCH] allow filtering by repo/arch in prjresults --- osc/commandline.py | 6 +++++- osc/core.py | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/osc/commandline.py b/osc/commandline.py index c300daac..d7cbe2c6 100755 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -2291,6 +2291,10 @@ Please submit there instead, or use --nodevelproject to force direct submission. help='show only packages with buildstatus STATUS (see legend)') @cmdln.option('-n', '--name-filter', metavar='EXPR', help='show only packages whose names match EXPR') + @cmdln.option('-a', '--arch', metavar='ARCH', + help='show results only for specified architecture(s)') + @cmdln.option('-r', '--repo', metavar='REPO', + help='show results only for specified repo(s)') @cmdln.option('-p', '--project', metavar='PROJECT', help='show packages in project PROJECT') @cmdln.alias('pr') @@ -2316,7 +2320,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. project = store_read_project(wd) apiurl = store_read_apiurl(wd) - 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)) + 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, repo=opts.repo, arch=opts.arch)) @cmdln.option('-q', '--hide-legend', action='store_true', diff --git a/osc/core.py b/osc/core.py index 7a5dbac5..dea9696e 100755 --- a/osc/core.py +++ b/osc/core.py @@ -3274,7 +3274,7 @@ def get_results(apiurl, prj, package, lastbuild=None, repository=[], arch=[]): r.append(result_line_templ % rmap) return r -def get_prj_results(apiurl, prj, hide_legend=False, csv=False, status_filter=None, name_filter=None): +def get_prj_results(apiurl, prj, hide_legend=False, csv=False, status_filter=None, name_filter=None, arch=None, repo=None): #print '----------------------------------------' r = [] @@ -3296,6 +3296,11 @@ def get_prj_results(apiurl, prj, hide_legend=False, csv=False, status_filter=Non pacs.append(node.get('package')) pacs.sort() for node in root.findall('result'): + # filter architecture and repository + if arch != None and arch != node.get('arch'): + continue + if repo != None and repo != node.get('repository'): + continue tg = (node.get('repository'), node.get('arch')) targets.append(tg) for pacnode in node.findall('status'):