mirror of
https://git.yoctoproject.org/poky
synced 2026-01-29 21:08:42 +01:00
bitbake: ui/knotty: print log paths for failed tasks in summary
When tasks fail, it's very frustrating to have to scroll up to find the
log path(s). Many of us have the muscle memory to navigate to the 'temp'
directories under tmp/work/, but new users do not.
This change enhances the final summary to include log paths (reported
via bb.build.TaskFailed events). Here's an example:
NOTE: Tasks Summary: Attempted 856 tasks of which 853 didn't need to be rerun and 3 failed.
Summary: 3 tasks failed:
virtual:native:/home/chris/repos/poky/meta/recipes-core/ncurses/ncurses_6.5.bb:do_fetch
log: /home/chris/repos/poky/build/tmp/work/x86_64-linux/ncurses-native/6.5/temp/log.do_fetch.1253462
/home/chris/repos/poky/meta/recipes-core/ncurses/ncurses_6.5.bb:do_fetch
log: /home/chris/repos/poky/build/tmp/work/core2-64-poky-linux/ncurses/6.5/temp/log.do_fetch.1253466
virtual:nativesdk:/home/chris/repos/poky/meta/recipes-core/ncurses/ncurses_6.5.bb:do_fetch
log: /home/chris/repos/poky/build/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-ncurses/6.5/temp/log.do_fetch.1253467
Summary: There were 3 WARNING messages.
Summary: There were 6 ERROR messages, returning a non-zero exit code.
Each log is rendered as a clickable hyperlink in the terminal. See
https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
(Bitbake rev: 9c020cc314bfd0702bb1d457d94925c6e9613268)
Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
This commit is contained in:
committed by
Steve Sakoman
parent
2240b92d62
commit
50556a2878
@@ -640,7 +640,7 @@ def main(server, eventHandler, params, tf = TerminalFilter):
|
|||||||
return_value = 0
|
return_value = 0
|
||||||
errors = 0
|
errors = 0
|
||||||
warnings = 0
|
warnings = 0
|
||||||
taskfailures = []
|
taskfailures = {}
|
||||||
|
|
||||||
printintervaldelta = 10 * 60 # 10 minutes
|
printintervaldelta = 10 * 60 # 10 minutes
|
||||||
printinterval = printintervaldelta
|
printinterval = printintervaldelta
|
||||||
@@ -726,6 +726,8 @@ def main(server, eventHandler, params, tf = TerminalFilter):
|
|||||||
if isinstance(event, bb.build.TaskFailed):
|
if isinstance(event, bb.build.TaskFailed):
|
||||||
return_value = 1
|
return_value = 1
|
||||||
print_event_log(event, includelogs, loglines, termfilter)
|
print_event_log(event, includelogs, loglines, termfilter)
|
||||||
|
k = "{}:{}".format(event._fn, event._task)
|
||||||
|
taskfailures[k] = event.logfile
|
||||||
if isinstance(event, bb.build.TaskBase):
|
if isinstance(event, bb.build.TaskBase):
|
||||||
logger.info(event._message)
|
logger.info(event._message)
|
||||||
continue
|
continue
|
||||||
@@ -821,7 +823,7 @@ def main(server, eventHandler, params, tf = TerminalFilter):
|
|||||||
|
|
||||||
if isinstance(event, bb.runqueue.runQueueTaskFailed):
|
if isinstance(event, bb.runqueue.runQueueTaskFailed):
|
||||||
return_value = 1
|
return_value = 1
|
||||||
taskfailures.append(event.taskstring)
|
taskfailures.setdefault(event.taskstring)
|
||||||
logger.error(str(event))
|
logger.error(str(event))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@@ -942,11 +944,19 @@ def main(server, eventHandler, params, tf = TerminalFilter):
|
|||||||
try:
|
try:
|
||||||
termfilter.clearFooter()
|
termfilter.clearFooter()
|
||||||
summary = ""
|
summary = ""
|
||||||
|
def print_hyperlink(url, link_text):
|
||||||
|
start = f'\033]8;;{url}\033\\'
|
||||||
|
end = '\033]8;;\033\\'
|
||||||
|
return f'{start}{link_text}{end}'
|
||||||
|
|
||||||
if taskfailures:
|
if taskfailures:
|
||||||
summary += pluralise("\nSummary: %s task failed:",
|
summary += pluralise("\nSummary: %s task failed:",
|
||||||
"\nSummary: %s tasks failed:", len(taskfailures))
|
"\nSummary: %s tasks failed:", len(taskfailures))
|
||||||
for failure in taskfailures:
|
for (failure, log_file) in taskfailures.items():
|
||||||
summary += "\n %s" % failure
|
summary += "\n %s" % failure
|
||||||
|
if log_file:
|
||||||
|
hyperlink = print_hyperlink(f"file://{log_file}", log_file)
|
||||||
|
summary += "\n log: {}".format(hyperlink)
|
||||||
if warnings:
|
if warnings:
|
||||||
summary += pluralise("\nSummary: There was %s WARNING message.",
|
summary += pluralise("\nSummary: There was %s WARNING message.",
|
||||||
"\nSummary: There were %s WARNING messages.", warnings)
|
"\nSummary: There were %s WARNING messages.", warnings)
|
||||||
|
|||||||
Reference in New Issue
Block a user