summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorChris Laplante <chris.laplante@agilent.com>2024-08-19 10:36:12 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-08-23 09:48:48 +0100
commitad2365a3df5f516336767758acd2d97bc23fe3a2 (patch)
treef906dd36c708b391b26690aa57fc9ba4afc0eeb8 /bitbake/lib
parentb463c544ae146682c26b000dc0faa3db2bd62d62 (diff)
downloadpoky-ad2365a3df5f516336767758acd2d97bc23fe3a2.tar.gz
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: 2852a478ab03a482989c3a7e247860ab4f0e9f3e) Signed-off-by: Chris Laplante <chris.laplante@agilent.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/ui/knotty.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index f86999bb09..5956ab177c 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -640,7 +640,7 @@ def main(server, eventHandler, params, tf = TerminalFilter):
640 return_value = 0 640 return_value = 0
641 errors = 0 641 errors = 0
642 warnings = 0 642 warnings = 0
643 taskfailures = [] 643 taskfailures = {}
644 644
645 printintervaldelta = 10 * 60 # 10 minutes 645 printintervaldelta = 10 * 60 # 10 minutes
646 printinterval = printintervaldelta 646 printinterval = printintervaldelta
@@ -726,6 +726,8 @@ def main(server, eventHandler, params, tf = TerminalFilter):
726 if isinstance(event, bb.build.TaskFailed): 726 if isinstance(event, bb.build.TaskFailed):
727 return_value = 1 727 return_value = 1
728 print_event_log(event, includelogs, loglines, termfilter) 728 print_event_log(event, includelogs, loglines, termfilter)
729 k = "{}:{}".format(event._fn, event._task)
730 taskfailures[k] = event.logfile
729 if isinstance(event, bb.build.TaskBase): 731 if isinstance(event, bb.build.TaskBase):
730 logger.info(event._message) 732 logger.info(event._message)
731 continue 733 continue
@@ -821,7 +823,7 @@ def main(server, eventHandler, params, tf = TerminalFilter):
821 823
822 if isinstance(event, bb.runqueue.runQueueTaskFailed): 824 if isinstance(event, bb.runqueue.runQueueTaskFailed):
823 return_value = 1 825 return_value = 1
824 taskfailures.append(event.taskstring) 826 taskfailures.setdefault(event.taskstring)
825 logger.error(str(event)) 827 logger.error(str(event))
826 continue 828 continue
827 829
@@ -942,11 +944,19 @@ def main(server, eventHandler, params, tf = TerminalFilter):
942 try: 944 try:
943 termfilter.clearFooter() 945 termfilter.clearFooter()
944 summary = "" 946 summary = ""
947 def print_hyperlink(url, link_text):
948 start = f'\033]8;;{url}\033\\'
949 end = '\033]8;;\033\\'
950 return f'{start}{link_text}{end}'
951
945 if taskfailures: 952 if taskfailures:
946 summary += pluralise("\nSummary: %s task failed:", 953 summary += pluralise("\nSummary: %s task failed:",
947 "\nSummary: %s tasks failed:", len(taskfailures)) 954 "\nSummary: %s tasks failed:", len(taskfailures))
948 for failure in taskfailures: 955 for (failure, log_file) in taskfailures.items():
949 summary += "\n %s" % failure 956 summary += "\n %s" % failure
957 if log_file:
958 hyperlink = print_hyperlink(f"file://{log_file}", log_file)
959 summary += "\n log: {}".format(hyperlink)
950 if warnings: 960 if warnings:
951 summary += pluralise("\nSummary: There was %s WARNING message.", 961 summary += pluralise("\nSummary: There was %s WARNING message.",
952 "\nSummary: There were %s WARNING messages.", warnings) 962 "\nSummary: There were %s WARNING messages.", warnings)