summaryrefslogtreecommitdiffstats
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-01-19 23:03:43 +0000
commite222be06386698e24c664171bd6a1ea07bf28efa (patch)
treea8f5263f1ef750448d5326d4bfc73458e58ffb8b
parente4d21837cd1ff449c9be2ff9c7cc014216948bcf (diff)
downloadpoky-e222be06386698e24c664171bd6a1ea07bf28efa.tar.gz
bitbake: build: Tweak exception handling for setscene tasks
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. (Bitbake rev: 41dcdc61eb40def8c14a42e8d7bb9ce5a34afa57) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/build.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py
index d6418e40b3..65b7fc000d 100644
--- a/bitbake/lib/bb/build.py
+++ b/bitbake/lib/bb/build.py
@@ -714,19 +714,23 @@ def _exec_task(fn, task, d, quieterr):
714 logger.debug2("Zero size logfn %s, removing", logfn) 714 logger.debug2("Zero size logfn %s, removing", logfn)
715 bb.utils.remove(logfn) 715 bb.utils.remove(logfn)
716 bb.utils.remove(loglink) 716 bb.utils.remove(loglink)
717 except bb.BBHandledException:
718 event.fire(TaskFailed(task, fn, logfn, localdata, True), localdata)
719 return 1
720 except (Exception, SystemExit) as exc: 717 except (Exception, SystemExit) as exc:
718 handled = False
719 if isinstance(exc, bb.BBHandledException):
720 handled = True
721
721 if quieterr: 722 if quieterr:
723 if not handled:
724 logger.warning(repr(exc))
722 event.fire(TaskFailedSilent(task, fn, logfn, localdata), localdata) 725 event.fire(TaskFailedSilent(task, fn, logfn, localdata), localdata)
723 else: 726 else:
724 errprinted = errchk.triggered 727 errprinted = errchk.triggered
725 # If the output is already on stdout, we've printed the information in the 728 # If the output is already on stdout, we've printed the information in the
726 # logs once already so don't duplicate 729 # logs once already so don't duplicate
727 if verboseStdoutLogging: 730 if verboseStdoutLogging or handled:
728 errprinted = True 731 errprinted = True
729 logger.error(repr(exc)) 732 if not handled:
733 logger.error(repr(exc))
730 event.fire(TaskFailed(task, fn, logfn, localdata, errprinted), localdata) 734 event.fire(TaskFailed(task, fn, logfn, localdata, errprinted), localdata)
731 return 1 735 return 1
732 736