aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-01-19 17:41:05 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-03-24 11:03:23 +0000
commit43dcb2b2a2b95a5c959be57bca94fb7190ea6257 (patch)
tree58f34f1cb1bd50f0a4e2ad5f2ef138847a3a8941
parent1bc9f800ffc9b740cc1de0132ed04f07eadb3479 (diff)
downloadbitbake-43dcb2b2a2b95a5c959be57bca94fb7190ea6257.tar.gz
build: Tweak exception handling for setscene tasksyocto-3.4.32021-10.3-honister1.52.3
If an unexpected exception occurs in a setscene task, it is currently hidden from the user and not recorded in any logs. This isn't helpful to debug such failures. Change the code so that even in the "silent" or "quiet" task case (setscene tasks), a warning is shown with the traceback unless it was an "handled" exception. This means the failing function can show it's own warning/error instead if it wants to and then raise a handled event. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 41dcdc61eb40def8c14a42e8d7bb9ce5a34afa57) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/build.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/bb/build.py b/lib/bb/build.py
index 7e4ab9f64..44d1d9d98 100644
--- a/lib/bb/build.py
+++ b/lib/bb/build.py
@@ -715,19 +715,23 @@ def _exec_task(fn, task, d, quieterr):
logger.debug2("Zero size logfn %s, removing", logfn)
bb.utils.remove(logfn)
bb.utils.remove(loglink)
- except bb.BBHandledException:
- event.fire(TaskFailed(task, fn, logfn, localdata, True), localdata)
- return 1
except (Exception, SystemExit) as exc:
+ handled = False
+ if isinstance(exc, bb.BBHandledException):
+ handled = True
+
if quieterr:
+ if not handled:
+ logger.warning(repr(exc))
event.fire(TaskFailedSilent(task, fn, logfn, localdata), localdata)
else:
errprinted = errchk.triggered
# If the output is already on stdout, we've printed the information in the
# logs once already so don't duplicate
- if verboseStdoutLogging:
+ if verboseStdoutLogging or handled:
errprinted = True
- logger.error(repr(exc))
+ if not handled:
+ logger.error(repr(exc))
event.fire(TaskFailed(task, fn, logfn, localdata, errprinted), localdata)
return 1