Patchwork [bitbake-devel,1/1] bitbake: cooker, toaster: mark interrupted builds as failed

login
register
mail settings
Submitter Alexandru DAMIAN
Date Nov. 19, 2013, 4:46 p.m.
Message ID <1384879601-23407-1-git-send-email-alexandru.damian@intel.com>
Download mbox | patch
Permalink /patch/61975/
State New
Headers show

Comments

Alexandru DAMIAN - Nov. 19, 2013, 4:46 p.m.
From: Alexandru DAMIAN <alexandru.damian@intel.com>

This patch changes bitbake to log an error to the
command line when the build is interrupted via Ctrl-C.

This is needed to inform the user that not all tasks
required for the build have been executed, and
the build is not complete.

Internally, the Bitbake server will return a CommandFailed
event that will be logged by Toaster as build failure.

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>

Patch

diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 12cb419..84de06a 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -1114,10 +1114,13 @@  class BBCooker:
 
         def buildFileIdle(server, rq, abort):
 
+            msg = None
             if abort or self.state == state.forceshutdown:
                 rq.finish_runqueue(True)
+                msg = "Forced shutdown"
             elif self.state == state.shutdown:
                 rq.finish_runqueue(False)
+                msg = "Stopped build"
             failures = 0
             try:
                 retval = rq.execute_runqueue()
@@ -1130,7 +1133,7 @@  class BBCooker:
 
             if not retval:
                 bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runq_fnid), buildname, item, failures), self.event_data)
-                self.command.finishAsyncCommand()
+                self.command.finishAsyncCommand(msg)
                 return False
             if retval is True:
                 return True
@@ -1144,10 +1147,13 @@  class BBCooker:
         """
 
         def buildTargetsIdle(server, rq, abort):
+            msg = None
             if abort or self.state == state.forceshutdown:
                 rq.finish_runqueue(True)
+                msg = "Forced shutdown"
             elif self.state == state.shutdown:
                 rq.finish_runqueue(False)
+                msg = "Stopped build"
             failures = 0
             try:
                 retval = rq.execute_runqueue()
@@ -1160,7 +1166,7 @@  class BBCooker:
 
             if not retval:
                 bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runq_fnid), buildname, targets, failures), self.data)
-                self.command.finishAsyncCommand()
+                self.command.finishAsyncCommand(msg)
                 return False
             if retval is True:
                 return True
diff --git a/bitbake/lib/bb/ui/toasterui.py b/bitbake/lib/bb/ui/toasterui.py
index 69c6474..92955f8 100644
--- a/bitbake/lib/bb/ui/toasterui.py
+++ b/bitbake/lib/bb/ui/toasterui.py
@@ -237,6 +237,13 @@  def main(server, eventHandler, params ):
             if isinstance(event, (bb.command.CommandCompleted,
                                   bb.command.CommandFailed,
                                   bb.command.CommandExit)):
+                if (isinstance(event, bb.command.CommandFailed)):
+                    event.levelno = format.ERROR
+                    event.msg = event.error
+                    event.pathname = ""
+                    event.lineno = 0
+                    buildinfohelper.store_log_event(event)
+                    errors += 1
 
                 buildinfohelper.update_build_information(event, errors, warnings, taskfailures)