summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui/toasterui.py
diff options
context:
space:
mode:
authorElliot Smith <elliot.smith@intel.com>2016-05-12 15:10:37 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-05-17 14:43:30 +0100
commitd9d715b9f9ab72280e2c8522fa2c6f54ef5c1ea0 (patch)
treedc8086f3956f1d9378a0e036cb9b94017e4774c9 /bitbake/lib/bb/ui/toasterui.py
parentdf0fc2d90884150f896ac87e401c10ce3bb95850 (diff)
downloadpoky-d9d715b9f9ab72280e2c8522fa2c6f54ef5c1ea0.tar.gz
bitbake: toasterui: capture keyboard interrupts the same way as knotty
knotty captures two levels of keyboard interrupt: a single interrupt or two interrupts in a row. These then trigger stateShutdown and stateForceShutdown respectively. toasterui doesn't have an equivalent way of capturing interrupts and using them to shut down bitbake. Now that we are no longer using knotty + XMLRPCServer for our command line builds (since switching to per-project build directories), we see some odd side effects of this, such as builds continuing after they have been interrupted on the command line. Bring toasterui in line with knotty (copy-paste most of the code in knotty.py which deals with interrupts) so that a keyboard interrupt actually shuts down the bitbake server (if not in observe only mode). Additionally use the cancel_cli_build() method to set the Build status to CANCELLED in Toaster's db when we get keyboard interrupts. This means that builds interrupted on the command line show as cancelled (same as if they'd been cancelled from the Toaster UI), as specified in the UI designs. [YOCTO #8515] (Bitbake rev: d39d2edca95900da433074ee95a192d7bfe7090d) Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui/toasterui.py')
-rw-r--r--bitbake/lib/bb/ui/toasterui.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/bitbake/lib/bb/ui/toasterui.py b/bitbake/lib/bb/ui/toasterui.py
index c2d41f791f..5382935f82 100644
--- a/bitbake/lib/bb/ui/toasterui.py
+++ b/bitbake/lib/bb/ui/toasterui.py
@@ -441,7 +441,22 @@ def main(server, eventHandler, params):
441 if ioerror.args[0] == 4: 441 if ioerror.args[0] == 4:
442 pass 442 pass
443 except KeyboardInterrupt: 443 except KeyboardInterrupt:
444 main.shutdown = 1 444 if params.observe_only:
445 print("\nKeyboard Interrupt, exiting observer...")
446 main.shutdown = 2
447 if not params.observe_only and main.shutdown == 1:
448 print("\nSecond Keyboard Interrupt, stopping...\n")
449 _, error = server.runCommand(["stateForceShutdown"])
450 if error:
451 logger.error("Unable to cleanly stop: %s" % error)
452 if not params.observe_only and main.shutdown == 0:
453 print("\nKeyboard Interrupt, closing down...\n")
454 interrupted = True
455 _, error = server.runCommand(["stateShutdown"])
456 if error:
457 logger.error("Unable to cleanly shutdown: %s" % error)
458 buildinfohelper.cancel_cli_build()
459 main.shutdown = main.shutdown + 1
445 except Exception as e: 460 except Exception as e:
446 # print errors to log 461 # print errors to log
447 import traceback 462 import traceback