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

- make 'results' subcommand many times faster, by making only a single request

on _result?view=status&package=%s (new api)
This commit is contained in:
Dr. Peter Poeml 2007-03-12 23:21:34 +00:00
parent 2e0927ddfd
commit 0b47b21719
3 changed files with 39 additions and 34 deletions

25
TODO
View File

@ -97,9 +97,6 @@ osc repos server:search:ui :
#http://api.opensuse.org/result/KDE:KDE3/packstatus?summary
#http://api.opensuse.org/result/KDE:KDE3/packstatus?summaryonly
results seems very slow, it presumably does more network accesses than necessary
it shouldn't take more time than prjresults
# osc build SUSE_Factory i586 xorg-x11-libX11.spec
> ['/usr/bin/osc', 'build', 'i38', 'i386', 'SUSE_Factory', 'i586', 'xorg-x11-libX11.spec']
@ -165,9 +162,6 @@ show request body of 400 responses (bad request)
geht print self.USAGE % self.__dict__ ?
if import cElememtTree fails, use elementtree
if that fails, point to home:cthiel1 repository (or devel:languages:python)
a merge issue:
@ -188,3 +182,22 @@ build command:
buildinfo aenderungen:
preinstall="1" runscripts="1"
when can this happen?
% osc up
checking out new package t
A home:poeml/t
A home:poeml/t/foo
At revision 16.
At revision 9.
D bar1
Traceback (most recent call last):
File "/suse/poeml/bin/osc", line 7, in ?
commandline.main()
File "/suse/poeml/osc-stable/osc/commandline.py", line 1072, in main
cmd(args)
File "/suse/poeml/osc-stable/osc/commandline.py", line 572, in update
if state == 'M' and p.findfilebyname(filename).md5 == oldp.findfilebyname(filename).md5:
AttributeError: 'NoneType' object has no attribute 'md5'
[1] 11871 exit 1 osc up

View File

@ -684,17 +684,12 @@ usage 1. osc platforms
def results_meta(args):
"""Shows the build results of the package in raw XML
usage: osc results_meta [platform]
usage: osc results_meta
"""
wd = os.curdir
package = store_read_package(wd)
project = store_read_project(wd)
if args:
platform = args[0]
print ''.join(show_results_meta(project, package, platform))
else:
for platform in get_platforms_of_project(project):
print ''.join(show_results_meta(project, package, platform))
print ''.join(show_results_meta(project, package))
def results(args):
@ -712,11 +707,14 @@ usage: 1. osc results # package = current dir
wd = args[0]
else:
wd = os.curdir
package = store_read_package(wd)
project = store_read_project(wd)
for platform in get_platforms_of_project(project):
print '\n'.join(get_results(project, package, platform))
try:
package = store_read_package(wd)
project = store_read_project(wd)
except:
sys.exit('\'%s\' is not an osc package directory' % wd)
print '\n'.join(get_results(project, package))
def prjresults(args):
@ -738,7 +736,7 @@ usage: 1. osc prjresults # package = current dir
try:
project = store_read_project(wd)
except:
sys.exit('\'%s\' is not an osc project directory' % wd)
sys.exit('\'%s\' is neither an osc project or package directory' % wd)
print '\n'.join(get_prj_results(project))

View File

@ -1135,8 +1135,8 @@ def get_repos_of_project(prj):
return r
def show_results_meta(prj, package, platform):
u = makeurl(['result', prj, platform, package, 'result'])
def show_results_meta(prj, package):
u = makeurl(['build', prj, '_result?view=status&package=%s' % package])
f = urlopen(u)
return f.readlines()
@ -1147,31 +1147,26 @@ def show_prj_results_meta(prj):
return f.readlines()
def get_results(prj, package, platform):
#print '----------------------------------------'
def get_results(prj, package):
r = []
#result_line_templ = '%(prj)-15s %(pac)-15s %(rep)-15s %(arch)-10s %(status)s'
result_line_templ = '%(rep)-15s %(arch)-10s %(status)s'
f = show_results_meta(prj, package, platform)
f = show_results_meta(prj, package)
tree = ET.parse(StringIO(''.join(f)))
root = tree.getroot()
rmap = {}
rmap['prj'] = root.get('project')
rmap['pac'] = root.get('package')
rmap['rep'] = root.get('repository')
for node in root.findall('archresult'):
for node in root.findall('result'):
rmap = {}
rmap['prj'] = prj
rmap['pac'] = package
rmap['rep'] = node.get('repository')
rmap['arch'] = node.get('arch')
statusnode = node.find('status')
rmap['status'] = statusnode.get('code')
if rmap['status'] in ['expansion error', 'broken']:
rmap['status'] += ': ' + statusnode.find('summary').text
rmap['status'] += ': ' + statusnode.find('details').text
if rmap['status'] == 'failed':
rmap['status'] += ': %s://%s' % (conf.config['scheme'], conf.config['apisrv']) + \
@ -1180,7 +1175,6 @@ def get_results(prj, package, platform):
r.append(result_line_templ % rmap)
return r
def get_prj_results(prj):
#print '----------------------------------------'