diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-02-16 09:46:46 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-02-17 17:51:03 +0000 |
commit | dac63330e6879a0354449c8ad52f09a888d49d27 (patch) | |
tree | 5cbb15b2c582ace3677836bdf0614e614c853e24 /bitbake/lib/bb/ui/knotty.py | |
parent | 2e20effe31a904c1aa0172291124ebdcf0889598 (diff) | |
download | poky-dac63330e6879a0354449c8ad52f09a888d49d27.tar.gz |
bitbake: msg: Add bb.warnonce() and bb.erroronce() log methods
This adds a log level and logging function call to use it where the
warning or error will only be displayed once, regardless of how many
times the message is logged.
This has to be done either in the cooker or on the UI side. I've opted
for the UI side since display control is really a UI issue but it uses
a common library filter function to enable it which can be reused
elsewhere.
The knotty message displayed as the build summary is tweaked to
make sense when the numbers won't match since it will still count
the number of times it was logged and this is probably helpful
for debugging in some cases so I've deliberately left it that way.
(Bitbake rev: 7bd40e3003a043e3cb7efc276681054b563b5e7b)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui/knotty.py')
-rw-r--r-- | bitbake/lib/bb/ui/knotty.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index 484545a684..8b98da1771 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py | |||
@@ -647,7 +647,7 @@ def main(server, eventHandler, params, tf = TerminalFilter): | |||
647 | if isinstance(event, logging.LogRecord): | 647 | if isinstance(event, logging.LogRecord): |
648 | lastprint = time.time() | 648 | lastprint = time.time() |
649 | printinterval = 5000 | 649 | printinterval = 5000 |
650 | if event.levelno >= bb.msg.BBLogFormatter.ERROR: | 650 | if event.levelno >= bb.msg.BBLogFormatter.ERRORONCE: |
651 | errors = errors + 1 | 651 | errors = errors + 1 |
652 | return_value = 1 | 652 | return_value = 1 |
653 | elif event.levelno == bb.msg.BBLogFormatter.WARNING: | 653 | elif event.levelno == bb.msg.BBLogFormatter.WARNING: |
@@ -661,10 +661,10 @@ def main(server, eventHandler, params, tf = TerminalFilter): | |||
661 | continue | 661 | continue |
662 | 662 | ||
663 | # Prefix task messages with recipe/task | 663 | # Prefix task messages with recipe/task |
664 | if event.taskpid in helper.pidmap and event.levelno != bb.msg.BBLogFormatter.PLAIN: | 664 | if event.taskpid in helper.pidmap and event.levelno not in [bb.msg.BBLogFormatter.PLAIN, bb.msg.BBLogFormatter.WARNONCE, bb.msg.BBLogFormatter.ERRORONCE]: |
665 | taskinfo = helper.running_tasks[helper.pidmap[event.taskpid]] | 665 | taskinfo = helper.running_tasks[helper.pidmap[event.taskpid]] |
666 | event.msg = taskinfo['title'] + ': ' + event.msg | 666 | event.msg = taskinfo['title'] + ': ' + event.msg |
667 | if hasattr(event, 'fn'): | 667 | if hasattr(event, 'fn') and event.levelno not in [bb.msg.BBLogFormatter.WARNONCE, bb.msg.BBLogFormatter.ERRORONCE]: |
668 | event.msg = event.fn + ': ' + event.msg | 668 | event.msg = event.fn + ': ' + event.msg |
669 | logging.getLogger(event.name).handle(event) | 669 | logging.getLogger(event.name).handle(event) |
670 | continue | 670 | continue |
@@ -875,11 +875,11 @@ def main(server, eventHandler, params, tf = TerminalFilter): | |||
875 | for failure in taskfailures: | 875 | for failure in taskfailures: |
876 | summary += "\n %s" % failure | 876 | summary += "\n %s" % failure |
877 | if warnings: | 877 | if warnings: |
878 | summary += pluralise("\nSummary: There was %s WARNING message shown.", | 878 | summary += pluralise("\nSummary: There was %s WARNING message.", |
879 | "\nSummary: There were %s WARNING messages shown.", warnings) | 879 | "\nSummary: There were %s WARNING messages.", warnings) |
880 | if return_value and errors: | 880 | if return_value and errors: |
881 | summary += pluralise("\nSummary: There was %s ERROR message shown, returning a non-zero exit code.", | 881 | summary += pluralise("\nSummary: There was %s ERROR message, returning a non-zero exit code.", |
882 | "\nSummary: There were %s ERROR messages shown, returning a non-zero exit code.", errors) | 882 | "\nSummary: There were %s ERROR messages, returning a non-zero exit code.", errors) |
883 | if summary and params.options.quiet == 0: | 883 | if summary and params.options.quiet == 0: |
884 | print(summary) | 884 | print(summary) |
885 | 885 | ||