1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-27 15:06:15 +01:00

-r|--repo and -a|--arch options for results, rresults and results_meta commands

This commit is contained in:
Michal Vyskocil 2009-05-15 07:16:26 +00:00
parent 4996e49f59
commit 011426d885
3 changed files with 27 additions and 6 deletions

3
NEWS
View File

@ -20,6 +20,9 @@
- new option for copypac
* -r to specify source revision
* -m to specify a comment (and send default comment if not specified)
- new option to results(r), results_meta (including -l|--lastbuild) and rresults:
* -r|--repo to specify a repository(repositories)
* -a|--arch to specify a architexure(s)
0.117:
- support checkout of single package via "osc co PACKAGE" when local dir is project

View File

@ -1753,6 +1753,12 @@ Please submit there instead, or use --nodevelproject to force direct submission.
print '\n'.join(get_platforms(conf.config['apiurl']))
@cmdln.option('-l', '--last-build', action='store_true',
help='show last build results (succeeded/failed/unknown)')
@cmdln.option('-r', '--repo', action='append',
help='Show results only for specified repo(s)')
@cmdln.option('-a', '--arch', action='append',
help='Show results only for specified architecture(s)')
def do_results_meta(self, subcmd, opts, *args):
"""${cmd_name}: Shows raw build results of a package
@ -1768,12 +1774,16 @@ Please submit there instead, or use --nodevelproject to force direct submission.
pacs = findpacs(args)
for pac in pacs:
print ''.join(show_results_meta(pac.apiurl, pac.prjname, package=pac.name))
print ''.join(show_results_meta(pac.apiurl, pac.prjname, pac.name, opts.last_build, opts.repo, opts.arch))
@cmdln.alias('r')
@cmdln.option('-l', '--last-build', action='store_true',
help='show last build results (succeeded/failed/unknown)')
@cmdln.option('-r', '--repo', action='append',
help='Show results only for specified repo(s)')
@cmdln.option('-a', '--arch', action='append',
help='Show results only for specified architecture(s)')
def do_results(self, subcmd, opts, *args):
"""${cmd_name}: Shows the build results of a package
@ -1787,11 +1797,15 @@ Please submit there instead, or use --nodevelproject to force direct submission.
pacs = findpacs(args)
for pac in pacs:
print '\n'.join(get_results(pac.apiurl, pac.prjname, pac.name, opts.last_build))
print '\n'.join(get_results(pac.apiurl, pac.prjname, pac.name, opts.last_build, opts.repo, opts.arch))
@cmdln.option('-l', '--last-build', action='store_true',
help='show last build results (succeeded/failed/unknown)')
@cmdln.option('-r', '--repo', action='append',
help='Show results only for specified repo(s)')
@cmdln.option('-a', '--arch', action='append',
help='Show results only for specified architecture(s)')
def do_rresults(self, subcmd, opts, *args):
"""${cmd_name}: Shows the build results of a remote package
@ -1809,7 +1823,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
raise oscerr.WrongArgs('Too many arguments.')
apiurl = conf.config['apiurl']
print '\n'.join(get_results(apiurl, args[0], args[1], opts.last_build))
print '\n'.join(get_results(apiurl, args[0], args[1], opts.last_build, opts.repo, opts.arch))
@cmdln.option('-q', '--hide-legend', action='store_true',

View File

@ -2705,13 +2705,17 @@ def get_binarylist_published(apiurl, prj, repo, arch):
return r
def show_results_meta(apiurl, prj, package=None, lastbuild=None):
def show_results_meta(apiurl, prj, package=None, lastbuild=None, repository=[], arch=[]):
query = {}
if package:
query['package'] = package
if lastbuild:
query['lastbuild'] = 1
u = makeurl(apiurl, ['build', prj, '_result'], query=query)
for repo in repository:
u = u + '&repository=%s' % repo
for a in arch:
u = u + '&arch=%s' % a
f = http_GET(u)
return f.readlines()
@ -2722,11 +2726,11 @@ def show_prj_results_meta(apiurl, prj):
return f.readlines()
def get_results(apiurl, prj, package, lastbuild=None):
def get_results(apiurl, prj, package, lastbuild=None, repository=[], arch=[]):
r = []
result_line_templ = '%(rep)-15s %(arch)-10s %(status)s'
f = show_results_meta(apiurl, prj, package=package, lastbuild=lastbuild)
f = show_results_meta(apiurl, prj, package, lastbuild, repository, arch)
tree = ET.parse(StringIO(''.join(f)))
root = tree.getroot()