| From 7cea7f7a87da041fc1ad370c5c3d15aabad3a0d4 Mon Sep 17 00:00:00 2001 |
| From: Enguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com> |
| Date: Thu, 22 Feb 2024 16:21:53 +0100 |
| Subject: [PATCH 3/6] bitbake: progressbar: accept value over initial maxval |
| |
| There is a very rare case where the maxval is improperly computed |
| initially for cache loading progress, and the value will go over. |
| |
| Explanation from bitbake/lib/bb/cache.py:736 in MulticonfigCache:__init__:progress() |
| # we might have calculated incorrect total size because a file |
| # might've been written out just after we checked its size |
| |
| In that case, progressbar will receive a value over the initial maxval. |
| This results in a ValueError stack trace as well as bitbake returning 1. |
| Traceback (most recent call last): |
| File ".../poky/bitbake/lib/bb/ui/knotty.py", line 736, in main |
| cacheprogress.update(event.current) |
| File ".../poky/bitbake/lib/progressbar/progressbar.py", line 256, in update |
| raise ValueError('Value out of range') |
| ValueError: Value out of range |
| |
| This fix mirrors the behavior of MulticonfigCache and accepts the new |
| value as the new maxval. This is also what the percentage printout |
| is doing in bitbake/lib/progressbar/progressbar.py:191 in ProgressBar:percentage() |
| |
| I encountered this issue randomly while working on a project with |
| VSCode saving files while commands where fired. |
| |
| Note: This file is a fork from python-progressbar. It hasn't been |
| refreshed in 8 years. We did only two commits, 5 years ago with minor |
| modifications. This new change is also not how the upstream project is |
| behaving. |
| |
| Signed-off-by: Enguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com> |
| Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> |
| --- |
| lib/progressbar/progressbar.py | 2 +- |
| 1 file changed, 1 insertion(+), 1 deletion(-) |
| |
| diff --git a/lib/bb/_vendor/progressbar/progressbar.py b/lib/bb/_vendor/progressbar/progressbar.py |
| index e2b6ba108..d4da10ab7 100644 |
| --- a/lib/bb/_vendor/progressbar/progressbar.py |
| +++ b/lib/bb/_vendor/progressbar/progressbar.py |
| @@ -253,7 +253,7 @@ class ProgressBar(object): |
| if (self.maxval is not widgets.UnknownLength |
| and not 0 <= value <= self.maxval): |
| |
| - raise ValueError('Value out of range') |
| + self.maxval = value |
| |
| self.currval = value |
| |
| -- |
| 2.49.0 |