Просмотр исходного кода

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: 701d985aa8f2e9c2b9c0736fa25b424f3701889e)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Ross Burton 2 лет назад
Родитель
Сommit
41de1ecadd
1 измененных файлов с 1 добавлено и 0 удалено
  1. 1 0
      scripts/lib/buildstats.py

+ 1 - 0
scripts/lib/buildstats.py

@@ -234,6 +234,7 @@ class BuildStats(dict):
         """
         Parse the top-level build_stats file for build-wide start and duration.
         """
+        start = elapsed = 0
         with open(path) as fobj:
             for line in fobj.readlines():
                 key, val = line.split(':', 1)