[Concept,06/18] buildman: Move BoardStatus and ErrLine to outcome module

Message ID 20260110200828.168672-7-sjg@u-boot.org
State New
Headers
Series buildman: Split up the enormous Builder class |

Commit Message

Simon Glass Jan. 10, 2026, 8:08 p.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

Move the BoardStatus and ErrLine namedtuples from resulthandler.py to
outcome.py, centralising all result-related types in one module.

Update the imports in resulthandler.py and builder.py accordingly.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 tools/buildman/builder.py | 20 +++-----------------
 tools/buildman/outcome.py | 17 +++++++++++++++++
 2 files changed, 20 insertions(+), 17 deletions(-)
  

Patch

diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 96976f513e8..dd1da92e0ea 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -21,8 +21,9 @@  import threading
 
 from buildman import builderthread
 from buildman.cfgutil import Config, process_config
-from buildman.outcome import (Outcome, OUTCOME_OK, OUTCOME_WARNING,
-                              OUTCOME_ERROR, OUTCOME_UNKNOWN)
+from buildman.outcome import (BoardStatus, ErrLine, Outcome,
+                              OUTCOME_OK, OUTCOME_WARNING, OUTCOME_ERROR,
+                              OUTCOME_UNKNOWN)
 from u_boot_pylib import command
 from u_boot_pylib import gitutil
 from u_boot_pylib import terminal
@@ -121,21 +122,6 @@  u-boot/             source directory
     .git/           repository
 """
 
-# Holds information about a particular error line we are outputting
-#   char: Character representation: '+': error, '-': fixed error, 'w+': warning,
-#       'w-' = fixed warning
-#   boards: List of Board objects which have line in the error/warning output
-#   errline: The text of the error line
-ErrLine = collections.namedtuple('ErrLine', 'char,brds,errline')
-
-# Holds the outcome of classifying the boards:
-#   ok: List of boards fixed since last commit
-#   warn: List of boards with warnings since last commit
-#   err: List of new broken boards since last commit
-#   new: List of boards that didn't exist last time
-#   unknown: List of boards that were not built
-BoardStatus = collections.namedtuple('BoardStatus', 'ok,warn,err,new,unknown')
-
 # Translate a commit subject into a valid filename (and handle unicode)
 trans_valid_chars = str.maketrans('/: ', '---')
 
diff --git a/tools/buildman/outcome.py b/tools/buildman/outcome.py
index 373740cd94b..2cbed9a1aba 100644
--- a/tools/buildman/outcome.py
+++ b/tools/buildman/outcome.py
@@ -3,9 +3,26 @@ 
 
 """Outcome class and constants for buildman build results"""
 
+from collections import namedtuple
+
 # Build-outcome codes
 OUTCOME_OK, OUTCOME_WARNING, OUTCOME_ERROR, OUTCOME_UNKNOWN = list(range(4))
 
+# Board status for display purposes
+#   ok: List of boards fixed since last commit
+#   warn: List of boards with warnings since last commit
+#   err: List of new broken boards since last commit
+#   new: List of boards that didn't exist last time
+#   unknown: List of boards that were not built
+BoardStatus = namedtuple('BoardStatus', 'ok warn err new unknown')
+
+# Error line information for display
+#   char: Character representation: '+': error, '-': fixed error, 'w+': warning,
+#       'w-' = fixed warning
+#   brds: List of Board objects which have line in the error/warning output
+#   errline: The text of the error line
+ErrLine = namedtuple('ErrLine', 'char brds errline')
+
 
 class Outcome:
     """Records a build outcome for a single make invocation