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 | poky-2735a70ece44fa55282fb99e4f63c4ac269b07ac.tar.gz |
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 69a84f7830..b9ad34f16a 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py | |||
@@ -31,12 +31,14 @@ from bb import ui | |||
31 | from bb.ui import uihelper | 31 | from bb.ui import uihelper |
32 | 32 | ||
33 | logger = logging.getLogger("BitBake") | 33 | logger = logging.getLogger("BitBake") |
34 | widgets = [progressbar.Percentage(), ' ', progressbar.Bar(), ' ', | 34 | interactive = sys.stdout.isatty() |
35 | progressbar.ETA()] | ||
36 | 35 | ||
37 | class BBProgress(progressbar.ProgressBar): | 36 | class BBProgress(progressbar.ProgressBar): |
38 | def __init__(self, msg, maxval): | 37 | def __init__(self, msg, maxval): |
39 | self.msg = msg | 38 | self.msg = msg |
39 | widgets = [progressbar.Percentage(), ' ', progressbar.Bar(), ' ', | ||
40 | progressbar.ETA()] | ||
41 | |||
40 | progressbar.ProgressBar.__init__(self, maxval, [self.msg + ": "] + widgets) | 42 | progressbar.ProgressBar.__init__(self, maxval, [self.msg + ": "] + widgets) |
41 | 43 | ||
42 | class NonInteractiveProgress(object): | 44 | class NonInteractiveProgress(object): |
@@ -58,6 +60,12 @@ class NonInteractiveProgress(object): | |||
58 | self.fobj.write("done.\n") | 60 | self.fobj.write("done.\n") |
59 | self.fobj.flush() | 61 | self.fobj.flush() |
60 | 62 | ||
63 | def new_progress(msg, maxval): | ||
64 | if interactive: | ||
65 | return BBProgress(msg, maxval) | ||
66 | else: | ||
67 | return NonInteractiveProgress(msg, maxval) | ||
68 | |||
61 | def main(server, eventHandler): | 69 | def main(server, eventHandler): |
62 | 70 | ||
63 | # Get values of variables which control our output | 71 | # Get values of variables which control our output |
@@ -93,8 +101,9 @@ def main(server, eventHandler): | |||
93 | print("XMLRPC Fault getting commandline:\n %s" % x) | 101 | print("XMLRPC Fault getting commandline:\n %s" % x) |
94 | return 1 | 102 | return 1 |
95 | 103 | ||
104 | |||
96 | parseprogress = None | 105 | parseprogress = None |
97 | interactive = os.isatty(sys.stdout.fileno()) | 106 | cacheprogress = None |
98 | shutdown = 0 | 107 | shutdown = 0 |
99 | return_value = 0 | 108 | return_value = 0 |
100 | while True: | 109 | while True: |
@@ -149,11 +158,7 @@ def main(server, eventHandler): | |||
149 | logger.info(event._message) | 158 | logger.info(event._message) |
150 | continue | 159 | continue |
151 | if isinstance(event, bb.event.ParseStarted): | 160 | if isinstance(event, bb.event.ParseStarted): |
152 | if interactive: | 161 | parseprogress = new_progress("Parsing recipes", event.total).start() |
153 | progress = BBProgress | ||
154 | else: | ||
155 | progress = NonInteractiveProgress | ||
156 | parseprogress = progress("Parsing recipes", event.total).start() | ||
157 | continue | 162 | continue |
158 | if isinstance(event, bb.event.ParseProgress): | 163 | if isinstance(event, bb.event.ParseProgress): |
159 | parseprogress.update(event.current) | 164 | parseprogress.update(event.current) |
@@ -164,6 +169,17 @@ def main(server, eventHandler): | |||
164 | % ( event.total, event.cached, event.parsed, event.virtuals, event.skipped, event.masked, event.errors))) | 169 | % ( event.total, event.cached, event.parsed, event.virtuals, event.skipped, event.masked, event.errors))) |
165 | continue | 170 | continue |
166 | 171 | ||
172 | if isinstance(event, bb.event.CacheLoadStarted): | ||
173 | cacheprogress = new_progress("Loading cache", event.total).start() | ||
174 | continue | ||
175 | if isinstance(event, bb.event.CacheLoadProgress): | ||
176 | cacheprogress.update(event.current) | ||
177 | continue | ||
178 | if isinstance(event, bb.event.CacheLoadCompleted): | ||
179 | cacheprogress.finish() | ||
180 | print("Loaded %d entries from dependency cache." % event.num_entries) | ||
181 | continue | ||
182 | |||
167 | if isinstance(event, bb.command.CommandCompleted): | 183 | if isinstance(event, bb.command.CommandCompleted): |
168 | break | 184 | break |
169 | if isinstance(event, bb.command.CommandFailed): | 185 | if isinstance(event, bb.command.CommandFailed): |