mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-11 16:36:14 +01:00
- support restartbuild and abortbuild
small refactoring but keep api compability
This commit is contained in:
parent
43499172af
commit
67802e6a41
@ -6027,16 +6027,17 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
|
|
||||||
|
|
||||||
@cmdln.option('-a', '--arch', metavar='ARCH',
|
@cmdln.option('-a', '--arch', metavar='ARCH',
|
||||||
help='Abort builds for a specific architecture')
|
help='Restart builds for a specific architecture')
|
||||||
@cmdln.option('-r', '--repo', metavar='REPO',
|
@cmdln.option('-r', '--repo', metavar='REPO',
|
||||||
help='Abort builds for a specific repository')
|
help='Restart builds for a specific repository')
|
||||||
@cmdln.option('--all', action='store_true',
|
@cmdln.option('--all', action='store_true',
|
||||||
help='Abort all running builds of entire project')
|
help='Restart all running builds of entire project')
|
||||||
def do_abortbuild(self, subcmd, opts, *args):
|
@cmdln.alias('abortbuild')
|
||||||
"""${cmd_name}: Aborts the build of a certain project or package
|
def do_restartbuild(self, subcmd, opts, *args):
|
||||||
|
"""${cmd_name}: Restart the build of a certain project or package
|
||||||
|
|
||||||
usage:
|
usage:
|
||||||
osc abortbuild [PROJECT [PACKAGE [REPOSITORY [ARCH]]]]
|
osc restartbuild [PROJECT [PACKAGE [REPOSITORY [ARCH]]]]
|
||||||
${cmd_option_list}
|
${cmd_option_list}
|
||||||
"""
|
"""
|
||||||
args = slash_split(args)
|
args = slash_split(args)
|
||||||
@ -6071,9 +6072,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
arch = args[3]
|
arch = args[3]
|
||||||
|
|
||||||
if not (opts.all or package or repo or arch):
|
if not (opts.all or package or repo or arch):
|
||||||
raise oscerr.WrongOptions('No option has been provided. If you want to abort all packages of the entire project, use --all option.')
|
raise oscerr.WrongOptions('No option has been provided. If you want to restart all packages of the entire project, use --all option.')
|
||||||
|
|
||||||
print(abortbuild(apiurl, project, package, opts.arch, opts.repo))
|
print(cmdbuild(apiurl, subcmd, project, package, opts.arch, opts.repo))
|
||||||
|
|
||||||
|
|
||||||
@cmdln.option('-a', '--arch', metavar='ARCH',
|
@cmdln.option('-a', '--arch', metavar='ARCH',
|
||||||
|
31
osc/core.py
31
osc/core.py
@ -5671,32 +5671,17 @@ def get_osc_version():
|
|||||||
|
|
||||||
|
|
||||||
def abortbuild(apiurl, project, package=None, arch=None, repo=None):
|
def abortbuild(apiurl, project, package=None, arch=None, repo=None):
|
||||||
query = { 'cmd': 'abortbuild' }
|
return cmdbuild(apiurl, 'abortbuild', project, package, arch, repo)
|
||||||
if package:
|
|
||||||
query['package'] = package
|
|
||||||
if arch:
|
|
||||||
query['arch'] = arch
|
|
||||||
if repo:
|
|
||||||
query['repository'] = repo
|
|
||||||
u = makeurl(apiurl, ['build', project], query)
|
|
||||||
try:
|
|
||||||
f = http_POST(u)
|
|
||||||
except HTTPError as e:
|
|
||||||
e.osc_msg = 'abortion failed for project %s' % project
|
|
||||||
if package:
|
|
||||||
e.osc_msg += ' package %s' % package
|
|
||||||
if arch:
|
|
||||||
e.osc_msg += ' arch %s' % arch
|
|
||||||
if repo:
|
|
||||||
e.osc_msg += ' repo %s' % repo
|
|
||||||
raise
|
|
||||||
|
|
||||||
root = ET.parse(f).getroot()
|
def restartbuild(apiurl, project, package=None, arch=None, repo=None):
|
||||||
return root.get('code')
|
return cmdbuild(apiurl, 'restartbuild', project, package, arch, repo)
|
||||||
|
|
||||||
|
def wipebinaries(apiurl, project, package=None, arch=None, repo=None):
|
||||||
|
return cmdbuild(apiurl, 'wipebinaries', project, package, arch, repo)
|
||||||
|
|
||||||
|
|
||||||
def wipebinaries(apiurl, project, package=None, arch=None, repo=None, code=None):
|
def cmdbuild(apiurl, cmd, project, package=None, arch=None, repo=None, code=None):
|
||||||
query = { 'cmd': 'wipe' }
|
query = { 'cmd': cmd }
|
||||||
if package:
|
if package:
|
||||||
query['package'] = package
|
query['package'] = package
|
||||||
if arch:
|
if arch:
|
||||||
|
Loading…
Reference in New Issue
Block a user