summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-08-26 13:50:47 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-29 14:03:49 +0100
commit294948c732b4387375bae36350d8430c5e233590 (patch)
treeceb1c59f15bc49b957d9e85c507a6cff3d844d99 /bitbake/lib
parent7ee503e7c59e24a4a096f0052afb91325f82e663 (diff)
downloadpoky-294948c732b4387375bae36350d8430c5e233590.tar.gz
bitbake: 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). (Bitbake rev: df2b778efd2ecc48f6c5a3ed446f6459f2250035) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/cooker.py10
-rw-r--r--bitbake/lib/bb/event.py3
2 files changed, 10 insertions, 3 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 6dc9f1981d..99c47859d9 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -1319,12 +1319,15 @@ class BBCooker:
1319 def buildFileIdle(server, rq, abort): 1319 def buildFileIdle(server, rq, abort):
1320 1320
1321 msg = None 1321 msg = None
1322 interrupted = 0
1322 if abort or self.state == state.forceshutdown: 1323 if abort or self.state == state.forceshutdown:
1323 rq.finish_runqueue(True) 1324 rq.finish_runqueue(True)
1324 msg = "Forced shutdown" 1325 msg = "Forced shutdown"
1326 interrupted = 2
1325 elif self.state == state.shutdown: 1327 elif self.state == state.shutdown:
1326 rq.finish_runqueue(False) 1328 rq.finish_runqueue(False)
1327 msg = "Stopped build" 1329 msg = "Stopped build"
1330 interrupted = 1
1328 failures = 0 1331 failures = 0
1329 try: 1332 try:
1330 retval = rq.execute_runqueue() 1333 retval = rq.execute_runqueue()
@@ -1336,7 +1339,7 @@ class BBCooker:
1336 return False 1339 return False
1337 1340
1338 if not retval: 1341 if not retval:
1339 bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runq_fnid), buildname, item, failures), self.expanded_data) 1342 bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runq_fnid), buildname, item, failures, interrupted), self.expanded_data)
1340 self.command.finishAsyncCommand(msg) 1343 self.command.finishAsyncCommand(msg)
1341 return False 1344 return False
1342 if retval is True: 1345 if retval is True:
@@ -1352,12 +1355,15 @@ class BBCooker:
1352 1355
1353 def buildTargetsIdle(server, rq, abort): 1356 def buildTargetsIdle(server, rq, abort):
1354 msg = None 1357 msg = None
1358 interrupted = 0
1355 if abort or self.state == state.forceshutdown: 1359 if abort or self.state == state.forceshutdown:
1356 rq.finish_runqueue(True) 1360 rq.finish_runqueue(True)
1357 msg = "Forced shutdown" 1361 msg = "Forced shutdown"
1362 interrupted = 2
1358 elif self.state == state.shutdown: 1363 elif self.state == state.shutdown:
1359 rq.finish_runqueue(False) 1364 rq.finish_runqueue(False)
1360 msg = "Stopped build" 1365 msg = "Stopped build"
1366 interrupted = 1
1361 failures = 0 1367 failures = 0
1362 try: 1368 try:
1363 retval = rq.execute_runqueue() 1369 retval = rq.execute_runqueue()
@@ -1369,7 +1375,7 @@ class BBCooker:
1369 return False 1375 return False
1370 1376
1371 if not retval: 1377 if not retval:
1372 bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runq_fnid), buildname, targets, failures), self.data) 1378 bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runq_fnid), buildname, targets, failures, interrupted), self.data)
1373 self.command.finishAsyncCommand(msg) 1379 self.command.finishAsyncCommand(msg)
1374 return False 1380 return False
1375 if retval is True: 1381 if retval is True:
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index 0e181102c6..3f96bcab32 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -370,11 +370,12 @@ class BuildStarted(BuildBase, OperationStarted):
370 370
371class BuildCompleted(BuildBase, OperationCompleted): 371class BuildCompleted(BuildBase, OperationCompleted):
372 """bbmake build run completed""" 372 """bbmake build run completed"""
373 def __init__(self, total, n, p, failures = 0): 373 def __init__(self, total, n, p, failures=0, interrupted=0):
374 if not failures: 374 if not failures:
375 OperationCompleted.__init__(self, total, "Building Succeeded") 375 OperationCompleted.__init__(self, total, "Building Succeeded")
376 else: 376 else:
377 OperationCompleted.__init__(self, total, "Building Failed") 377 OperationCompleted.__init__(self, total, "Building Failed")
378 self._interrupted = interrupted
378 BuildBase.__init__(self, n, p, failures) 379 BuildBase.__init__(self, n, p, failures)
379 380
380class DiskFull(Event): 381class DiskFull(Event):