1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-26 01:46:13 +01:00

support osc build --shell-after-fail from build script

This commit is contained in:
Adrian Schröter 2021-02-11 10:58:40 +01:00
parent 6144b27470
commit c06b794ddf
4 changed files with 16 additions and 2 deletions

1
NEWS
View File

@ -1,5 +1,6 @@
0.173.0
- add showlinked command to show all references of packages linking to a given one
- add build --shell-after-build flag. It can also be set via .oscrc.
0.172.0
- support --lastsucceeded/--last-succeeded in "osc buildlog", "osc

View File

@ -571,6 +571,7 @@ def main(apiurl, opts, argv):
build_root = None
cache_dir = None
build_uid = ''
build_shell_after_fail = config['build-shell-after-fail']
vm_memory = config['build-memory']
vm_disk_size = config['build-vmdisk-rootsize']
vm_type = config['build-type']
@ -665,6 +666,8 @@ def main(apiurl, opts, argv):
else:
print('Error: build-uid arg must be 2 colon separated numerics: "uid:gid" or "caller"', file=sys.stderr)
return 1
if opts.shell_after_fail:
build_shell_after_fail = opts.shell_after_fail
if opts.vm_memory:
vm_memory = opts.vm_memory
if opts.vm_disk_size:
@ -740,6 +743,9 @@ def main(apiurl, opts, argv):
if opts.shell:
buildargs.append("--shell")
if build_shell_after_fail:
buildargs.append("--shell-after-fail")
if opts.shell_cmd:
buildargs.append("--shell-cmd")
buildargs.append(opts.shell_cmd)

View File

@ -771,7 +771,7 @@ class Osc(cmdln.Cmdln):
@cmdln.option('-d', '--delete', metavar='TOKENID',
help='Delete a token')
@cmdln.option('-o', '--operation', metavar='OPERATION',
help='Default is "runservice", but "release" or "rebuild" can also be used')
help='Default is "runservice", but "branch", "release" or "rebuild" can also be used')
@cmdln.option('-t', '--trigger', metavar='TOKENSTRING',
help='Trigger the action of a token')
def do_token(self, subcmd, opts, *args):
@ -6512,6 +6512,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
help=SUPPRESS_HELP)
@cmdln.option('--shell', action='store_true',
help=SUPPRESS_HELP)
@cmdln.option('--shell-after-fail', action='store_true',
help="run a shell if the build tool fails")
@cmdln.option('--shell-cmd', metavar='COMMAND',
help='run specified command instead of bash')
@cmdln.option('-f', '--force', action='store_true',
@ -6571,6 +6573,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
--noinit # for faster run
--shell-cmd=COMMAND
--shell-after-fail
--extra-pkgs=PACKAGE # install additional packages
To clean up the build environment run

View File

@ -108,6 +108,7 @@ DEFAULTS = {'apiurl': 'https://api.opensuse.org',
'build-uid': '', # use the default provided by build
'build-device': '', # required for VM builds
'build-memory': '', # required for VM builds
'build-shell-after-fail': '0', # optional for VM builds
'build-swap': '', # optional for VM builds
'build-vmdisk-rootsize': '', # optional for VM builds
'build-vmdisk-swapsize': '', # optional for VM builds
@ -201,7 +202,7 @@ boolean_opts = ['debug', 'do_package_tracking', 'http_debug', 'post_mortem', 'tr
'checkout_no_colon', 'checkout_rooted', 'check_for_request_on_action', 'linkcontrol', 'show_download_progress', 'request_show_interactive',
'request_show_source_buildstatus', 'review_inherit_group', 'use_keyring', 'gnome_keyring', 'no_verify', 'builtin_signature_check',
'http_full_debug', 'include_request_from_project', 'local_service_run', 'buildlog_strip_time', 'no_preinstallimage',
'status_mtime_heuristic', 'print_web_links', 'ccache']
'status_mtime_heuristic', 'print_web_links', 'ccache', 'build-shell-after-fail']
integer_opts = ['build-jobs']
api_host_options = ['user', 'pass', 'passx', 'aliases', 'http_headers', 'realname', 'email', 'sslcertck', 'cafile', 'capath', 'trusted_prj']
@ -238,6 +239,9 @@ apiurl = %(apiurl)s
# lxc - lxc build
#build-type =
# Execute always a shell prompt on build failure inside of the build environment
#build-shell-after-fail = 1
# build-device is the disk-image file to use as root for VM builds
# e.g. /var/tmp/FILE.root
#build-device = /var/tmp/FILE.root