summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-07-23 00:18:37 +1200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-07-26 08:10:35 +0100
commit23a551bea12077f0e0320e19e7a587c409949511 (patch)
tree341340a2fc0d44845decb95386382a82f2d5a089 /bitbake/lib/bb/ui
parent0c3ce684100546cf628d96c0f64a635242a10e16 (diff)
downloadpoky-23a551bea12077f0e0320e19e7a587c409949511.tar.gz
bitbake: knotty: fix some minor bugs in BBProgress
If you specify custom widgets then we don't want to assume where the "extra" position is - you should have to specify it, and if it isn't specified it shouldn't just wipe out the last widget or you can start to see odd behaviour if you're modifying the code. (Bitbake rev: 19e33c10feb1637589ceb05b5e8d58b1e012ccb8) 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.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index e8e169fe67..b92334b02d 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -40,9 +40,9 @@ logger = logging.getLogger("BitBake")
40interactive = sys.stdout.isatty() 40interactive = sys.stdout.isatty()
41 41
42class BBProgress(progressbar.ProgressBar): 42class BBProgress(progressbar.ProgressBar):
43 def __init__(self, msg, maxval, widgets=None): 43 def __init__(self, msg, maxval, widgets=None, extrapos=-1):
44 self.msg = msg 44 self.msg = msg
45 self.extrapos = -1 45 self.extrapos = extrapos
46 if not widgets: 46 if not widgets:
47 widgets = [progressbar.Percentage(), ' ', progressbar.Bar(), ' ', 47 widgets = [progressbar.Percentage(), ' ', progressbar.Bar(), ' ',
48 progressbar.ETA()] 48 progressbar.ETA()]
@@ -69,15 +69,16 @@ class BBProgress(progressbar.ProgressBar):
69 self.widgets[0] = msg 69 self.widgets[0] = msg
70 70
71 def setextra(self, extra): 71 def setextra(self, extra):
72 if extra: 72 if self.extrapos > -1:
73 extrastr = str(extra) 73 if extra:
74 if extrastr[0] != ' ': 74 extrastr = str(extra)
75 extrastr = ' ' + extrastr 75 if extrastr[0] != ' ':
76 if extrastr[-1] != ' ': 76 extrastr = ' ' + extrastr
77 extrastr += ' ' 77 if extrastr[-1] != ' ':
78 else: 78 extrastr += ' '
79 extrastr = ' ' 79 else:
80 self.widgets[self.extrapos] = extrastr 80 extrastr = ' '
81 self.widgets[self.extrapos] = extrastr
81 82
82 def _need_update(self): 83 def _need_update(self):
83 # We always want the bar to print when update() is called 84 # We always want the bar to print when update() is called
@@ -241,7 +242,7 @@ class TerminalFilter(object):
241 start_time = activetasks[t].get("starttime", None) 242 start_time = activetasks[t].get("starttime", None)
242 if not pbar or pbar.bouncing != (progress < 0): 243 if not pbar or pbar.bouncing != (progress < 0):
243 if progress < 0: 244 if progress < 0:
244 pbar = BBProgress("0: %s (pid %s) " % (activetasks[t]["title"], t), 100, widgets=[progressbar.BouncingSlider()]) 245 pbar = BBProgress("0: %s (pid %s) " % (activetasks[t]["title"], t), 100, widgets=[progressbar.BouncingSlider(), ''], extrapos=2)
245 pbar.bouncing = True 246 pbar.bouncing = True
246 else: 247 else:
247 pbar = BBProgress("0: %s (pid %s) " % (activetasks[t]["title"], t), 100) 248 pbar = BBProgress("0: %s (pid %s) " % (activetasks[t]["title"], t), 100)