mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-26 06:46:13 +01:00
Add --watch for osc prjresults --xml
Like: osc results --watch
This commit is contained in:
parent
a5e967efb3
commit
5e03ffcec9
@ -5152,7 +5152,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
help='Disable results for all direct affect packages inside of the project')
|
help='Disable results for all direct affect packages inside of the project')
|
||||||
@cmdln.option('-M', '--multibuild-package', action='append', default=[],
|
@cmdln.option('-M', '--multibuild-package', action='append', default=[],
|
||||||
help='Only show results for the specified multibuild package')
|
help='Only show results for the specified multibuild package')
|
||||||
@cmdln.option('-w', '--watch', action='store_true', default=False,
|
@cmdln.option('-w', '--watch', action='store_true',
|
||||||
help='watch the results until all finished building')
|
help='watch the results until all finished building')
|
||||||
@cmdln.option('', '--xml', action='store_true', default=False,
|
@cmdln.option('', '--xml', action='store_true', default=False,
|
||||||
help='generate output in XML (former results_meta)')
|
help='generate output in XML (former results_meta)')
|
||||||
@ -5235,6 +5235,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
# as well when adding a new option!
|
# as well when adding a new option!
|
||||||
@cmdln.option('-q', '--hide-legend', action='store_true',
|
@cmdln.option('-q', '--hide-legend', action='store_true',
|
||||||
help='hide the legend')
|
help='hide the legend')
|
||||||
|
@cmdln.option('-w', '--watch', action='store_true',
|
||||||
|
help='watch the results until all finished building, only supported with --xml')
|
||||||
@cmdln.option('-c', '--csv', action='store_true',
|
@cmdln.option('-c', '--csv', action='store_true',
|
||||||
help='csv output')
|
help='csv output')
|
||||||
@cmdln.option('', '--xml', action='store_true', default=False,
|
@cmdln.option('', '--xml', action='store_true', default=False,
|
||||||
@ -5273,9 +5275,20 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
project = store_read_project(wd)
|
project = store_read_project(wd)
|
||||||
|
|
||||||
if opts.xml:
|
if opts.xml:
|
||||||
print(''.join(show_prj_results_meta(apiurl, project, opts.repo, opts.arch)))
|
kwargs = {}
|
||||||
|
if opts.repo:
|
||||||
|
kwargs['repository'] = opts.repo
|
||||||
|
if opts.arch:
|
||||||
|
kwargs['arch'] = opts.arch
|
||||||
|
kwargs['wait'] = opts.watch
|
||||||
|
for results in get_package_results(apiurl, project, **kwargs):
|
||||||
|
print(results)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if opts.watch:
|
||||||
|
print('Please implement support for osc prjresults --watch without --xml.')
|
||||||
|
return 2
|
||||||
|
|
||||||
print('\n'.join(get_prj_results(apiurl, project, hide_legend=opts.hide_legend, \
|
print('\n'.join(get_prj_results(apiurl, project, hide_legend=opts.hide_legend, \
|
||||||
csv=opts.csv, status_filter=opts.status_filter, \
|
csv=opts.csv, status_filter=opts.status_filter, \
|
||||||
name_filter=opts.name_filter, repo=opts.repo, \
|
name_filter=opts.name_filter, repo=opts.repo, \
|
||||||
|
@ -5735,7 +5735,7 @@ def get_results(apiurl, project, package, verbose=False, printJoin='', *args, **
|
|||||||
return r
|
return r
|
||||||
|
|
||||||
|
|
||||||
def get_package_results(apiurl, project, package, wait=False, *args, **kwargs):
|
def get_package_results(apiurl, project, package=None, wait=False, *args, **kwargs):
|
||||||
"""generator that returns a the package results as an xml structure"""
|
"""generator that returns a the package results as an xml structure"""
|
||||||
xml = ''
|
xml = ''
|
||||||
waiting_states = ('blocked', 'scheduled', 'dispatching', 'building',
|
waiting_states = ('blocked', 'scheduled', 'dispatching', 'building',
|
||||||
|
@ -33,6 +33,12 @@ class TestResults(OscTestCase):
|
|||||||
out = self._run_osc('prjresults', '--xml', 'testproject')
|
out = self._run_osc('prjresults', '--xml', 'testproject')
|
||||||
self.assertEqualMultiline(out, self._get_fixture('result.xml')+'\n')
|
self.assertEqualMultiline(out, self._get_fixture('result.xml')+'\n')
|
||||||
|
|
||||||
|
@GET('http://localhost/build/testproject/_result', file='result-dirty.xml')
|
||||||
|
@GET('http://localhost/build/testproject/_result?oldstate=c57e2ee592dbbf26ebf19cc4f1bc1e83', file='result.xml')
|
||||||
|
def testPrjresultsWatch(self):
|
||||||
|
out = self._run_osc('prjresults', '--watch', '--xml', 'testproject')
|
||||||
|
self.assertEqualMultiline(out, self._get_fixture('result-dirty.xml')+'\n'+self._get_fixture('result.xml')+'\n')
|
||||||
|
|
||||||
@GET('http://localhost/build/testproject/_result?package=python-MarkupSafe&multibuild=1&locallink=1', file='result.xml')
|
@GET('http://localhost/build/testproject/_result?package=python-MarkupSafe&multibuild=1&locallink=1', file='result.xml')
|
||||||
def testResults(self):
|
def testResults(self):
|
||||||
out = self._run_osc('results', '--xml', 'testproject', 'python-MarkupSafe')
|
out = self._run_osc('results', '--xml', 'testproject', 'python-MarkupSafe')
|
||||||
@ -44,3 +50,7 @@ class TestResults(OscTestCase):
|
|||||||
out = self._run_osc('results', '--watch', '--xml', 'testproject', 'python-MarkupSafe')
|
out = self._run_osc('results', '--watch', '--xml', 'testproject', 'python-MarkupSafe')
|
||||||
self.assertEqualMultiline(out, self._get_fixture('result-dirty.xml')+self._get_fixture('result.xml'))
|
self.assertEqualMultiline(out, self._get_fixture('result-dirty.xml')+self._get_fixture('result.xml'))
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import unittest
|
||||||
|
unittest.main()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user