Skip to contentSkip to conversation

toasterui: set Build outcome to CANCELLED on cli interrupt

PATCH In review Elliot Smith 1 participant 2 messages Apr 27, 2016 – Apr 28, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 toasterui: set Build outcome to CANCELLED on cli interrupt

If a command-line build is interrupted with Ctrl-C or similar, set the outcome of the Build to CANCELLED. This ensures that interrupted builds don't "hang" in the Toaster UI and are displayed as required by the design.

[YOCTO #8515]

---
 bitbake/lib/bb/ui/buildinfohelper.py | 10 ++++++++++
 bitbake/lib/bb/ui/toasterui.py       |  1 +
 2 files changed, 11 insertions(+)
bitbake/lib/bb/ui/buildinfohelper.py +10 -0
index 9397905..83dc098 100644
@@ -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)
bitbake/lib/bb/ui/toasterui.py +1 -0
index 6bf4c1f..fb476a3 100644
@@ -442,6 +442,7 @@ def main(server, eventHandler, params):
                 pass
         except KeyboardInterrupt:
             main.shutdown = 1
+            buildinfohelper.cancel_cli_build()
         except Exception as e:
             # print errors to log
             import traceback
Signature · 12 lines
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#1 lore raw

Please ignore, I have to rework this.

Elliot

Quoted 63 lines · Elliot Smith

If a command-line build is interrupted with Ctrl-C or similar, set the outcome of the Build to CANCELLED. This ensures that interrupted builds don't "hang" in the Toaster UI and are displayed as required by the design.

[YOCTO #8515]

---
 bitbake/lib/bb/ui/buildinfohelper.py | 10 ++++++++++
 bitbake/lib/bb/ui/toasterui.py       |  1 +
 2 files changed, 11 insertions(+)
bitbake/lib/bb/ui/buildinfohelper.py +10 -0
index 9397905..83dc098 100644
@@ -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)
bitbake/lib/bb/ui/toasterui.py +1 -1
index 6bf4c1f..fb476a3 100644
@@ -442,6 +442,7 @@ def main(server, eventHandler, params):
                 pass
         except KeyboardInterrupt:
             main.shutdown = 1
+            buildinfohelper.cancel_cli_build()
         except Exception as e:
             # print errors to log
             import traceback
--

1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

Signature · 3 lines
Elliot Smith
Software Engineer
Intel Open Source Technology Centre