* [PATCH 1/3] knotty: fix some minor bugs in BBProgress
2016-07-22 12:18 [PATCH 0/3] Minor fixes for progress reporting Paul Eggleton
@ 2016-07-22 12:18 ` Paul Eggleton
2016-07-22 12:18 ` [PATCH 2/3] knotty: don't display ETA for tasks with progress Paul Eggleton
2016-07-22 12:18 ` [PATCH 3/3] lib/bb/progress: avoid possibility of start event being reported twice Paul Eggleton
2 siblings, 0 replies; 4+ messages in thread
From: Paul Eggleton @ 2016-07-22 12:18 UTC (permalink / raw)
To: bitbake-devel
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.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
lib/bb/ui/knotty.py | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py
index e8e169f..b92334b 100644
--- a/lib/bb/ui/knotty.py
+++ b/lib/bb/ui/knotty.py
@@ -40,9 +40,9 @@ logger = logging.getLogger("BitBake")
interactive = sys.stdout.isatty()
class BBProgress(progressbar.ProgressBar):
- def __init__(self, msg, maxval, widgets=None):
+ def __init__(self, msg, maxval, widgets=None, extrapos=-1):
self.msg = msg
- self.extrapos = -1
+ self.extrapos = extrapos
if not widgets:
widgets = [progressbar.Percentage(), ' ', progressbar.Bar(), ' ',
progressbar.ETA()]
@@ -69,15 +69,16 @@ class BBProgress(progressbar.ProgressBar):
self.widgets[0] = msg
def setextra(self, extra):
- if extra:
- extrastr = str(extra)
- if extrastr[0] != ' ':
- extrastr = ' ' + extrastr
- if extrastr[-1] != ' ':
- extrastr += ' '
- else:
- extrastr = ' '
- self.widgets[self.extrapos] = extrastr
+ if self.extrapos > -1:
+ if extra:
+ extrastr = str(extra)
+ if extrastr[0] != ' ':
+ extrastr = ' ' + extrastr
+ if extrastr[-1] != ' ':
+ extrastr += ' '
+ else:
+ extrastr = ' '
+ self.widgets[self.extrapos] = extrastr
def _need_update(self):
# We always want the bar to print when update() is called
@@ -241,7 +242,7 @@ class TerminalFilter(object):
start_time = activetasks[t].get("starttime", None)
if not pbar or pbar.bouncing != (progress < 0):
if progress < 0:
- pbar = BBProgress("0: %s (pid %s) " % (activetasks[t]["title"], t), 100, widgets=[progressbar.BouncingSlider()])
+ pbar = BBProgress("0: %s (pid %s) " % (activetasks[t]["title"], t), 100, widgets=[progressbar.BouncingSlider(), ''], extrapos=2)
pbar.bouncing = True
else:
pbar = BBProgress("0: %s (pid %s) " % (activetasks[t]["title"], t), 100)
--
2.5.5
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/3] knotty: don't display ETA for tasks with progress
2016-07-22 12:18 [PATCH 0/3] Minor fixes for progress reporting Paul Eggleton
2016-07-22 12:18 ` [PATCH 1/3] knotty: fix some minor bugs in BBProgress Paul Eggleton
@ 2016-07-22 12:18 ` Paul Eggleton
2016-07-22 12:18 ` [PATCH 3/3] lib/bb/progress: avoid possibility of start event being reported twice Paul Eggleton
2 siblings, 0 replies; 4+ messages in thread
From: Paul Eggleton @ 2016-07-22 12:18 UTC (permalink / raw)
To: bitbake-devel
It turns out that progress information we can extract from a task is
rarely apportioned closely enough to the time taken for the ETA to be
accurate, so showing it is going to be misleading most of the time for
anything but the most basic of examples. Let's just remove it and avoid
misleading (or worse, annoying) the user.
Fixes [YOCTO #9986].
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
lib/bb/ui/knotty.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py
index b92334b..1723a72 100644
--- a/lib/bb/ui/knotty.py
+++ b/lib/bb/ui/knotty.py
@@ -245,7 +245,7 @@ class TerminalFilter(object):
pbar = BBProgress("0: %s (pid %s) " % (activetasks[t]["title"], t), 100, widgets=[progressbar.BouncingSlider(), ''], extrapos=2)
pbar.bouncing = True
else:
- pbar = BBProgress("0: %s (pid %s) " % (activetasks[t]["title"], t), 100)
+ pbar = BBProgress("0: %s (pid %s) " % (activetasks[t]["title"], t), 100, widgets=[progressbar.Percentage(), ' ', progressbar.Bar(), ''], extrapos=4)
pbar.bouncing = False
activetasks[t]["progressbar"] = pbar
tasks.append((pbar, progress, rate, start_time))
--
2.5.5
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 3/3] lib/bb/progress: avoid possibility of start event being reported twice
2016-07-22 12:18 [PATCH 0/3] Minor fixes for progress reporting Paul Eggleton
2016-07-22 12:18 ` [PATCH 1/3] knotty: fix some minor bugs in BBProgress Paul Eggleton
2016-07-22 12:18 ` [PATCH 2/3] knotty: don't display ETA for tasks with progress Paul Eggleton
@ 2016-07-22 12:18 ` Paul Eggleton
2 siblings, 0 replies; 4+ messages in thread
From: Paul Eggleton @ 2016-07-22 12:18 UTC (permalink / raw)
To: bitbake-devel
In MultiStageProgressReporter, set a guard when we start the progress
so that it can't happen more than once. This fixes "Initialising
tasks.." being shown twice in succession when running bitbake in
non-interactive terminal mode.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
lib/bb/progress.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/bb/progress.py b/lib/bb/progress.py
index 343b18f..f54d1c7 100644
--- a/lib/bb/progress.py
+++ b/lib/bb/progress.py
@@ -234,10 +234,13 @@ class MultiStageProcessProgressReporter(MultiStageProgressReporter):
"""
def __init__(self, d, processname, stage_weights, debug=False):
self._processname = processname
+ self._started = False
MultiStageProgressReporter.__init__(self, d, stage_weights, debug)
def start(self):
- bb.event.fire(bb.event.ProcessStarted(self._processname, 100), self._data)
+ if not self._started:
+ bb.event.fire(bb.event.ProcessStarted(self._processname, 100), self._data)
+ self._started = True
def _fire_progress(self, taskprogress):
if taskprogress == 0:
--
2.5.5
^ permalink raw reply related [flat|nested] 4+ messages in thread