diff mbox series

[PATCHv2] sstate.bbclass: Always show a progress bar if an sstate summary is wanted

Message ID 20260219190104.1374827-1-pkj@axis.com
State New
Headers show
Series [PATCHv2] sstate.bbclass: Always show a progress bar if an sstate summary is wanted | expand

Commit Message

Peter Kjellerstedt Feb. 19, 2026, 7:01 p.m. UTC
In case sstate_checkhashes() is expected to show an sstate summary, then
always show the "Checking sstate mirror object availability" progress
bar regardless of how long the task list is. Without this, the sstate
summary could unintentionally overwrite the "Initialising tasks"
progress bar, which may still be active. Forcing the "Checking sstate
mirror object availability" progress bar to show will make sure the
"Initialising tasks" progress bar is finalized before the sstate summary
is shown, and the output of the progress bars and the sstate summary
will be as expected.

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---

PATCHv2: Make sure the case when the tasklist is empty is also handled
         correctly.

 meta/classes-global/sstate.bbclass | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/meta/classes-global/sstate.bbclass b/meta/classes-global/sstate.bbclass
index 2fd29d7323..3b2e307134 100644
--- a/meta/classes-global/sstate.bbclass
+++ b/meta/classes-global/sstate.bbclass
@@ -1043,15 +1043,16 @@  def sstate_checkhashes(sq_data, d, siginfo=False, currentcount=0, summary=True,
             sstatefile = d.expand(getsstatefile(tid, siginfo, d))
             tasklist.append((tid, sstatefile))
 
+        progress = summary or len(tasklist) >= 100
+        if progress:
+            msg = "Checking sstate mirror object availability"
+            bb.event.fire(bb.event.ProcessStarted(msg, len(tasklist)), d)
+
         if tasklist:
             nproc = min(int(d.getVar("BB_NUMBER_THREADS")), len(tasklist))
 
             ## thread-safe counter
             cnt_tasks_done = itertools.count(start = 1)
-            progress = len(tasklist) >= 100
-            if progress:
-                msg = "Checking sstate mirror object availability"
-                bb.event.fire(bb.event.ProcessStarted(msg, len(tasklist)), d)
 
             # Have to setup the fetcher environment here rather than in each thread as it would race
             fetcherenv = bb.fetch2.get_fetcher_environment(d)
@@ -1066,8 +1067,8 @@  def sstate_checkhashes(sq_data, d, siginfo=False, currentcount=0, summary=True,
                 checkstatus_end()
                 bb.event.disable_threadlock()
 
-            if progress:
-                bb.event.fire(bb.event.ProcessFinished(msg), d)
+        if progress:
+            bb.event.fire(bb.event.ProcessFinished(msg), d)
 
     inheritlist = d.getVar("INHERIT")
     if "toaster" in inheritlist: