Skip to contentSkip to conversation

buildman: Deal nicely with invalid build-status file

PATCH New Simon Glass 2 participants 2 messages Dec 10, 2018 – Jan 3, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 buildman: Deal nicely with invalid build-status file

The 'done' files created by buildman may end up being empty if buildman runs out of disk space while writing them. This error is then persistent, since even if disk space is reclaimed and the build retries, the empty file causes an exception in the builder thread.

Deal with this silently by doing a rebuild.

---

 tools/buildman/builderthread.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
tools/buildman/builderthread.py +6 -1
index c84ba6acf11..b91634f3abb 100644
@@ -156,7 +156,12 @@ class BuilderThread(threading.Thread):
         if result.already_done:
             # Get the return code from that build and use it
             with open(done_file, 'r') as fd:
-                result.return_code = int(fd.readline())
+                try:
+                    result.return_code = int(fd.readline())
+                except ValueError:
+                    # The file may be empty due to running out of disk space.
+                    # Try a rebuild
+                    result.return_code = RETURN_CODE_RETRY
 
             # Check the signal that the build needs to be retried
             if result.return_code == RETURN_CODE_RETRY:
Signature · 1 line
2.20.0.rc2.403.gdbc3b29805-goog
#1 lore raw

PATCH 1/1 buildman: Deal nicely with invalid build-status file

The 'done' files created by buildman may end up being empty if buildman runs out of disk space while writing them. This error is then persistent, since even if disk space is reclaimed and the build retries, the empty file causes an exception in the builder thread.

Deal with this silently by doing a rebuild.

---

 tools/buildman/builderthread.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Applied to u-boot-dm/master, thanks!