mirror of
https://github.com/smaeul/u-boot.git
synced 2025-10-14 04:46:01 +01:00
buildman: Support running from an IDE
Add a flag to allow buildman to behave properly for use from an IDE. This shows error/warning output on stderr and drops all summary and progress information. This should normally only be used when building a single board. Fix up a confusing comment for GetResultSummary() while we are here, since we want to use the Outcome object to access the unprocessed error lines from the build. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
5635c50720
commit
ae1a09f803
@ -1092,6 +1092,21 @@ This will write the full build into /tmp/build including object files. You must
|
|||||||
specify the output directory with -o when using -w.
|
specify the output directory with -o when using -w.
|
||||||
|
|
||||||
|
|
||||||
|
Support for IDEs (Integrated Development Environments)
|
||||||
|
======================================================
|
||||||
|
|
||||||
|
Normally buildman summarises the output and shows information indicating the
|
||||||
|
meaning of each line of output. For example a '+' symbol appears at the start of
|
||||||
|
each error line. Also, buildman prints information about what it is about to do,
|
||||||
|
along with a summary at the end.
|
||||||
|
|
||||||
|
When using buildman from an IDE, it is helpful to drop this behaviour. Use the
|
||||||
|
-I/--ide option for that. You might find -W helpful also so that warnings do
|
||||||
|
not cause the build to fail:
|
||||||
|
|
||||||
|
buildman -o /tmp/build --board sandbox -wWI
|
||||||
|
|
||||||
|
|
||||||
Changing the configuration
|
Changing the configuration
|
||||||
==========================
|
==========================
|
||||||
|
|
||||||
|
@ -213,6 +213,8 @@ class Builder:
|
|||||||
threading is not being used
|
threading is not being used
|
||||||
_terminated: Thread was terminated due to an error
|
_terminated: Thread was terminated due to an error
|
||||||
_restarting_config: True if 'Restart config' is detected in output
|
_restarting_config: True if 'Restart config' is detected in output
|
||||||
|
_ide: Produce output suitable for an Integrated Development Environment,
|
||||||
|
i.e. dont emit progress information and put errors/warnings on stderr
|
||||||
"""
|
"""
|
||||||
class Outcome:
|
class Outcome:
|
||||||
"""Records a build outcome for a single make invocation
|
"""Records a build outcome for a single make invocation
|
||||||
@ -325,6 +327,7 @@ class Builder:
|
|||||||
self.config_filenames = BASE_CONFIG_FILENAMES
|
self.config_filenames = BASE_CONFIG_FILENAMES
|
||||||
self.work_in_output = work_in_output
|
self.work_in_output = work_in_output
|
||||||
self.adjust_cfg = adjust_cfg
|
self.adjust_cfg = adjust_cfg
|
||||||
|
self._ide = False
|
||||||
|
|
||||||
if not self.squash_config_y:
|
if not self.squash_config_y:
|
||||||
self.config_filenames += EXTRA_CONFIG_FILENAMES
|
self.config_filenames += EXTRA_CONFIG_FILENAMES
|
||||||
@ -382,7 +385,7 @@ class Builder:
|
|||||||
show_detail=False, show_bloat=False,
|
show_detail=False, show_bloat=False,
|
||||||
list_error_boards=False, show_config=False,
|
list_error_boards=False, show_config=False,
|
||||||
show_environment=False, filter_dtb_warnings=False,
|
show_environment=False, filter_dtb_warnings=False,
|
||||||
filter_migration_warnings=False):
|
filter_migration_warnings=False, ide=False):
|
||||||
"""Setup display options for the builder.
|
"""Setup display options for the builder.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -397,6 +400,8 @@ class Builder:
|
|||||||
compiler
|
compiler
|
||||||
filter_migration_warnings: Filter out any warnings about migrating
|
filter_migration_warnings: Filter out any warnings about migrating
|
||||||
a board to driver model
|
a board to driver model
|
||||||
|
ide: Create output that can be parsed by an IDE. There is no '+' prefix on
|
||||||
|
error lines and output on stderr stays on stderr.
|
||||||
"""
|
"""
|
||||||
self._show_errors = show_errors
|
self._show_errors = show_errors
|
||||||
self._show_sizes = show_sizes
|
self._show_sizes = show_sizes
|
||||||
@ -407,6 +412,7 @@ class Builder:
|
|||||||
self._show_environment = show_environment
|
self._show_environment = show_environment
|
||||||
self._filter_dtb_warnings = filter_dtb_warnings
|
self._filter_dtb_warnings = filter_dtb_warnings
|
||||||
self._filter_migration_warnings = filter_migration_warnings
|
self._filter_migration_warnings = filter_migration_warnings
|
||||||
|
self._ide = ide
|
||||||
|
|
||||||
def _AddTimestamp(self):
|
def _AddTimestamp(self):
|
||||||
"""Add a new timestamp to the list and record the build period.
|
"""Add a new timestamp to the list and record the build period.
|
||||||
@ -535,8 +541,9 @@ class Builder:
|
|||||||
line += '%s : ' % self._complete_delay
|
line += '%s : ' % self._complete_delay
|
||||||
|
|
||||||
line += target
|
line += target
|
||||||
terminal.print_clear()
|
if not self._ide:
|
||||||
tprint(line, newline=False, limit_to_line=True)
|
terminal.print_clear()
|
||||||
|
tprint(line, newline=False, limit_to_line=True)
|
||||||
|
|
||||||
def _GetOutputDir(self, commit_upto):
|
def _GetOutputDir(self, commit_upto):
|
||||||
"""Get the name of the output directory for a commit number
|
"""Get the name of the output directory for a commit number
|
||||||
@ -834,8 +841,9 @@ class Builder:
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Tuple:
|
Tuple:
|
||||||
Dict containing boards which passed building this commit.
|
Dict containing boards which built this commit:
|
||||||
keyed by board.target
|
key: board.target
|
||||||
|
value: Builder.Outcome object
|
||||||
List containing a summary of error lines
|
List containing a summary of error lines
|
||||||
Dict keyed by error line, containing a list of the Board
|
Dict keyed by error line, containing a list of the Board
|
||||||
objects with that error
|
objects with that error
|
||||||
@ -1369,8 +1377,14 @@ class Builder:
|
|||||||
better_warn, worse_warn = _CalcErrorDelta(self._base_warn_lines,
|
better_warn, worse_warn = _CalcErrorDelta(self._base_warn_lines,
|
||||||
self._base_warn_line_boards, warn_lines, warn_line_boards, 'w')
|
self._base_warn_line_boards, warn_lines, warn_line_boards, 'w')
|
||||||
|
|
||||||
|
# For the IDE mode, print out all the output
|
||||||
|
if self._ide:
|
||||||
|
outcome = board_dict[target]
|
||||||
|
for line in outcome.err_lines:
|
||||||
|
sys.stderr.write(line)
|
||||||
|
|
||||||
# Display results by arch
|
# Display results by arch
|
||||||
if any((ok_boards, warn_boards, err_boards, unknown_boards, new_boards,
|
elif any((ok_boards, warn_boards, err_boards, unknown_boards, new_boards,
|
||||||
worse_err, better_err, worse_warn, better_warn)):
|
worse_err, better_err, worse_warn, better_warn)):
|
||||||
arch_list = {}
|
arch_list = {}
|
||||||
self.AddOutcome(board_selected, arch_list, ok_boards, '',
|
self.AddOutcome(board_selected, arch_list, ok_boards, '',
|
||||||
@ -1746,7 +1760,8 @@ class Builder:
|
|||||||
self._PrepareWorkingSpace(min(self.num_threads, len(board_selected)),
|
self._PrepareWorkingSpace(min(self.num_threads, len(board_selected)),
|
||||||
commits is not None)
|
commits is not None)
|
||||||
self._PrepareOutputSpace()
|
self._PrepareOutputSpace()
|
||||||
tprint('\rStarting build...', newline=False)
|
if not self._ide:
|
||||||
|
tprint('\rStarting build...', newline=False)
|
||||||
self.SetupBuild(board_selected, commits)
|
self.SetupBuild(board_selected, commits)
|
||||||
self.ProcessResult(None)
|
self.ProcessResult(None)
|
||||||
self.thread_exceptions = []
|
self.thread_exceptions = []
|
||||||
@ -1773,24 +1788,25 @@ class Builder:
|
|||||||
|
|
||||||
# Wait until we have processed all output
|
# Wait until we have processed all output
|
||||||
self.out_queue.join()
|
self.out_queue.join()
|
||||||
tprint()
|
if not self._ide:
|
||||||
|
tprint()
|
||||||
|
|
||||||
msg = 'Completed: %d total built' % self.count
|
msg = 'Completed: %d total built' % self.count
|
||||||
if self.already_done:
|
if self.already_done:
|
||||||
msg += ' (%d previously' % self.already_done
|
msg += ' (%d previously' % self.already_done
|
||||||
if self.already_done != self.count:
|
if self.already_done != self.count:
|
||||||
msg += ', %d newly' % (self.count - self.already_done)
|
msg += ', %d newly' % (self.count - self.already_done)
|
||||||
msg += ')'
|
msg += ')'
|
||||||
duration = datetime.now() - self._start_time
|
duration = datetime.now() - self._start_time
|
||||||
if duration > timedelta(microseconds=1000000):
|
if duration > timedelta(microseconds=1000000):
|
||||||
if duration.microseconds >= 500000:
|
if duration.microseconds >= 500000:
|
||||||
duration = duration + timedelta(seconds=1)
|
duration = duration + timedelta(seconds=1)
|
||||||
duration = duration - timedelta(microseconds=duration.microseconds)
|
duration = duration - timedelta(microseconds=duration.microseconds)
|
||||||
rate = float(self.count) / duration.total_seconds()
|
rate = float(self.count) / duration.total_seconds()
|
||||||
msg += ', duration %s, rate %1.2f' % (duration, rate)
|
msg += ', duration %s, rate %1.2f' % (duration, rate)
|
||||||
tprint(msg)
|
tprint(msg)
|
||||||
if self.thread_exceptions:
|
if self.thread_exceptions:
|
||||||
tprint('Failed: %d thread exceptions' % len(self.thread_exceptions),
|
tprint('Failed: %d thread exceptions' % len(self.thread_exceptions),
|
||||||
colour=self.col.RED)
|
colour=self.col.RED)
|
||||||
|
|
||||||
return (self.fail, self.warned, self.thread_exceptions)
|
return (self.fail, self.warned, self.thread_exceptions)
|
||||||
|
@ -59,6 +59,8 @@ def ParseArgs():
|
|||||||
parser.add_option('-i', '--in-tree', dest='in_tree',
|
parser.add_option('-i', '--in-tree', dest='in_tree',
|
||||||
action='store_true', default=False,
|
action='store_true', default=False,
|
||||||
help='Build in the source tree instead of a separate directory')
|
help='Build in the source tree instead of a separate directory')
|
||||||
|
parser.add_option('-I', '--ide', action='store_true', default=False,
|
||||||
|
help='Create build output that can be parsed by an IDE')
|
||||||
parser.add_option('-j', '--jobs', dest='jobs', type='int',
|
parser.add_option('-j', '--jobs', dest='jobs', type='int',
|
||||||
default=None, help='Number of jobs to run at once (passed to make)')
|
default=None, help='Number of jobs to run at once (passed to make)')
|
||||||
parser.add_option('-k', '--keep-outputs', action='store_true',
|
parser.add_option('-k', '--keep-outputs', action='store_true',
|
||||||
|
@ -359,8 +359,9 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
|
|||||||
else:
|
else:
|
||||||
commits = None
|
commits = None
|
||||||
|
|
||||||
tprint(GetActionSummary(options.summary, commits, board_selected,
|
if not options.ide:
|
||||||
options))
|
tprint(GetActionSummary(options.summary, commits, board_selected,
|
||||||
|
options))
|
||||||
|
|
||||||
# We can't show function sizes without board details at present
|
# We can't show function sizes without board details at present
|
||||||
if options.show_bloat:
|
if options.show_bloat:
|
||||||
@ -369,7 +370,7 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
|
|||||||
options.show_errors, options.show_sizes, options.show_detail,
|
options.show_errors, options.show_sizes, options.show_detail,
|
||||||
options.show_bloat, options.list_error_boards, options.show_config,
|
options.show_bloat, options.list_error_boards, options.show_config,
|
||||||
options.show_environment, options.filter_dtb_warnings,
|
options.show_environment, options.filter_dtb_warnings,
|
||||||
options.filter_migration_warnings)
|
options.filter_migration_warnings, options.ide)
|
||||||
if options.summary:
|
if options.summary:
|
||||||
builder.ShowSummary(commits, board_selected)
|
builder.ShowSummary(commits, board_selected)
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user