summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-06-23 22:59:09 +1200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-07-08 09:57:27 +0100
commit465f93968f113ab32efc9da151078d481a9e08b9 (patch)
treed9dcd97b35987a8070a8440b9d831c4dc52b8b98 /bitbake/lib/bb/ui
parent8d56d596bb2e48332e8f8c6aed78445f7ffb44bf (diff)
downloadpoky-465f93968f113ab32efc9da151078d481a9e08b9.tar.gz
bitbake: knotty: show task progress bar
In addition to the "currently running n tasks (x of y)" message, show a progress bar for another view on how much of the build is left. We have to take care to reset it when moving from the scenequeue to the runqueue, and explicitly don't include an ETA since not all tasks take equal time and thus it isn't possible to estimate the time remaining with the information available. (Bitbake rev: de682015a3fefeff36ddc4197641a700f3fb558d) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui')
-rw-r--r--bitbake/lib/bb/ui/knotty.py23
1 files changed, 19 insertions, 4 deletions
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index 6fdaafedb7..c245c22dc7 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -89,6 +89,7 @@ class NonInteractiveProgress(object):
89 def __init__(self, msg, maxval): 89 def __init__(self, msg, maxval):
90 self.msg = msg 90 self.msg = msg
91 self.maxval = maxval 91 self.maxval = maxval
92 self.finished = False
92 93
93 def start(self, update=True): 94 def start(self, update=True):
94 self.fobj.write("%s..." % self.msg) 95 self.fobj.write("%s..." % self.msg)
@@ -99,8 +100,11 @@ class NonInteractiveProgress(object):
99 pass 100 pass
100 101
101 def finish(self): 102 def finish(self):
103 if self.finished:
104 return
102 self.fobj.write("done.\n") 105 self.fobj.write("done.\n")
103 self.fobj.flush() 106 self.fobj.flush()
107 self.finished = True
104 108
105def new_progress(msg, maxval): 109def new_progress(msg, maxval):
106 if interactive: 110 if interactive:
@@ -204,6 +208,8 @@ class TerminalFilter(object):
204 console.addFilter(InteractConsoleLogFilter(self, format)) 208 console.addFilter(InteractConsoleLogFilter(self, format))
205 errconsole.addFilter(InteractConsoleLogFilter(self, format)) 209 errconsole.addFilter(InteractConsoleLogFilter(self, format))
206 210
211 self.main_progress = None
212
207 def clearFooter(self): 213 def clearFooter(self):
208 if self.footer_present: 214 if self.footer_present:
209 lines = self.footer_present 215 lines = self.footer_present
@@ -246,11 +252,20 @@ class TerminalFilter(object):
246 252
247 if self.main.shutdown: 253 if self.main.shutdown:
248 content = "Waiting for %s running tasks to finish:" % len(activetasks) 254 content = "Waiting for %s running tasks to finish:" % len(activetasks)
249 elif not len(activetasks): 255 print(content)
250 content = "No currently running tasks (%s of %s)" % (self.helper.tasknumber_current, self.helper.tasknumber_total)
251 else: 256 else:
252 content = "Currently %s running tasks (%s of %s):" % (len(activetasks), self.helper.tasknumber_current, self.helper.tasknumber_total) 257 if not len(activetasks):
253 print(content) 258 content = "No currently running tasks (%s of %s)" % (self.helper.tasknumber_current, self.helper.tasknumber_total)
259 else:
260 content = "Currently %2s running tasks (%s of %s)" % (len(activetasks), self.helper.tasknumber_current, self.helper.tasknumber_total)
261 maxtask = self.helper.tasknumber_total + 1
262 if not self.main_progress or self.main_progress.maxval != maxtask:
263 widgets = [' ', progressbar.Percentage(), ' ', progressbar.Bar()]
264 self.main_progress = BBProgress("Running tasks", maxtask, widgets=widgets)
265 self.main_progress.start(False)
266 self.main_progress.setmessage(content)
267 self.main_progress.update(self.helper.tasknumber_current)
268 print('')
254 lines = 1 + int(len(content) / (self.columns + 1)) 269 lines = 1 + int(len(content) / (self.columns + 1))
255 for tasknum, task in enumerate(tasks[:(self.rows - 2)]): 270 for tasknum, task in enumerate(tasks[:(self.rows - 2)]):
256 if isinstance(task, tuple): 271 if isinstance(task, tuple):