diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-12-13 20:07:01 +1300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-12-14 12:25:06 +0000 |
commit | 568409faa1e0735467f08fc1bff0c925c8bf80c5 (patch) | |
tree | b8169364ca1ab70c639196193b33c7d1a4c303c1 | |
parent | 3fa98e19d5817ae7cf9607e4cda9cf2a808c320d (diff) | |
download | poky-568409faa1e0735467f08fc1bff0c925c8bf80c5.tar.gz |
bitbake: knotty: make quiet option a level option
Allow you to specify -q / --quiet more than once to reduce the messages
even further. It will now operate as follows:
Level Option Result
----- ------ ----------------------------------------
0 Print usual output
1 -q Only show progress and warnings or above
2 -qq Only show warnings or above
3+ -qqq Only show errors
(Bitbake rev: 6cf2582e17c28ca04f5cfb59858c4a9778c700d4)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-x | bitbake/lib/bb/main.py | 4 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/knotty.py | 35 |
2 files changed, 30 insertions, 9 deletions
diff --git a/bitbake/lib/bb/main.py b/bitbake/lib/bb/main.py index f2f59f670a..a544c0aecb 100755 --- a/bitbake/lib/bb/main.py +++ b/bitbake/lib/bb/main.py | |||
@@ -179,8 +179,8 @@ class BitBakeConfigParameters(cookerdata.ConfigParameters): | |||
179 | parser.add_option("-D", "--debug", action="count", dest="debug", default=0, | 179 | parser.add_option("-D", "--debug", action="count", dest="debug", default=0, |
180 | help="Increase the debug level. You can specify this more than once.") | 180 | help="Increase the debug level. You can specify this more than once.") |
181 | 181 | ||
182 | parser.add_option("-q", "--quiet", action="store_true", dest="quiet", default=False, | 182 | parser.add_option("-q", "--quiet", action="count", dest="quiet", default=0, |
183 | help="Output less log message data to the terminal.") | 183 | help="Output less log message data to the terminal. You can specify this more than once.") |
184 | 184 | ||
185 | parser.add_option("-n", "--dry-run", action="store_true", dest="dry_run", default=False, | 185 | parser.add_option("-n", "--dry-run", action="store_true", dest="dry_run", default=False, |
186 | help="Don't execute, just go through the motions.") | 186 | help="Don't execute, just go through the motions.") |
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index 48e1223c6b..3390eb73ac 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py | |||
@@ -284,7 +284,7 @@ class TerminalFilter(object): | |||
284 | content = self.main_progress.update(progress) | 284 | content = self.main_progress.update(progress) |
285 | print('') | 285 | print('') |
286 | lines = 1 + int(len(content) / (self.columns + 1)) | 286 | lines = 1 + int(len(content) / (self.columns + 1)) |
287 | if not self.quiet: | 287 | if self.quiet == 0: |
288 | for tasknum, task in enumerate(tasks[:(self.rows - 2)]): | 288 | for tasknum, task in enumerate(tasks[:(self.rows - 2)]): |
289 | if isinstance(task, tuple): | 289 | if isinstance(task, tuple): |
290 | pbar, progress, rate, start_time = task | 290 | pbar, progress, rate, start_time = task |
@@ -353,10 +353,13 @@ def main(server, eventHandler, params, tf = TerminalFilter): | |||
353 | errconsole = logging.StreamHandler(sys.stderr) | 353 | errconsole = logging.StreamHandler(sys.stderr) |
354 | format_str = "%(levelname)s: %(message)s" | 354 | format_str = "%(levelname)s: %(message)s" |
355 | format = bb.msg.BBLogFormatter(format_str) | 355 | format = bb.msg.BBLogFormatter(format_str) |
356 | if params.options.quiet: | 356 | if params.options.quiet == 0: |
357 | bb.msg.addDefaultlogFilter(console, bb.msg.BBLogFilterStdOut, bb.msg.BBLogFormatter.WARNING) | 357 | forcelevel = None |
358 | elif params.options.quiet > 2: | ||
359 | forcelevel = bb.msg.BBLogFormatter.ERROR | ||
358 | else: | 360 | else: |
359 | bb.msg.addDefaultlogFilter(console, bb.msg.BBLogFilterStdOut) | 361 | forcelevel = bb.msg.BBLogFormatter.WARNING |
362 | bb.msg.addDefaultlogFilter(console, bb.msg.BBLogFilterStdOut, forcelevel) | ||
360 | bb.msg.addDefaultlogFilter(errconsole, bb.msg.BBLogFilterStdErr) | 363 | bb.msg.addDefaultlogFilter(errconsole, bb.msg.BBLogFilterStdErr) |
361 | console.setFormatter(format) | 364 | console.setFormatter(format) |
362 | errconsole.setFormatter(format) | 365 | errconsole.setFormatter(format) |
@@ -506,35 +509,47 @@ def main(server, eventHandler, params, tf = TerminalFilter): | |||
506 | logger.info(event._message) | 509 | logger.info(event._message) |
507 | continue | 510 | continue |
508 | if isinstance(event, bb.event.ParseStarted): | 511 | if isinstance(event, bb.event.ParseStarted): |
512 | if params.options.quiet > 1: | ||
513 | continue | ||
509 | if event.total == 0: | 514 | if event.total == 0: |
510 | continue | 515 | continue |
511 | parseprogress = new_progress("Parsing recipes", event.total).start() | 516 | parseprogress = new_progress("Parsing recipes", event.total).start() |
512 | continue | 517 | continue |
513 | if isinstance(event, bb.event.ParseProgress): | 518 | if isinstance(event, bb.event.ParseProgress): |
519 | if params.options.quiet > 1: | ||
520 | continue | ||
514 | if parseprogress: | 521 | if parseprogress: |
515 | parseprogress.update(event.current) | 522 | parseprogress.update(event.current) |
516 | else: | 523 | else: |
517 | bb.warn("Got ParseProgress event for parsing that never started?") | 524 | bb.warn("Got ParseProgress event for parsing that never started?") |
518 | continue | 525 | continue |
519 | if isinstance(event, bb.event.ParseCompleted): | 526 | if isinstance(event, bb.event.ParseCompleted): |
527 | if params.options.quiet > 1: | ||
528 | continue | ||
520 | if not parseprogress: | 529 | if not parseprogress: |
521 | continue | 530 | continue |
522 | parseprogress.finish() | 531 | parseprogress.finish() |
523 | pasreprogress = None | 532 | pasreprogress = None |
524 | if not params.options.quiet: | 533 | if params.options.quiet == 0: |
525 | print(("Parsing of %d .bb files complete (%d cached, %d parsed). %d targets, %d skipped, %d masked, %d errors." | 534 | print(("Parsing of %d .bb files complete (%d cached, %d parsed). %d targets, %d skipped, %d masked, %d errors." |
526 | % ( event.total, event.cached, event.parsed, event.virtuals, event.skipped, event.masked, event.errors))) | 535 | % ( event.total, event.cached, event.parsed, event.virtuals, event.skipped, event.masked, event.errors))) |
527 | continue | 536 | continue |
528 | 537 | ||
529 | if isinstance(event, bb.event.CacheLoadStarted): | 538 | if isinstance(event, bb.event.CacheLoadStarted): |
539 | if params.options.quiet > 1: | ||
540 | continue | ||
530 | cacheprogress = new_progress("Loading cache", event.total).start() | 541 | cacheprogress = new_progress("Loading cache", event.total).start() |
531 | continue | 542 | continue |
532 | if isinstance(event, bb.event.CacheLoadProgress): | 543 | if isinstance(event, bb.event.CacheLoadProgress): |
544 | if params.options.quiet > 1: | ||
545 | continue | ||
533 | cacheprogress.update(event.current) | 546 | cacheprogress.update(event.current) |
534 | continue | 547 | continue |
535 | if isinstance(event, bb.event.CacheLoadCompleted): | 548 | if isinstance(event, bb.event.CacheLoadCompleted): |
549 | if params.options.quiet > 1: | ||
550 | continue | ||
536 | cacheprogress.finish() | 551 | cacheprogress.finish() |
537 | if not params.options.quiet: | 552 | if params.options.quiet == 0: |
538 | print("Loaded %d entries from dependency cache." % event.num_entries) | 553 | print("Loaded %d entries from dependency cache." % event.num_entries) |
539 | continue | 554 | continue |
540 | 555 | ||
@@ -620,16 +635,22 @@ def main(server, eventHandler, params, tf = TerminalFilter): | |||
620 | continue | 635 | continue |
621 | 636 | ||
622 | if isinstance(event, bb.event.ProcessStarted): | 637 | if isinstance(event, bb.event.ProcessStarted): |
638 | if params.options.quiet > 1: | ||
639 | continue | ||
623 | parseprogress = new_progress(event.processname, event.total) | 640 | parseprogress = new_progress(event.processname, event.total) |
624 | parseprogress.start(False) | 641 | parseprogress.start(False) |
625 | continue | 642 | continue |
626 | if isinstance(event, bb.event.ProcessProgress): | 643 | if isinstance(event, bb.event.ProcessProgress): |
644 | if params.options.quiet > 1: | ||
645 | continue | ||
627 | if parseprogress: | 646 | if parseprogress: |
628 | parseprogress.update(event.progress) | 647 | parseprogress.update(event.progress) |
629 | else: | 648 | else: |
630 | bb.warn("Got ProcessProgress event for someting that never started?") | 649 | bb.warn("Got ProcessProgress event for someting that never started?") |
631 | continue | 650 | continue |
632 | if isinstance(event, bb.event.ProcessFinished): | 651 | if isinstance(event, bb.event.ProcessFinished): |
652 | if params.options.quiet > 1: | ||
653 | continue | ||
633 | if parseprogress: | 654 | if parseprogress: |
634 | parseprogress.finish() | 655 | parseprogress.finish() |
635 | parseprogress = None | 656 | parseprogress = None |
@@ -701,7 +722,7 @@ def main(server, eventHandler, params, tf = TerminalFilter): | |||
701 | if return_value and errors: | 722 | if return_value and errors: |
702 | summary += pluralise("\nSummary: There was %s ERROR message shown, returning a non-zero exit code.", | 723 | summary += pluralise("\nSummary: There was %s ERROR message shown, returning a non-zero exit code.", |
703 | "\nSummary: There were %s ERROR messages shown, returning a non-zero exit code.", errors) | 724 | "\nSummary: There were %s ERROR messages shown, returning a non-zero exit code.", errors) |
704 | if summary and not params.options.quiet: | 725 | if summary and params.options.quiet == 0: |
705 | print(summary) | 726 | print(summary) |
706 | 727 | ||
707 | if interrupted: | 728 | if interrupted: |