summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Larson <chris_larson@mentor.com>2016-10-04 09:11:23 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-10-05 10:28:12 +0100
commit7d27275ef83c38104e898ff259be173ad71743a7 (patch)
tree9a3bf0be2fcb532b913c10187f8d3e10685fc640
parent1110dde73aa04772090ca7b2b21a953d49734fb0 (diff)
downloadpoky-7d27275ef83c38104e898ff259be173ad71743a7.tar.gz
bitbake: bb.build: in _exec_task, catch errors from TaskStarted
We don't always want a traceback when an exception is raised by the TaskStarted event handler. Silently return if we get a SystemExit or HandledException, and print the error and return for FuncFailed. This is done via a separate try/catch block, to avoid firing TaskFailed if all the TaskStarted event handlers didn't complete, otherwise the bitbake UIs get unhappy. (Bitbake rev: ca5b788280ad4303cc08a376e847cbbeda31970c) Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/build.py40
1 files changed, 24 insertions, 16 deletions
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py
index 249f7d6bb4..c4c8aeb645 100644
--- a/bitbake/lib/bb/build.py
+++ b/bitbake/lib/bb/build.py
@@ -565,24 +565,32 @@ def _exec_task(fn, task, d, quieterr):
565 565
566 flags = localdata.getVarFlags(task) 566 flags = localdata.getVarFlags(task)
567 567
568 event.fire(TaskStarted(task, logfn, flags, localdata), localdata)
569 try: 568 try:
570 for func in (prefuncs or '').split(): 569 try:
571 exec_func(func, localdata) 570 event.fire(TaskStarted(task, logfn, flags, localdata), localdata)
572 exec_func(task, localdata) 571 except (bb.BBHandledException, SystemExit):
573 for func in (postfuncs or '').split(): 572 return 1
574 exec_func(func, localdata) 573 except FuncFailed as exc:
575 except FuncFailed as exc:
576 if quieterr:
577 event.fire(TaskFailedSilent(task, logfn, localdata), localdata)
578 else:
579 errprinted = errchk.triggered
580 logger.error(str(exc)) 574 logger.error(str(exc))
581 event.fire(TaskFailed(task, logfn, localdata, errprinted), localdata) 575 return 1
582 return 1 576
583 except bb.BBHandledException: 577 try:
584 event.fire(TaskFailed(task, logfn, localdata, True), localdata) 578 for func in (prefuncs or '').split():
585 return 1 579 exec_func(func, localdata)
580 exec_func(task, localdata)
581 for func in (postfuncs or '').split():
582 exec_func(func, localdata)
583 except FuncFailed as exc:
584 if quieterr:
585 event.fire(TaskFailedSilent(task, logfn, localdata), localdata)
586 else:
587 errprinted = errchk.triggered
588 logger.error(str(exc))
589 event.fire(TaskFailed(task, logfn, localdata, errprinted), localdata)
590 return 1
591 except bb.BBHandledException:
592 event.fire(TaskFailed(task, logfn, localdata, True), localdata)
593 return 1
586 finally: 594 finally:
587 sys.stdout.flush() 595 sys.stdout.flush()
588 sys.stderr.flush() 596 sys.stderr.flush()