Openembedded Bitbake Development
 help / color / mirror / Atom feed
* [PATCH 0/1] Allow BuildCompleted listeners to know if build was interrupted
@ 2015-08-26 12:50 Paul Eggleton
  2015-08-26 12:50 ` [PATCH 1/1] lib/bb/cooker: add interrupted flag to BuildCompleted event Paul Eggleton
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Eggleton @ 2015-08-26 12:50 UTC (permalink / raw)
  To: bitbake-devel

The following changes since commit c9dc6d9c86e8b887821a6d00346bd0b09e1da97c:

  lib/bb/main: avoid importing all server/UI modules on every execution (2015-08-24 23:22:07 +0100)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib paule/bb-buildcompleted
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=paule/bb-buildcompleted

Paul Eggleton (1):
  lib/bb/cooker: add interrupted flag to BuildCompleted event

 lib/bb/cooker.py | 10 ++++++++--
 lib/bb/event.py  |  3 ++-
 2 files changed, 10 insertions(+), 3 deletions(-)

-- 
2.1.0



^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 1/1] lib/bb/cooker: add interrupted flag to BuildCompleted event
  2015-08-26 12:50 [PATCH 0/1] Allow BuildCompleted listeners to know if build was interrupted Paul Eggleton
@ 2015-08-26 12:50 ` Paul Eggleton
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Eggleton @ 2015-08-26 12:50 UTC (permalink / raw)
  To: bitbake-devel

Allow any listeners for this event (such as buildhistory.bbclass in
OpenEmbedded) to find out if the build was interrupted rather than
completing normally. The value will be 0 if not interrupted, 1 if
interrupted waiting for remaining tasks to complete, or 2 if force
interrupted (stopping any running tasks immediately).

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 lib/bb/cooker.py | 10 ++++++++--
 lib/bb/event.py  |  3 ++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index 6dc9f19..99c4785 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -1319,12 +1319,15 @@ class BBCooker:
         def buildFileIdle(server, rq, abort):
 
             msg = None
+            interrupted = 0
             if abort or self.state == state.forceshutdown:
                 rq.finish_runqueue(True)
                 msg = "Forced shutdown"
+                interrupted = 2
             elif self.state == state.shutdown:
                 rq.finish_runqueue(False)
                 msg = "Stopped build"
+                interrupted = 1
             failures = 0
             try:
                 retval = rq.execute_runqueue()
@@ -1336,7 +1339,7 @@ class BBCooker:
                 return False
 
             if not retval:
-                bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runq_fnid), buildname, item, failures), self.expanded_data)
+                bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runq_fnid), buildname, item, failures, interrupted), self.expanded_data)
                 self.command.finishAsyncCommand(msg)
                 return False
             if retval is True:
@@ -1352,12 +1355,15 @@ class BBCooker:
 
         def buildTargetsIdle(server, rq, abort):
             msg = None
+            interrupted = 0
             if abort or self.state == state.forceshutdown:
                 rq.finish_runqueue(True)
                 msg = "Forced shutdown"
+                interrupted = 2
             elif self.state == state.shutdown:
                 rq.finish_runqueue(False)
                 msg = "Stopped build"
+                interrupted = 1
             failures = 0
             try:
                 retval = rq.execute_runqueue()
@@ -1369,7 +1375,7 @@ class BBCooker:
                 return False
 
             if not retval:
-                bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runq_fnid), buildname, targets, failures), self.data)
+                bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runq_fnid), buildname, targets, failures, interrupted), self.data)
                 self.command.finishAsyncCommand(msg)
                 return False
             if retval is True:
diff --git a/lib/bb/event.py b/lib/bb/event.py
index 0e18110..3f96bca 100644
--- a/lib/bb/event.py
+++ b/lib/bb/event.py
@@ -370,11 +370,12 @@ class BuildStarted(BuildBase, OperationStarted):
 
 class BuildCompleted(BuildBase, OperationCompleted):
     """bbmake build run completed"""
-    def __init__(self, total, n, p, failures = 0):
+    def __init__(self, total, n, p, failures=0, interrupted=0):
         if not failures:
             OperationCompleted.__init__(self, total, "Building Succeeded")
         else:
             OperationCompleted.__init__(self, total, "Building Failed")
+        self._interrupted = interrupted
         BuildBase.__init__(self, n, p, failures)
 
 class DiskFull(Event):
-- 
2.1.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-08-26 12:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-26 12:50 [PATCH 0/1] Allow BuildCompleted listeners to know if build was interrupted Paul Eggleton
2015-08-26 12:50 ` [PATCH 1/1] lib/bb/cooker: add interrupted flag to BuildCompleted event Paul Eggleton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox