diff --git a/osc/build.py b/osc/build.py index 29b6fc58..d07163d1 100644 --- a/osc/build.py +++ b/osc/build.py @@ -440,6 +440,8 @@ def main(apiurl, opts, argv): pac = '_repository' else: pac = store_read_package(os.curdir) + if opts.shell: + buildargs.append("--shell") # make it possible to override configuration of the rc file for var in ['OSC_PACKAGECACHEDIR', 'OSC_SU_WRAPPER', 'OSC_BUILD_ROOT']: @@ -851,11 +853,16 @@ def main(apiurl, opts, argv): cmd = (change_personality.get(bi.buildarch, '') + ' ' + cmd).strip() print cmd - rc = subprocess.call(cmd, shell=True) - if rc: - print - print 'The buildroot was:', build_root - sys.exit(rc) + try: + rc = subprocess.call(cmd, shell=True) + if rc: + print + print 'The buildroot was:', build_root + sys.exit(rc) + except KeyboardInterrupt, i: + print "keyboard interrupt, killing build ..." + subprocess.call(cmd + " --kill", shell=True) + raise i pacdir = os.path.join(build_root, '.build.packages') if os.path.islink(pacdir): diff --git a/osc/commandline.py b/osc/commandline.py index 8001c1c7..d23a91f6 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -4181,6 +4181,8 @@ Please submit there instead, or use --nodevelproject to force direct submission. help=SUPPRESS_HELP) @cmdln.option('--oldpackages', metavar='DIR', help='take previous build from DIR (special values: _self, _link)') + @cmdln.option('--shell', action='store_true', + help=SUPPRESS_HELP) def do_build(self, subcmd, opts, *args): """${cmd_name}: Build a package on your local machine