summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2014-08-09 15:33:02 -0600
committerSimon Glass <sjg@chromium.org>2014-08-13 08:34:15 -0600
commitb2ea7ab25258621871db1f884be1a2f2b1641741 (patch)
treebcf0dc78bbe4c8c3537d6e7c22456c6621587b8b /tools
parentc1de50149228c73c90f71a51c8a0a4ab7d651b3a (diff)
downloadu-boot-imx-b2ea7ab25258621871db1f884be1a2f2b1641741.zip
u-boot-imx-b2ea7ab25258621871db1f884be1a2f2b1641741.tar.gz
u-boot-imx-b2ea7ab25258621871db1f884be1a2f2b1641741.tar.bz2
buildman: Refactor output options
We need the output options to be available in several places. It's a pain to pass them into each function. Make them properties of the builder and add a single function to set them up. At the same time, add a function which produces summary output using these options. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/buildman/builder.py46
-rw-r--r--tools/buildman/control.py8
-rw-r--r--tools/buildman/test.py6
3 files changed, 34 insertions, 26 deletions
diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index e2da0eb..a6c43e0 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -235,6 +235,20 @@ class Builder:
for t in self.threads:
del t
+ def SetDisplayOptions(self, show_errors=False, show_sizes=False,
+ show_detail=False, show_bloat=False):
+ """Setup display options for the builder.
+
+ show_errors: True to show summarised error/warning info
+ show_sizes: Show size deltas
+ show_detail: Show detail for each board
+ show_bloat: Show detail for each function
+ """
+ self._show_errors = show_errors
+ self._show_sizes = show_sizes
+ self._show_detail = show_detail
+ self._show_bloat = show_bloat
+
def _AddTimestamp(self):
"""Add a new timestamp to the list and record the build period.
@@ -891,9 +905,18 @@ class Builder:
print "Boards not built (%d): %s" % (len(not_built),
', '.join(not_built))
+ def ProduceResultSummary(self, commit_upto, commits, board_selected):
+ board_dict, err_lines = self.GetResultSummary(board_selected,
+ commit_upto, read_func_sizes=self._show_bloat)
+ if commits:
+ msg = '%02d: %s' % (commit_upto + 1,
+ commits[commit_upto].subject)
+ print self.col.Color(self.col.BLUE, msg)
+ self.PrintResultSummary(board_selected, board_dict,
+ err_lines if self._show_errors else [],
+ self._show_sizes, self._show_detail, self._show_bloat)
- def ShowSummary(self, commits, board_selected, show_errors, show_sizes,
- show_detail, show_bloat):
+ def ShowSummary(self, commits, board_selected):
"""Show a build summary for U-Boot for a given board list.
Reset the result summary, then repeatedly call GetResultSummary on
@@ -902,27 +925,13 @@ class Builder:
Args:
commit: Commit objects to summarise
board_selected: Dict containing boards to summarise
- show_errors: Show errors that occured
- show_sizes: Show size deltas
- show_detail: Show detail for each board
- show_bloat: Show detail for each function
"""
self.commit_count = len(commits) if commits else 1
self.commits = commits
self.ResetResultSummary(board_selected)
for commit_upto in range(0, self.commit_count, self._step):
- board_dict, err_lines = self.GetResultSummary(board_selected,
- commit_upto, read_func_sizes=show_bloat)
- if commits:
- msg = '%02d: %s' % (commit_upto + 1,
- commits[commit_upto].subject)
- else:
- msg = 'current'
- print self.col.Color(self.col.BLUE, msg)
- self.PrintResultSummary(board_selected, board_dict,
- err_lines if show_errors else [], show_sizes, show_detail,
- show_bloat)
+ self.ProduceResultSummary(commit_upto, commits, board_selected)
def SetupBuild(self, board_selected, commits):
@@ -1032,14 +1041,13 @@ class Builder:
if dirname not in dir_list:
shutil.rmtree(dirname)
- def BuildBoards(self, commits, board_selected, show_errors, keep_outputs):
+ def BuildBoards(self, commits, board_selected, keep_outputs):
"""Build all commits for a list of boards
Args:
commits: List of commits to be build, each a Commit object
boards_selected: Dict of selected boards, key is target name,
value is Board object
- show_errors: True to show summarised error/warning info
keep_outputs: True to save build output files
"""
self.commit_count = len(commits) if commits else 1
diff --git a/tools/buildman/control.py b/tools/buildman/control.py
index 12a9699..d8fa74b 100644
--- a/tools/buildman/control.py
+++ b/tools/buildman/control.py
@@ -207,13 +207,13 @@ def DoBuildman(options, args):
print GetActionSummary(options.summary, commits, board_selected,
options)
+ builder.SetDisplayOptions(options.show_errors, options.show_sizes,
+ options.show_detail, options.show_bloat)
if options.summary:
# We can't show function sizes without board details at present
if options.show_bloat:
options.show_detail = True
- builder.ShowSummary(commits, board_selected,
- options.show_errors, options.show_sizes,
- options.show_detail, options.show_bloat)
+ builder.ShowSummary(commits, board_selected)
else:
builder.BuildBoards(commits, board_selected,
- options.show_errors, options.keep_outputs)
+ options.keep_outputs)
diff --git a/tools/buildman/test.py b/tools/buildman/test.py
index 068784a..c6923af 100644
--- a/tools/buildman/test.py
+++ b/tools/buildman/test.py
@@ -137,9 +137,9 @@ class TestBuild(unittest.TestCase):
board_selected = self.boards.GetSelectedDict()
#build.BuildCommits(self.commits, board_selected, False)
- build.BuildBoards(self.commits, board_selected, False, False)
- build.ShowSummary(self.commits, board_selected, True, False,
- False, False)
+ build.BuildBoards(self.commits, board_selected, False)
+ build.SetDisplayOptions(show_errors=True);
+ build.ShowSummary(self.commits, board_selected)
def _testGit(self):
"""Test basic builder operation by building a branch"""