summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2017-08-07 12:03:44 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-08-09 09:24:15 +0100
commit1cce7f885cf143370c989381ae8c8f4833e7cbd6 (patch)
treea0ecf0b0e12449d2d98f1b539bb32219f4ba5e2c /scripts
parent534eceb89061a6e756d5dbb8222a6ba1b25d2cd5 (diff)
downloadpoky-1cce7f885cf143370c989381ae8c8f4833e7cbd6.tar.gz
devtool: fix handling of errors during task execution
* If an error is logged while executing a task, we need to ensure we exit instead of assuming everything went OK. * If we receive CookerExit, the server is shutting down and we need to stop waiting for events and probably exit (knotty does this). This will occur if an exception or bb.fatal() happens during an event handler. This fixes a couple of issues highlighted when using devtool upgrade or modify on a non-supported recipe with intel-iot-refkit together with bitbake master, but I'd be very surprised if it were hard to reproduce in other scenarios. (From OE-Core rev: 65e644368fc9c294af96906528ee0cf30305e0a6) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/devtool/standard.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 22a9ec82c9..ec192238ed 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -498,18 +498,24 @@ def _extract_source(srctree, keep_temp, devbranch, sync, d, tinfoil):
498 'logging.LogRecord', 498 'logging.LogRecord',
499 'bb.command.CommandCompleted', 499 'bb.command.CommandCompleted',
500 'bb.command.CommandFailed', 500 'bb.command.CommandFailed',
501 'bb.cooker.CookerExit',
501 'bb.build.TaskStarted', 502 'bb.build.TaskStarted',
502 'bb.build.TaskSucceeded', 503 'bb.build.TaskSucceeded',
503 'bb.build.TaskFailed', 504 'bb.build.TaskFailed',
504 'bb.build.TaskFailedSilent']) 505 'bb.build.TaskFailedSilent'])
505 506
506 def runtask(target, task): 507 def runtask(target, task):
508 error = False
507 if tinfoil.build_file(target, task): 509 if tinfoil.build_file(target, task):
508 while True: 510 while True:
509 event = tinfoil.wait_event(0.25) 511 event = tinfoil.wait_event(0.25)
510 if event: 512 if event:
511 if isinstance(event, bb.command.CommandCompleted): 513 if isinstance(event, bb.command.CommandCompleted):
512 break 514 break
515 elif isinstance(event, bb.cooker.CookerExit):
516 # The server is going away, so drop the connection
517 tinfoil.server_connection = None
518 break
513 elif isinstance(event, bb.command.CommandFailed): 519 elif isinstance(event, bb.command.CommandFailed):
514 raise DevtoolError('Task do_%s failed: %s' % (task, event.error)) 520 raise DevtoolError('Task do_%s failed: %s' % (task, event.error))
515 elif isinstance(event, bb.build.TaskFailed): 521 elif isinstance(event, bb.build.TaskFailed):
@@ -519,7 +525,11 @@ def _extract_source(srctree, keep_temp, devbranch, sync, d, tinfoil):
519 elif isinstance(event, logging.LogRecord): 525 elif isinstance(event, logging.LogRecord):
520 if event.levelno <= logging.INFO: 526 if event.levelno <= logging.INFO:
521 continue 527 continue
528 if event.levelno >= logging.ERROR:
529 error = True
522 logger.handle(event) 530 logger.handle(event)
531 if error:
532 raise DevtoolError('An error occurred during do_%s, exiting' % task)
523 533
524 # we need virtual:native:/path/to/recipe if it's a BBCLASSEXTEND 534 # we need virtual:native:/path/to/recipe if it's a BBCLASSEXTEND
525 fn = tinfoil.get_recipe_file(pn) 535 fn = tinfoil.get_recipe_file(pn)