summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-07-11 19:03:57 -0600
committerTom Rini <trini@konsulko.com>2022-08-05 11:47:55 -0400
commitf4ed4706ef6668890bfc906ea3071429fb7f8990 (patch)
treeaaedf63d83d5af5ef48592bcafcf8bd49bc839d5 /tools
parentae1a09f8039a064135629e3b37e108e8ee1814b3 (diff)
buildman: Avoid using board as a variable
We have a module called 'board'. Sometimes buildman uses 'brd' as an instance variable but sometimes it uses 'board', which is confusing and can mess with the module handling. Update the code to use 'brd' consistently, making it easier for tools to determine when the module is being referenced. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/buildman/board.py40
-rw-r--r--tools/buildman/builder.py45
-rw-r--r--tools/buildman/builderthread.py6
-rw-r--r--tools/buildman/func_test.py8
-rw-r--r--tools/buildman/test.py4
-rw-r--r--tools/buildman/toolchain.py8
6 files changed, 55 insertions, 56 deletions
diff --git a/tools/buildman/board.py b/tools/buildman/board.py
index 447aaabea8..08771b3f15 100644
--- a/tools/buildman/board.py
+++ b/tools/buildman/board.py
@@ -103,15 +103,15 @@ class Boards:
# Use a simple list here, sinc OrderedDict requires Python 2.7
self._boards = []
- def AddBoard(self, board):
+ def AddBoard(self, brd):
"""Add a new board to the list.
The board's target member must not already exist in the board list.
Args:
- board: board to add
+ brd: board to add
"""
- self._boards.append(board)
+ self._boards.append(brd)
def ReadBoards(self, fname):
"""Read a list of boards from a board file.
@@ -136,8 +136,8 @@ class Boards:
if len(fields) > 8:
fields = fields[:8]
- board = Board(*fields)
- self.AddBoard(board)
+ brd = Board(*fields)
+ self.AddBoard(brd)
def GetList(self):
@@ -157,8 +157,8 @@ class Boards:
value is board
"""
board_dict = OrderedDict()
- for board in self._boards:
- board_dict[board.target] = board
+ for brd in self._boards:
+ board_dict[brd.target] = brd
return board_dict
def GetSelectedDict(self):
@@ -168,9 +168,9 @@ class Boards:
List of Board objects that are marked selected
"""
board_dict = OrderedDict()
- for board in self._boards:
- if board.build_it:
- board_dict[board.target] = board
+ for brd in self._boards:
+ if brd.build_it:
+ board_dict[brd.target] = brd
return board_dict
def GetSelected(self):
@@ -179,7 +179,7 @@ class Boards:
Returns:
List of Board objects that are marked selected
"""
- return [board for board in self._boards if board.build_it]
+ return [brd for brd in self._boards if brd.build_it]
def GetSelectedNames(self):
"""Return a list of selected boards
@@ -187,7 +187,7 @@ class Boards:
Returns:
List of board names that are marked selected
"""
- return [board.target for board in self._boards if board.build_it]
+ return [brd.target for brd in self._boards if brd.build_it]
def _BuildTerms(self, args):
"""Convert command line arguments to a list of terms.
@@ -273,34 +273,34 @@ class Boards:
exclude_list.append(Expr(expr))
found = []
- for board in self._boards:
+ for brd in self._boards:
matching_term = None
build_it = False
if terms:
match = False
for term in terms:
- if term.Matches(board.props):
+ if term.Matches(brd.props):
matching_term = str(term)
build_it = True
break
elif boards:
- if board.target in boards:
+ if brd.target in boards:
build_it = True
- found.append(board.target)
+ found.append(brd.target)
else:
build_it = True
# Check that it is not specifically excluded
for expr in exclude_list:
- if expr.Matches(board.props):
+ if expr.Matches(brd.props):
build_it = False
break
if build_it:
- board.build_it = True
+ brd.build_it = True
if matching_term:
- result[matching_term].append(board.target)
- result['all'].append(board.target)
+ result[matching_term].append(brd.target)
+ result['all'].append(brd.target)
if boards:
remaining = set(boards) - set(found)
diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 078ddf070d..462266b4b8 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -875,11 +875,11 @@ class Builder:
config = {}
environment = {}
- for board in boards_selected.values():
- outcome = self.GetBuildOutcome(commit_upto, board.target,
+ for brd in boards_selected.values():
+ outcome = self.GetBuildOutcome(commit_upto, brd.target,
read_func_sizes, read_config,
read_environment)
- board_dict[board.target] = outcome
+ board_dict[brd.target] = outcome
last_func = None
last_was_warning = False
for line in outcome.err_lines:
@@ -894,29 +894,29 @@ class Builder:
if is_warning or (last_was_warning and is_note):
if last_func:
AddLine(warn_lines_summary, warn_lines_boards,
- last_func, board)
+ last_func, brd)
AddLine(warn_lines_summary, warn_lines_boards,
- line, board)
+ line, brd)
else:
if last_func:
AddLine(err_lines_summary, err_lines_boards,
- last_func, board)
+ last_func, brd)
AddLine(err_lines_summary, err_lines_boards,
- line, board)
+ line, brd)
last_was_warning = is_warning
last_func = None
- tconfig = Config(self.config_filenames, board.target)
+ tconfig = Config(self.config_filenames, brd.target)
for fname in self.config_filenames:
if outcome.config:
for key, value in outcome.config[fname].items():
tconfig.Add(fname, key, value)
- config[board.target] = tconfig
+ config[brd.target] = tconfig
- tenvironment = Environment(board.target)
+ tenvironment = Environment(brd.target)
if outcome.environment:
for key, value in outcome.environment.items():
tenvironment.Add(key, value)
- environment[board.target] = tenvironment
+ environment[brd.target] = tenvironment
return (board_dict, err_lines_summary, err_lines_boards,
warn_lines_summary, warn_lines_boards, config, environment)
@@ -971,9 +971,8 @@ class Builder:
board.target
"""
self._base_board_dict = {}
- for board in board_selected:
- self._base_board_dict[board] = Builder.Outcome(0, [], [], {}, {},
- {})
+ for brd in board_selected:
+ self._base_board_dict[brd] = Builder.Outcome(0, [], [], {}, {}, {})
self._base_err_lines = []
self._base_warn_lines = []
self._base_err_line_boards = {}
@@ -1220,10 +1219,10 @@ class Builder:
boards = []
board_set = set()
if self._list_error_boards:
- for board in line_boards[line]:
- if not board in board_set:
- boards.append(board)
- board_set.add(board)
+ for brd in line_boards[line]:
+ if not brd in board_set:
+ boards.append(brd)
+ board_set.add(brd)
return boards
def _CalcErrorDelta(base_lines, base_line_boards, lines, line_boards,
@@ -1328,7 +1327,7 @@ class Builder:
out_list = []
for line in err_lines:
boards = ''
- names = [board.target for board in line.boards]
+ names = [brd.target for brd in line.boards]
board_str = ' '.join(names) if names else ''
if board_str:
out = self.col.build(colour, line.char + '(')
@@ -1549,9 +1548,9 @@ class Builder:
# Get a list of boards that did not get built, if needed
not_built = []
- for board in board_selected:
- if not board in board_dict:
- not_built.append(board)
+ for brd in board_selected:
+ if not brd in board_dict:
+ not_built.append(brd)
if not_built:
tprint("Boards not built (%d): %s" % (len(not_built),
', '.join(not_built)))
@@ -1768,7 +1767,7 @@ class Builder:
# Create jobs to build all commits for each board
for brd in board_selected.values():
job = builderthread.BuilderJob()
- job.board = brd
+ job.brd = brd
job.commits = commits
job.keep_outputs = keep_outputs
job.work_in_output = self.work_in_output
diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
index 7522ff62de..6240e08c76 100644
--- a/tools/buildman/builderthread.py
+++ b/tools/buildman/builderthread.py
@@ -40,7 +40,7 @@ class BuilderJob:
"""Holds information about a job to be performed by a thread
Members:
- board: Board object to build
+ brd: Board object to build
commits: List of Commit objects to build
keep_outputs: True to save build output files
step: 1 to process every commit, n to process every nth commit
@@ -48,7 +48,7 @@ class BuilderJob:
don't write to a separate output directory.
"""
def __init__(self):
- self.board = None
+ self.brd = None
self.commits = []
self.keep_outputs = False
self.step = 1
@@ -491,7 +491,7 @@ class BuilderThread(threading.Thread):
Returns:
List of Result objects
"""
- brd = job.board
+ brd = job.brd
work_dir = self.builder.GetThreadDir(self.thread_num)
self.toolchain = None
if job.commits:
diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py
index fbf6706644..0265286908 100644
--- a/tools/buildman/func_test.py
+++ b/tools/buildman/func_test.py
@@ -476,12 +476,12 @@ class TestFunctional(unittest.TestCase):
self.assertEqual(ret_code, 100)
for commit in range(self._commits):
- for board in self._boards.GetList():
- if board.arch != 'sandbox':
- errfile = self._builder.GetErrFile(commit, board.target)
+ for brd in self._boards.GetList():
+ if brd.arch != 'sandbox':
+ errfile = self._builder.GetErrFile(commit, brd.target)
fd = open(errfile)
self.assertEqual(fd.readlines(),
- ['No tool chain for %s\n' % board.arch])
+ ['No tool chain for %s\n' % brd.arch])
fd.close()
def testBranch(self):
diff --git a/tools/buildman/test.py b/tools/buildman/test.py
index 27287438ee..62ad25db39 100644
--- a/tools/buildman/test.py
+++ b/tools/buildman/test.py
@@ -184,8 +184,8 @@ class TestBuild(unittest.TestCase):
# TODO(sjg@chromium.org): If plus is '', we shouldn't need this
expect += ' ' + col.build(expected_colour, plus)
expect += ' '
- for board in boards:
- expect += col.build(expected_colour, ' %s' % board)
+ for brd in boards:
+ expect += col.build(expected_colour, ' %s' % brd)
self.assertEqual(text, expect)
def _SetupTest(self, echo_lines=False, threads=1, **kwdisplay_args):
diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py
index 46a4e5ed40..fea40ba215 100644
--- a/tools/buildman/toolchain.py
+++ b/tools/buildman/toolchain.py
@@ -441,7 +441,7 @@ class Toolchains:
args = args[:m.start(0)] + value + args[m.end(0):]
return args
- def GetMakeArguments(self, board):
+ def GetMakeArguments(self, brd):
"""Returns 'make' arguments for a given board
The flags are in a section called 'make-flags'. Flags are named
@@ -462,13 +462,13 @@ class Toolchains:
A special 'target' variable is set to the board target.
Args:
- board: Board object for the board to check.
+ brd: Board object for the board to check.
Returns:
'make' flags for that board, or '' if none
"""
- self._make_flags['target'] = board.target
+ self._make_flags['target'] = brd.target
arg_str = self.ResolveReferences(self._make_flags,
- self._make_flags.get(board.target, ''))
+ self._make_flags.get(brd.target, ''))
args = re.findall("(?:\".*?\"|\S)+", arg_str)
i = 0
while i < len(args):