[PATCH 4/5] buildman: Record an error if a toolchain is missing

Simon Glass sjg at chromium.org
Sat Dec 14 19:20:23 CET 2024


Buildman has always treated the lack of a toolchain as an infrastructure
problem rather than a build failure.

However the logic for this is not correct, since it does not write a
'done' file in this case.

As a result, one of two things can happen.

1. If a previous build ran in the same (output) directory, the outcome
   of *that* build is recorded as the outcome of this one
2. Otherwise, no outcome is recorded

Obviously this inconsistency is not ideal. While (2) is rare, it can be
very confusing as the build sort-of fails but does not produce any
summary output with 'buildman -s'

Overall it seems better to attribute a toolchain issue to the boards
that it affects. This results in clear failures which can be examined,
no matter what happened in the .bm-work directory previously.

So write a 'done' file for each build when a toolchain is missing.

The end result of this patch is to make missing toolchains much more
obvious. It should be things a bit easier for novice users.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 tools/buildman/builderthread.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
index b5afee61aff..29e6cf32af1 100644
--- a/tools/buildman/builderthread.py
+++ b/tools/buildman/builderthread.py
@@ -19,6 +19,7 @@ import threading
 from buildman import cfgutil
 from patman import gitutil
 from u_boot_pylib import command
+from u_boot_pylib import tools
 
 RETURN_CODE_RETRY = -1
 BASE_ELF_FILENAMES = ['u-boot', 'spl/u-boot-spl', 'tpl/u-boot-tpl']
@@ -555,10 +556,10 @@ class BuilderThread(threading.Thread):
         if result.return_code < 0:
             return
 
+        done_file = self.builder.get_done_file(result.commit_upto,
+                result.brd.target)
         if result.toolchain:
             # Write the build result and toolchain information.
-            done_file = self.builder.get_done_file(result.commit_upto,
-                    result.brd.target)
             with open(done_file, 'w', encoding='utf-8') as outf:
                 if maybe_aborted:
                     # Special code to indicate we need to retry
@@ -638,6 +639,9 @@ class BuilderThread(threading.Thread):
                                 result.brd.target)
                 with open(sizes, 'w', encoding='utf-8') as outf:
                     print('\n'.join(lines), file=outf)
+        else:
+            # Indicate that the build failure due to lack of toolchain
+            tools.write_file(done_file, '2\n', binary=False)
 
         if not work_in_output:
             # Write out the configuration files, with a special case for SPL
-- 
2.34.1



More information about the U-Boot mailing list