mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-24 13:56:13 +01:00
make 'results' show build results in tabular form; add 'results_meta' to show raw xml
This commit is contained in:
parent
4d02380352
commit
e8c6d7a8db
22
osc.py
22
osc.py
@ -321,16 +321,32 @@ def main():
|
||||
|
||||
|
||||
|
||||
elif cmd == 'results':
|
||||
elif cmd == 'results_meta':
|
||||
wd = os.curdir
|
||||
package = store_read_package(wd)
|
||||
project = store_read_project(wd)
|
||||
if len(sys.argv) > 2:
|
||||
platform = sys.argv[2]
|
||||
print ''.join(get_results(project, package, platform))
|
||||
print ''.join(show_results_meta(project, package, platform))
|
||||
else:
|
||||
for platform in get_platforms_of_project(project):
|
||||
print ''.join(get_results(project, package, platform))
|
||||
print ''.join(show_results_meta(project, package, platform))
|
||||
|
||||
elif cmd == 'results':
|
||||
if len(sys.argv) > 3:
|
||||
print 'getting results for more than one package is not supported'
|
||||
print sys.exit(1)
|
||||
|
||||
if len(sys.argv) == 3:
|
||||
wd = sys.argv[2]
|
||||
else:
|
||||
wd = os.curdir
|
||||
package = store_read_package(wd)
|
||||
project = store_read_project(wd)
|
||||
|
||||
for platform in get_platforms_of_project(project):
|
||||
print ''.join(get_results(project, package, platform))
|
||||
|
||||
|
||||
elif cmd == 'log':
|
||||
wd = os.curdir
|
||||
|
38
osclib.py
38
osclib.py
@ -399,11 +399,47 @@ def get_platforms_of_project(prj):
|
||||
r.append(entry.attrs[('', 'name')])
|
||||
return r
|
||||
|
||||
def get_results(prj, package, platform):
|
||||
def show_results_meta(prj, package, platform):
|
||||
u = makeurl(['result', prj, platform, package, 'result'])
|
||||
f = urllib2.urlopen(u)
|
||||
return f.readlines()
|
||||
|
||||
def get_results(prj, package, platform):
|
||||
#print '----------------------------------------'
|
||||
f = show_results_meta(prj, package, platform)
|
||||
|
||||
reader = Sax2.Reader()
|
||||
doc = reader.fromString(''.join(f))
|
||||
|
||||
r = []
|
||||
#result_line_templ = '%(prj)-15s %(pac)-15s %(rep)-15s %(arch)-10s %(status)s'
|
||||
result_line_templ = '%(rep)-15s %(arch)-10s %(status)s %(hint)s'
|
||||
|
||||
for i in doc.getElementsByTagName('packageresult'):
|
||||
rmap = {}
|
||||
rmap['hint'] = ''
|
||||
rmap['prj'] = i.getAttribute('project')
|
||||
rmap['pac'] = i.getAttribute('package')
|
||||
rmap['rep'] = i.getAttribute('repository')
|
||||
|
||||
for ii in i.getElementsByTagName('archresult'):
|
||||
rmap['arch'] = ii.getAttribute('arch')
|
||||
|
||||
for iii in ii.getElementsByTagName('status'):
|
||||
rmap['status'] = iii.getAttribute('code')
|
||||
if rmap['status'] == 'expansion error':
|
||||
for iiii in iii.getElementsByTagName('summary'):
|
||||
rmap['status'] += ':'
|
||||
rmap['hint'] = iiii.childNodes[0].data
|
||||
if rmap['status'] == 'failed':
|
||||
rmap['status'] += ':'
|
||||
rmap['hint'] = '\'osc log %(rep)s %(arch)s\' -> ' % rmap + \
|
||||
'(%s://%s' % (scheme, netloc) + \
|
||||
'/result/%(prj)s/%(rep)s/%(pac)s/%(arch)s/log)' % rmap
|
||||
|
||||
r.append(result_line_templ % rmap)
|
||||
return r
|
||||
|
||||
def get_log(prj, package, platform, arch):
|
||||
u = makeurl(['result', prj, platform, package, arch, 'log'])
|
||||
f = urllib2.urlopen(u)
|
||||
|
Loading…
Reference in New Issue
Block a user