Allow BuildCompleted listeners to know if build was interrupted
cover Allow BuildCompleted listeners to know if build was interrupted
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(-)
Signature · 1 line
2.1.0
PATCH 1/1 lib/bb/cooker: add interrupted flag to BuildCompleted event
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).
--- lib/bb/cooker.py | 10 ++++++++-- lib/bb/event.py | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-)
lib/bb/cooker.py +8 -2
@@ -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:
lib/bb/event.py +2 -1
@@ -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):
Signature · 1 line
2.1.0