bitbake: build/exec_task: Log str() instead of repr() for exceptions in build

When getting errors during build, they would be printed using repr(), which
doesnt have a lot of context in some cases.
For example FileNotFoundError(2, "file or directory not found"), would be
printed, without the path of the file not found.
This changes the build logging to use str() instead, which according to
the spec is fore human readable strings, whereas repr() is for string
representations that can be be used as valid python.

(Bitbake rev: 2a97024b8b9245ec47deace011a7560a25491207)

Signed-off-by: Troels Dalsgaard Hoffmeyer <tdah@bang-olufsen.dk>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Troels Dalsgaard Hoffmeyer
2024-08-09 13:50:13 +02:00
committed by Richard Purdie
parent 96b61275be
commit 67efcf3102

View File

@@ -743,7 +743,7 @@ def _exec_task(fn, task, d, quieterr):
if quieterr:
if not handled:
logger.warning(repr(exc))
logger.warning(str(exc))
event.fire(TaskFailedSilent(task, fn, logfn, localdata), localdata)
else:
errprinted = errchk.triggered
@@ -752,7 +752,7 @@ def _exec_task(fn, task, d, quieterr):
if verboseStdoutLogging or handled:
errprinted = True
if not handled:
logger.error(repr(exc))
logger.error(str(exc))
event.fire(TaskFailed(task, fn, logfn, localdata, errprinted), localdata)
return 1