diff options
author | Bob Foerster <rfoerster@layerzero.com> | 2010-11-22 10:13:56 -0500 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2011-01-04 14:46:51 +0000 |
commit | 2735a70ece44fa55282fb99e4f63c4ac269b07ac (patch) | |
tree | bca01db2dee721a0cfe8924f916d2ca16ba0a541 /bitbake/lib/bb/ui | |
parent | 89a1b59d9a0c2ba7ec62dad41822dd7fdd831a81 (diff) | |
download | openembedded-core-2735a70ece44fa55282fb99e4f63c4ac269b07ac.tar.gz openembedded-core-2735a70ece44fa55282fb99e4f63c4ac269b07ac.tar.bz2 openembedded-core-2735a70ece44fa55282fb99e4f63c4ac269b07ac.tar.xz openembedded-core-2735a70ece44fa55282fb99e4f63c4ac269b07ac.zip |
Show the user progress when loading the cache
(Bitbake rev: bdd7813d8eecf7b6b636322e748ca6bf69118513)
Signed-off-by: Bob Foerster <robert@erafx.com>
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/ui')
-rw-r--r-- | bitbake/lib/bb/ui/knotty.py | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index 69a84f783..b9ad34f16 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py @@ -31,12 +31,14 @@ from bb import ui from bb.ui import uihelper logger = logging.getLogger("BitBake") -widgets = [progressbar.Percentage(), ' ', progressbar.Bar(), ' ', - progressbar.ETA()] +interactive = sys.stdout.isatty() class BBProgress(progressbar.ProgressBar): def __init__(self, msg, maxval): self.msg = msg + widgets = [progressbar.Percentage(), ' ', progressbar.Bar(), ' ', + progressbar.ETA()] + progressbar.ProgressBar.__init__(self, maxval, [self.msg + ": "] + widgets) class NonInteractiveProgress(object): @@ -58,6 +60,12 @@ class NonInteractiveProgress(object): self.fobj.write("done.\n") self.fobj.flush() +def new_progress(msg, maxval): + if interactive: + return BBProgress(msg, maxval) + else: + return NonInteractiveProgress(msg, maxval) + def main(server, eventHandler): # Get values of variables which control our output @@ -93,8 +101,9 @@ def main(server, eventHandler): print("XMLRPC Fault getting commandline:\n %s" % x) return 1 + parseprogress = None - interactive = os.isatty(sys.stdout.fileno()) + cacheprogress = None shutdown = 0 return_value = 0 while True: @@ -149,11 +158,7 @@ def main(server, eventHandler): logger.info(event._message) continue if isinstance(event, bb.event.ParseStarted): - if interactive: - progress = BBProgress - else: - progress = NonInteractiveProgress - parseprogress = progress("Parsing recipes", event.total).start() + parseprogress = new_progress("Parsing recipes", event.total).start() continue if isinstance(event, bb.event.ParseProgress): parseprogress.update(event.current) @@ -164,6 +169,17 @@ def main(server, eventHandler): % ( event.total, event.cached, event.parsed, event.virtuals, event.skipped, event.masked, event.errors))) continue + if isinstance(event, bb.event.CacheLoadStarted): + cacheprogress = new_progress("Loading cache", event.total).start() + continue + if isinstance(event, bb.event.CacheLoadProgress): + cacheprogress.update(event.current) + continue + if isinstance(event, bb.event.CacheLoadCompleted): + cacheprogress.finish() + print("Loaded %d entries from dependency cache." % event.num_entries) + continue + if isinstance(event, bb.command.CommandCompleted): break if isinstance(event, bb.command.CommandFailed): |