diff options
author | Ross Burton <ross.burton@arm.com> | 2023-03-23 12:54:04 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-04-11 11:31:52 +0100 |
commit | 4c5a9694942e63cb32233def21482e8ca902fbf9 (patch) | |
tree | d14a501f2271eae5c3037e2f1d27325782222cdd /scripts | |
parent | 739b324c249466d34776eb91c5de5b16ed2a5eb1 (diff) | |
download | poky-4c5a9694942e63cb32233def21482e8ca902fbf9.tar.gz |
scripts/lib/buildstats: handle top-level build_stats not being complete
If we try to parse a buildstats directory which was either aborted or
is still being built then the top-level build_stats file doesn't
contain an elapsed value which causes an exception:
UnboundLocalError: local variable 'elapsed' referenced before assignment
Default both start and elapsed to 0 so that the parse succeeds.
(From OE-Core rev: 19815bb76e414a1c1fd8d31a84492d72dd29205e)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
(cherry picked from commit 701d985aa8f2e9c2b9c0736fa25b424f3701889e)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/buildstats.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/scripts/lib/buildstats.py b/scripts/lib/buildstats.py index fa94c65539..6db60d5bcf 100644 --- a/scripts/lib/buildstats.py +++ b/scripts/lib/buildstats.py | |||
@@ -234,6 +234,7 @@ class BuildStats(dict): | |||
234 | """ | 234 | """ |
235 | Parse the top-level build_stats file for build-wide start and duration. | 235 | Parse the top-level build_stats file for build-wide start and duration. |
236 | """ | 236 | """ |
237 | start = elapsed = 0 | ||
237 | with open(path) as fobj: | 238 | with open(path) as fobj: |
238 | for line in fobj.readlines(): | 239 | for line in fobj.readlines(): |
239 | key, val = line.split(':', 1) | 240 | key, val = line.split(':', 1) |