diff options
author | Tom Rini <trini@konsulko.com> | 2022-02-10 09:02:06 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-02-10 09:19:44 -0500 |
commit | 2ccd2bc8c3580e00c51094c5cc2b3e2ead8d35c3 (patch) | |
tree | 4e7349b8831fee4b342a971025273d3cd042a2f9 /tools/buildman/builder.py | |
parent | 6662e5e406fdee26ba981dd4af3308f51f254f0a (diff) | |
parent | f3078d4ea707931c2307a623ecf6e4d215b413d5 (diff) |
Merge tag 'dm-pull-8feb22-take3' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm
patman snake-case conversion
binman fit improvements
ACPI fixes and making MCFG available to ARM
[trini: Update scripts/pylint.base]
Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'tools/buildman/builder.py')
-rw-r--r-- | tools/buildman/builder.py | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py index 720bbb2cf4d..754642d4a68 100644 --- a/tools/buildman/builder.py +++ b/tools/buildman/builder.py @@ -22,7 +22,7 @@ from buildman import toolchain from patman import command from patman import gitutil from patman import terminal -from patman.terminal import Print +from patman.terminal import tprint # This indicates an new int or hex Kconfig property with no default # It hangs the build since the 'conf' tool cannot proceed without valid input. @@ -442,7 +442,7 @@ class Builder: """ self.commit = commit if checkout and self.checkout: - gitutil.Checkout(commit.hash) + gitutil.checkout(commit.hash) def Make(self, commit, brd, stage, cwd, *args, **kwargs): """Run make @@ -453,7 +453,7 @@ class Builder: stage: Stage that we are at (mrproper, config, build) cwd: Directory where make should be run args: Arguments to pass to make - kwargs: Arguments to pass to command.RunPipe() + kwargs: Arguments to pass to command.run_pipe() """ def check_output(stream, data): @@ -476,7 +476,7 @@ class Builder: self._restarting_config = False self._terminated = False cmd = [self.gnu_make] + list(args) - result = command.RunPipe([cmd], capture=True, capture_stderr=True, + result = command.run_pipe([cmd], capture=True, capture_stderr=True, cwd=cwd, raise_on_error=False, infile='/dev/null', output_func=check_output, **kwargs) @@ -508,7 +508,7 @@ class Builder: if result.already_done: self.already_done += 1 if self._verbose: - terminal.PrintClear() + terminal.print_clear() boards_selected = {target : result.brd} self.ResetResultSummary(boards_selected) self.ProduceResultSummary(result.commit_upto, self.commits, @@ -518,14 +518,14 @@ class Builder: # Display separate counts for ok, warned and fail ok = self.upto - self.warned - self.fail - line = '\r' + self.col.Color(self.col.GREEN, '%5d' % ok) - line += self.col.Color(self.col.YELLOW, '%5d' % self.warned) - line += self.col.Color(self.col.RED, '%5d' % self.fail) + line = '\r' + self.col.build(self.col.GREEN, '%5d' % ok) + line += self.col.build(self.col.YELLOW, '%5d' % self.warned) + line += self.col.build(self.col.RED, '%5d' % self.fail) line += ' /%-5d ' % self.count remaining = self.count - self.upto if remaining: - line += self.col.Color(self.col.MAGENTA, ' -%-5d ' % remaining) + line += self.col.build(self.col.MAGENTA, ' -%-5d ' % remaining) else: line += ' ' * 8 @@ -535,8 +535,8 @@ class Builder: line += '%s : ' % self._complete_delay line += target - terminal.PrintClear() - Print(line, newline=False, limit_to_line=True) + terminal.print_clear() + tprint(line, newline=False, limit_to_line=True) def _GetOutputDir(self, commit_upto): """Get the name of the output directory for a commit number @@ -666,7 +666,7 @@ class Builder: if line.strip(): size, type, name = line[:-1].split() except: - Print("Invalid line in file '%s': '%s'" % (fname, line[:-1])) + tprint("Invalid line in file '%s': '%s'" % (fname, line[:-1])) continue if type in 'tTdDbB': # function names begin with '.' on 64-bit powerpc @@ -933,9 +933,9 @@ class Builder: arch = board_dict[target].arch else: arch = 'unknown' - str = self.col.Color(color, ' ' + target) + str = self.col.build(color, ' ' + target) if not arch in done_arch: - str = ' %s %s' % (self.col.Color(color, char), str) + str = ' %s %s' % (self.col.build(color, char), str) done_arch[arch] = True if not arch in arch_list: arch_list[arch] = str @@ -947,7 +947,7 @@ class Builder: color = self.col.RED if num > 0 else self.col.GREEN if num == 0: return '0' - return self.col.Color(color, str(num)) + return self.col.build(color, str(num)) def ResetResultSummary(self, board_selected): """Reset the results summary ready for use. @@ -1009,16 +1009,16 @@ class Builder: return args = [self.ColourNum(x) for x in args] indent = ' ' * 15 - Print('%s%s: add: %s/%s, grow: %s/%s bytes: %s/%s (%s)' % - tuple([indent, self.col.Color(self.col.YELLOW, fname)] + args)) - Print('%s %-38s %7s %7s %+7s' % (indent, 'function', 'old', 'new', + tprint('%s%s: add: %s/%s, grow: %s/%s bytes: %s/%s (%s)' % + tuple([indent, self.col.build(self.col.YELLOW, fname)] + args)) + tprint('%s %-38s %7s %7s %+7s' % (indent, 'function', 'old', 'new', 'delta')) for diff, name in delta: if diff: color = self.col.RED if diff > 0 else self.col.GREEN msg = '%s %-38s %7s %7s %+7d' % (indent, name, old.get(name, '-'), new.get(name,'-'), diff) - Print(msg, colour=color) + tprint(msg, colour=color) def PrintSizeDetail(self, target_list, show_bloat): @@ -1043,12 +1043,12 @@ class Builder: color = self.col.RED if diff > 0 else self.col.GREEN msg = ' %s %+d' % (name, diff) if not printed_target: - Print('%10s %-15s:' % ('', result['_target']), + tprint('%10s %-15s:' % ('', result['_target']), newline=False) printed_target = True - Print(msg, colour=color, newline=False) + tprint(msg, colour=color, newline=False) if printed_target: - Print() + tprint() if show_bloat: target = result['_target'] outcome = result['_outcome'] @@ -1153,13 +1153,13 @@ class Builder: color = self.col.RED if avg_diff > 0 else self.col.GREEN msg = ' %s %+1.1f' % (name, avg_diff) if not printed_arch: - Print('%10s: (for %d/%d boards)' % (arch, count, + tprint('%10s: (for %d/%d boards)' % (arch, count, arch_count[arch]), newline=False) printed_arch = True - Print(msg, colour=color, newline=False) + tprint(msg, colour=color, newline=False) if printed_arch: - Print() + tprint() if show_detail: self.PrintSizeDetail(target_list, show_bloat) @@ -1304,7 +1304,7 @@ class Builder: col = self.col.RED elif line[0] == 'c': col = self.col.YELLOW - Print(' ' + line, newline=True, colour=col) + tprint(' ' + line, newline=True, colour=col) def _OutputErrLines(err_lines, colour): """Output the line of error/warning lines, if not empty @@ -1324,14 +1324,14 @@ class Builder: names = [board.target for board in line.boards] board_str = ' '.join(names) if names else '' if board_str: - out = self.col.Color(colour, line.char + '(') - out += self.col.Color(self.col.MAGENTA, board_str, + out = self.col.build(colour, line.char + '(') + out += self.col.build(self.col.MAGENTA, board_str, bright=False) - out += self.col.Color(colour, ') %s' % line.errline) + out += self.col.build(colour, ') %s' % line.errline) else: - out = self.col.Color(colour, line.char + line.errline) + out = self.col.build(colour, line.char + line.errline) out_list.append(out) - Print('\n'.join(out_list)) + tprint('\n'.join(out_list)) self._error_lines += 1 @@ -1385,7 +1385,7 @@ class Builder: self.AddOutcome(board_selected, arch_list, unknown_boards, '?', self.col.MAGENTA) for arch, target_list in arch_list.items(): - Print('%10s: %s' % (arch, target_list)) + tprint('%10s: %s' % (arch, target_list)) self._error_lines += 1 _OutputErrLines(better_err, colour=self.col.GREEN) _OutputErrLines(worse_err, colour=self.col.RED) @@ -1515,13 +1515,13 @@ class Builder: _AddConfig(lines, 'all', all_plus, all_minus, all_change) #arch_summary[target] = '\n'.join(lines) if lines: - Print('%s:' % arch) + tprint('%s:' % arch) _OutputConfigInfo(lines) for lines, targets in lines_by_target.items(): if not lines: continue - Print('%s :' % ' '.join(sorted(targets))) + tprint('%s :' % ' '.join(sorted(targets))) _OutputConfigInfo(lines.split('\n')) @@ -1540,7 +1540,7 @@ class Builder: if not board in board_dict: not_built.append(board) if not_built: - Print("Boards not built (%d): %s" % (len(not_built), + tprint("Boards not built (%d): %s" % (len(not_built), ', '.join(not_built))) def ProduceResultSummary(self, commit_upto, commits, board_selected): @@ -1553,7 +1553,7 @@ class Builder: if commits: msg = '%02d: %s' % (commit_upto + 1, commits[commit_upto].subject) - Print(msg, colour=self.col.BLUE) + tprint(msg, colour=self.col.BLUE) self.PrintResultSummary(board_selected, board_dict, err_lines if self._show_errors else [], err_line_boards, warn_lines if self._show_errors else [], warn_line_boards, @@ -1578,7 +1578,7 @@ class Builder: for commit_upto in range(0, self.commit_count, self._step): self.ProduceResultSummary(commit_upto, commits, board_selected) if not self._error_lines: - Print('(no errors to report)', colour=self.col.GREEN) + tprint('(no errors to report)', colour=self.col.GREEN) def SetupBuild(self, board_selected, commits): @@ -1629,10 +1629,10 @@ class Builder: if os.path.isdir(git_dir): # This is a clone of the src_dir repo, we can keep using # it but need to fetch from src_dir. - Print('\rFetching repo for thread %d' % thread_num, + tprint('\rFetching repo for thread %d' % thread_num, newline=False) - gitutil.Fetch(git_dir, thread_dir) - terminal.PrintClear() + gitutil.fetch(git_dir, thread_dir) + terminal.print_clear() elif os.path.isfile(git_dir): # This is a worktree of the src_dir repo, we don't need to # create it again or update it in any way. @@ -1643,15 +1643,15 @@ class Builder: raise ValueError('Git dir %s exists, but is not a file ' 'or a directory.' % git_dir) elif setup_git == 'worktree': - Print('\rChecking out worktree for thread %d' % thread_num, + tprint('\rChecking out worktree for thread %d' % thread_num, newline=False) - gitutil.AddWorktree(src_dir, thread_dir) - terminal.PrintClear() + gitutil.add_worktree(src_dir, thread_dir) + terminal.print_clear() elif setup_git == 'clone' or setup_git == True: - Print('\rCloning repo for thread %d' % thread_num, + tprint('\rCloning repo for thread %d' % thread_num, newline=False) - gitutil.Clone(src_dir, thread_dir) - terminal.PrintClear() + gitutil.clone(src_dir, thread_dir) + terminal.print_clear() else: raise ValueError("Can't setup git repo with %s." % setup_git) @@ -1670,12 +1670,12 @@ class Builder: builderthread.Mkdir(self._working_dir) if setup_git and self.git_dir: src_dir = os.path.abspath(self.git_dir) - if gitutil.CheckWorktreeIsAvailable(src_dir): + if gitutil.check_worktree_is_available(src_dir): setup_git = 'worktree' # If we previously added a worktree but the directory for it # got deleted, we need to prune its files from the repo so # that we can check out another in its place. - gitutil.PruneWorktrees(src_dir) + gitutil.prune_worktrees(src_dir) else: setup_git = 'clone' @@ -1717,11 +1717,11 @@ class Builder: """ to_remove = self._GetOutputSpaceRemovals() if to_remove: - Print('Removing %d old build directories...' % len(to_remove), + tprint('Removing %d old build directories...' % len(to_remove), newline=False) for dirname in to_remove: shutil.rmtree(dirname) - terminal.PrintClear() + terminal.print_clear() def BuildBoards(self, commits, board_selected, keep_outputs, verbose): """Build all commits for a list of boards @@ -1747,7 +1747,7 @@ class Builder: self._PrepareWorkingSpace(min(self.num_threads, len(board_selected)), commits is not None) self._PrepareOutputSpace() - Print('\rStarting build...', newline=False) + tprint('\rStarting build...', newline=False) self.SetupBuild(board_selected, commits) self.ProcessResult(None) self.thread_exceptions = [] @@ -1774,7 +1774,7 @@ class Builder: # Wait until we have processed all output self.out_queue.join() - Print() + tprint() msg = 'Completed: %d total built' % self.count if self.already_done: @@ -1789,9 +1789,9 @@ class Builder: duration = duration - timedelta(microseconds=duration.microseconds) rate = float(self.count) / duration.total_seconds() msg += ', duration %s, rate %1.2f' % (duration, rate) - Print(msg) + tprint(msg) if self.thread_exceptions: - Print('Failed: %d thread exceptions' % len(self.thread_exceptions), + tprint('Failed: %d thread exceptions' % len(self.thread_exceptions), colour=self.col.RED) return (self.fail, self.warned, self.thread_exceptions) |