From cc2c0d1800528f307df376524132d3573749c581 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 11 Jul 2022 19:04:00 -0600 Subject: [PATCH] buildman: Drop use of 'boards' in control Use brds instead so that we can reserve 'boards' for a module name. Signed-off-by: Simon Glass --- tools/buildman/builder.py | 11 +++++------ tools/buildman/control.py | 26 +++++++++++++------------- tools/buildman/func_test.py | 2 +- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py index 462266b4b8..33f9373b8f 100644 --- a/tools/buildman/builder.py +++ b/tools/buildman/builder.py @@ -108,7 +108,7 @@ u-boot/ source directory 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,boards,errline') +ErrLine = collections.namedtuple('ErrLine', 'char,brds,errline') # Possible build outcomes OUTCOME_OK, OUTCOME_WARNING, OUTCOME_ERROR, OUTCOME_UNKNOWN = list(range(4)) @@ -1216,14 +1216,14 @@ class Builder: List of boards with that error line, or [] if the user has not requested such a list """ - boards = [] + brds = [] board_set = set() if self._list_error_boards: for brd in line_boards[line]: if not brd in board_set: - boards.append(brd) + brds.append(brd) board_set.add(brd) - return boards + return brds def _CalcErrorDelta(base_lines, base_line_boards, lines, line_boards, char): @@ -1326,8 +1326,7 @@ class Builder: if err_lines: out_list = [] for line in err_lines: - boards = '' - names = [brd.target for brd in line.boards] + names = [brd.target for brd in line.brds] board_str = ' '.join(names) if names else '' if board_str: out = self.col.build(colour, line.char + '(') diff --git a/tools/buildman/control.py b/tools/buildman/control.py index 68dca97413..c4dfc2af57 100644 --- a/tools/buildman/control.py +++ b/tools/buildman/control.py @@ -87,7 +87,7 @@ def ShowActions(series, why_selected, boards_selected, builder, options, for warning in board_warnings: print(col.build(col.YELLOW, warning)) -def ShowToolchainPrefix(boards, toolchains): +def ShowToolchainPrefix(brds, toolchains): """Show information about a the tool chain used by one or more boards The function checks that all boards use the same toolchain, then prints @@ -100,9 +100,9 @@ def ShowToolchainPrefix(boards, toolchains): Return: None on success, string error message otherwise """ - boards = boards.GetSelectedDict() + board_selected = brds.GetSelectedDict() tc_set = set() - for brd in boards.values(): + for brd in board_selected.values(): tc_set.add(toolchains.Select(brd.arch)) if len(tc_set) != 1: return 'Supplied boards must share one toolchain' @@ -111,7 +111,7 @@ def ShowToolchainPrefix(boards, toolchains): print(tc.GetEnvArgs(toolchain.VAR_CROSS_COMPILE)) return None -def DoBuildman(options, args, toolchains=None, make_func=None, boards=None, +def DoBuildman(options, args, toolchains=None, make_func=None, brds=None, clean_dir=False, test_thread_exceptions=False): """The main control code for buildman @@ -124,7 +124,7 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None, to execute 'make'. If this is None, the normal function will be used, which calls the 'make' tool with suitable arguments. This setting is useful for tests. - board: Boards() object to use, containing a list of available + brds: Boards() object to use, containing a list of available boards. If this is None it will be created and scanned. clean_dir: Used for tests only, indicates that the existing output_dir should be removed before starting the build @@ -182,7 +182,7 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None, options.output_dir = '..' # Work out what subset of the boards we are building - if not boards: + if not brds: if not os.path.exists(options.output_dir): os.makedirs(options.output_dir) board_file = os.path.join(options.output_dir, 'boards.cfg') @@ -197,8 +197,8 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None, if status != 0: sys.exit("Failed to generate boards.cfg") - boards = board.Boards() - boards.ReadBoards(board_file) + brds = board.Boards() + brds.ReadBoards(board_file) exclude = [] if options.exclude: @@ -211,14 +211,14 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None, requested_boards += b.split(',') else: requested_boards = None - why_selected, board_warnings = boards.SelectBoards(args, exclude, - requested_boards) - selected = boards.GetSelected() + why_selected, board_warnings = brds.SelectBoards(args, exclude, + requested_boards) + selected = brds.GetSelected() if not len(selected): sys.exit(col.build(col.RED, 'No matching boards found')) if options.print_prefix: - err = ShowToolchainPrefix(boards, toolchains) + err = ShowToolchainPrefix(brds, toolchains) if err: sys.exit(col.build(col.RED, err)) return 0 @@ -349,7 +349,7 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None, builder.in_tree = options.in_tree # Work out which boards to build - board_selected = boards.GetSelectedDict() + board_selected = brds.GetSelectedDict() if series: commits = series.commits diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py index 812dc924c8..23627f3b0f 100644 --- a/tools/buildman/func_test.py +++ b/tools/buildman/func_test.py @@ -239,7 +239,7 @@ class TestFunctional(unittest.TestCase): sys.argv = [sys.argv[0]] + list(args) options, args = cmdline.ParseArgs() result = control.DoBuildman(options, args, toolchains=self._toolchains, - make_func=self._HandleMake, boards=brds or self._boards, + make_func=self._HandleMake, brds=brds or self._boards, clean_dir=clean_dir, test_thread_exceptions=test_thread_exceptions) self._builder = control.builder -- 2.39.5