bitbake: knotty: Be consistent when creating/updating progress bars

When creating a new progress bar (using BBProgress), a colon was
appended to the supplied message. However, when updating the message,
no colon was appended.

Change this so that the colon is instead part of the widgets that make
up the progress bar so that it does not matter when and how the
message is updated, it always displays the same.

(Bitbake rev: 08f35c04f6e1ce4c4ca5c2bef4cd8a192e12e682)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Peter Kjellerstedt
2020-01-11 04:01:44 +01:00
committed by Richard Purdie
parent 5c935fb29c
commit fbe8b3e3e9

View File

@@ -35,15 +35,15 @@ class BBProgress(progressbar.ProgressBar):
self.msg = msg self.msg = msg
self.extrapos = extrapos self.extrapos = extrapos
if not widgets: if not widgets:
widgets = [progressbar.Percentage(), ' ', progressbar.Bar(), ' ', widgets = [': ', progressbar.Percentage(), ' ', progressbar.Bar(),
progressbar.ETA()] ' ', progressbar.ETA()]
self.extrapos = 4 self.extrapos = 5
if resize_handler: if resize_handler:
self._resize_default = resize_handler self._resize_default = resize_handler
else: else:
self._resize_default = signal.getsignal(signal.SIGWINCH) self._resize_default = signal.getsignal(signal.SIGWINCH)
progressbar.ProgressBar.__init__(self, maxval, [self.msg + ": "] + widgets, fd=sys.stdout) progressbar.ProgressBar.__init__(self, maxval, [self.msg] + widgets, fd=sys.stdout)
def _handle_resize(self, signum=None, frame=None): def _handle_resize(self, signum=None, frame=None):
progressbar.ProgressBar._handle_resize(self, signum, frame) progressbar.ProgressBar._handle_resize(self, signum, frame)
@@ -255,10 +255,10 @@ class TerminalFilter(object):
start_time = activetasks[t].get("starttime", None) start_time = activetasks[t].get("starttime", None)
if not pbar or pbar.bouncing != (progress < 0): if not pbar or pbar.bouncing != (progress < 0):
if progress < 0: if progress < 0:
pbar = BBProgress("0: %s (pid %s) " % (activetasks[t]["title"], activetasks[t]["pid"]), 100, widgets=[progressbar.BouncingSlider(), ''], extrapos=2, resize_handler=self.sigwinch_handle) pbar = BBProgress("0: %s (pid %s)" % (activetasks[t]["title"], activetasks[t]["pid"]), 100, widgets=[' ', progressbar.BouncingSlider(), ''], extrapos=3, resize_handler=self.sigwinch_handle)
pbar.bouncing = True pbar.bouncing = True
else: else:
pbar = BBProgress("0: %s (pid %s) " % (activetasks[t]["title"], activetasks[t]["pid"]), 100, widgets=[progressbar.Percentage(), ' ', progressbar.Bar(), ''], extrapos=4, resize_handler=self.sigwinch_handle) pbar = BBProgress("0: %s (pid %s)" % (activetasks[t]["title"], activetasks[t]["pid"]), 100, widgets=[' ', progressbar.Percentage(), ' ', progressbar.Bar(), ''], extrapos=5, resize_handler=self.sigwinch_handle)
pbar.bouncing = False pbar.bouncing = False
activetasks[t]["progressbar"] = pbar activetasks[t]["progressbar"] = pbar
tasks.append((pbar, progress, rate, start_time)) tasks.append((pbar, progress, rate, start_time))