[PATCH 5/5] sstate.bbclass: sstate mirror progress bar cleanup

Jose Quaresma
2021-08-09T09:49:17Z

We only has the progress bar when we have more than 100 objects.
So check for this and store the result to show the progress bar.

Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com>
---
meta/classes/sstate.bbclass | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index 948779386d..a9c908fe97 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -953,20 +953,24 @@ def sstate_checkhashes(sq_data, d, siginfo=False, currentcount=0, summary=True,
except:
bb.debug(2, "SState: Unsuccessful fetch test for %s" % srcuri)
pass
- if len(tasklist) >= min_tasks:
+
+ if progress:
bb.event.fire(bb.event.ProcessProgress(msg, len(tasklist) - thread_worker.tasks.qsize()), d)

tasklist = []
- min_tasks = 100
for tid in missed:
spec, extrapath, tname = getpathcomponents(tid, d)
sstatefile = d.expand(extrapath + generate_sstatefn(spec, gethash(tid), tname, siginfo, d))
tasklist.append((tid, sstatefile))

+ progress = False
+ if len(tasklist) >= 100:
+ progress = True
+
if tasklist:
nproc = min(oe.utils.cpu_count(), len(tasklist))

- if len(tasklist) >= min_tasks:
+ if progress:
msg = "Checking sstate mirror object availability"
bb.event.fire(bb.event.ProcessStarted(msg, len(tasklist)), d)
bb.event.enable_threadlock()
@@ -978,7 +982,7 @@ def sstate_checkhashes(sq_data, d, siginfo=False, currentcount=0, summary=True,
pool.start()
pool.wait_completion()

- if len(tasklist) >= min_tasks:
+ if progress:
bb.event.disable_threadlock()
bb.event.fire(bb.event.ProcessFinished(msg), d)

--
2.32.0