From: Elliot Smith Date: Thu, 12 May 2016 14:10:36 +0000 (+0100) Subject: buildinfohelper: add method to set current build as CANCELLED X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1486c770327b53bb5e04baa5f3ea26d8154aed63;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git buildinfohelper: add method to set current build as CANCELLED This will be used from toasterui to cancel the current command-line build when a keyboard interrupt is captured. [YOCTO #8515] Signed-off-by: Elliot Smith Signed-off-by: Michael Wood Signed-off-by: Richard Purdie --- diff --git a/lib/bb/ui/buildinfohelper.py b/lib/bb/ui/buildinfohelper.py index ff4da78cdbc..c5368f63be4 100644 --- a/lib/bb/ui/buildinfohelper.py +++ b/lib/bb/ui/buildinfohelper.py @@ -1251,6 +1251,16 @@ class BuildInfoHelper(object): + def cancel_cli_build(self): + """ + If a build is currently underway, set its state to CANCELLED; + note that this only gets called for command line builds which are + interrupted, so it doesn't touch any BuildRequest objects + """ + build = self.internal_state['build'] + if build: + build.outcome = Build.CANCELLED + build.save() def store_dependency_information(self, event): assert '_depgraph' in vars(event)