[oe-commits] [bitbake] 01/02: bb.build: in _exec_task, catch errors from TaskStarted
git at git.openembedded.org
git at git.openembedded.org
Wed Oct 5 09:30:23 UTC 2016
rpurdie pushed a commit to branch master
in repository bitbake.
commit ca5b788280ad4303cc08a376e847cbbeda31970c
Author: Christopher Larson <chris_larson at mentor.com>
AuthorDate: Tue Oct 4 09:11:23 2016 -0700
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.
Signed-off-by: Christopher Larson <chris_larson at mentor.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
lib/bb/build.py | 40 ++++++++++++++++++++++++----------------
1 file changed, 24 insertions(+), 16 deletions(-)
diff --git a/lib/bb/build.py b/lib/bb/build.py
index 249f7d6..c4c8aeb 100644
--- a/lib/bb/build.py
+++ b/lib/bb/build.py
@@ -565,24 +565,32 @@ def _exec_task(fn, task, d, quieterr):
flags = localdata.getVarFlags(task)
- event.fire(TaskStarted(task, logfn, flags, localdata), localdata)
try:
- for func in (prefuncs or '').split():
- exec_func(func, localdata)
- exec_func(task, localdata)
- for func in (postfuncs or '').split():
- exec_func(func, localdata)
- except FuncFailed as exc:
- if quieterr:
- event.fire(TaskFailedSilent(task, logfn, localdata), localdata)
- else:
- errprinted = errchk.triggered
+ try:
+ event.fire(TaskStarted(task, logfn, flags, localdata), localdata)
+ except (bb.BBHandledException, SystemExit):
+ return 1
+ except FuncFailed as exc:
logger.error(str(exc))
- event.fire(TaskFailed(task, logfn, localdata, errprinted), localdata)
- return 1
- except bb.BBHandledException:
- event.fire(TaskFailed(task, logfn, localdata, True), localdata)
- return 1
+ return 1
+
+ try:
+ for func in (prefuncs or '').split():
+ exec_func(func, localdata)
+ exec_func(task, localdata)
+ for func in (postfuncs or '').split():
+ exec_func(func, localdata)
+ except FuncFailed as exc:
+ if quieterr:
+ event.fire(TaskFailedSilent(task, logfn, localdata), localdata)
+ else:
+ errprinted = errchk.triggered
+ logger.error(str(exc))
+ event.fire(TaskFailed(task, logfn, localdata, errprinted), localdata)
+ return 1
+ except bb.BBHandledException:
+ event.fire(TaskFailed(task, logfn, localdata, True), localdata)
+ return 1
finally:
sys.stdout.flush()
sys.stderr.flush()
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list