diff options
Diffstat (limited to 'bitbake/lib/bb/ui/knotty.py')
| -rw-r--r-- | bitbake/lib/bb/ui/knotty.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index 177a12609c..a34991bb68 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py | |||
| @@ -25,11 +25,13 @@ import sys | |||
| 25 | import itertools | 25 | import itertools |
| 26 | import xmlrpclib | 26 | import xmlrpclib |
| 27 | import logging | 27 | import logging |
| 28 | import progressbar | ||
| 28 | from bb import ui | 29 | from bb import ui |
| 29 | from bb.ui import uihelper | 30 | from bb.ui import uihelper |
| 30 | 31 | ||
| 31 | logger = logging.getLogger("BitBake") | 32 | logger = logging.getLogger("BitBake") |
| 32 | parsespin = itertools.cycle( r'|/-\\' ) | 33 | widgets = ['Parsing recipes: ', progressbar.Percentage(), ' ', |
| 34 | progressbar.Bar(), ' ', progressbar.ETA()] | ||
| 33 | 35 | ||
| 34 | class BBLogFormatter(logging.Formatter): | 36 | class BBLogFormatter(logging.Formatter): |
| 35 | """Formatter which ensures that our 'plain' messages (logging.INFO + 1) are used as is""" | 37 | """Formatter which ensures that our 'plain' messages (logging.INFO + 1) are used as is""" |
| @@ -75,6 +77,7 @@ def init(server, eventHandler): | |||
| 75 | print("XMLRPC Fault getting commandline:\n %s" % x) | 77 | print("XMLRPC Fault getting commandline:\n %s" % x) |
| 76 | return 1 | 78 | return 1 |
| 77 | 79 | ||
| 80 | pbar = None | ||
| 78 | shutdown = 0 | 81 | shutdown = 0 |
| 79 | return_value = 0 | 82 | return_value = 0 |
| 80 | while True: | 83 | while True: |
| @@ -130,19 +133,20 @@ def init(server, eventHandler): | |||
| 130 | logger.info(event._message) | 133 | logger.info(event._message) |
| 131 | continue | 134 | continue |
| 132 | if isinstance(event, bb.event.ParseProgress): | 135 | if isinstance(event, bb.event.ParseProgress): |
| 133 | x = event.sofar | 136 | current, total = event.sofar, event.total |
| 134 | y = event.total | ||
| 135 | if os.isatty(sys.stdout.fileno()): | 137 | if os.isatty(sys.stdout.fileno()): |
| 136 | sys.stdout.write("\rNOTE: Handling BitBake files: %s (%04d/%04d) [%2d %%]" % ( next(parsespin), x, y, x*100//y ) ) | 138 | if not pbar: |
| 137 | sys.stdout.flush() | 139 | pbar = progressbar.ProgressBar(widgets=widgets, |
| 140 | maxval=total).start() | ||
| 141 | pbar.update(current) | ||
| 138 | else: | 142 | else: |
| 139 | if x == 1: | 143 | if current == 1: |
| 140 | sys.stdout.write("Parsing .bb files, please wait...") | 144 | sys.stdout.write("Parsing .bb files, please wait...") |
| 141 | sys.stdout.flush() | 145 | sys.stdout.flush() |
| 142 | if x == y: | 146 | if current == total: |
| 143 | sys.stdout.write("done.") | 147 | sys.stdout.write("done.") |
| 144 | sys.stdout.flush() | 148 | sys.stdout.flush() |
| 145 | if x == y: | 149 | if current == total: |
| 146 | print(("\nParsing of %d .bb files complete (%d cached, %d parsed). %d targets, %d skipped, %d masked, %d errors." | 150 | print(("\nParsing of %d .bb files complete (%d cached, %d parsed). %d targets, %d skipped, %d masked, %d errors." |
| 147 | % ( event.total, event.cached, event.parsed, event.virtuals, event.skipped, event.masked, event.errors))) | 151 | % ( event.total, event.cached, event.parsed, event.virtuals, event.skipped, event.masked, event.errors))) |
| 148 | continue | 152 | continue |
