Skip to contentSkip to conversation

progressbar: Make bars show correctly with maxval == 0

PATCH New Peter Kjellerstedt 1 participant 1 message Oct 11, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 progressbar: Make bars show correctly with maxval == 0

While it can be argued how useful a progressbar created with 0 as maximum value is, it should still show two states, started (empty) and finished (full). Setting the maxval to _DEFAULT_MAXVAL instead will accomplish this.

---

This solves an additional problem related to the progress bars that I noticed. This typically happens when the dependency cache is empty.

 bitbake/lib/progressbar/progressbar.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
bitbake/lib/progressbar/progressbar.py +1 -1
index eccc45849b..a8e2dc09c9 100644
@@ -106,7 +106,7 @@ class ProgressBar(object):
         if widgets is None:
             widgets = list(self._DEFAULT_WIDGETS)
 
-        self.maxval = maxval
+        self.maxval = maxval if maxval != 0 else self._DEFAULT_MAXVAL
         self.widgets = widgets
         self.fd = fd
         self.left_justify = left_justify