blob: 79ce2f6978a5b2158a5a5d48cf8e6e40b737d21b [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001# SPDX-License-Identifier: GPL-2.0+
Simon Glassfc3fe1c2013-04-03 11:07:16 +00002# Copyright (c) 2013 The Chromium OS Authors.
3#
Simon Glassfc3fe1c2013-04-03 11:07:16 +00004
5import multiprocessing
6import os
Simon Glass883a3212014-09-05 19:00:18 -06007import shutil
Simon Glass0ede00f2020-04-17 18:09:02 -06008import subprocess
Simon Glassfc3fe1c2013-04-03 11:07:16 +00009import sys
10
Simon Glassc52bd222022-07-11 19:04:03 -060011from buildman import boards
Simon Glass0ede00f2020-04-17 18:09:02 -060012from buildman import bsettings
Simon Glass2b4806e2022-01-22 05:07:33 -070013from buildman import cfgutil
Simon Glass0ede00f2020-04-17 18:09:02 -060014from buildman import toolchain
15from buildman.builder import Builder
Simon Glassbf776672020-04-17 18:09:04 -060016from patman import command
17from patman import gitutil
18from patman import patchstream
19from patman import terminal
Paul Barker5fe50f92021-09-08 12:38:01 +010020from patman import tools
Simon Glass098b10f2022-01-29 14:14:18 -070021from patman.terminal import tprint
Simon Glassfc3fe1c2013-04-03 11:07:16 +000022
23def GetPlural(count):
24 """Returns a plural 's' if count is not 1"""
25 return 's' if count != 1 else ''
26
Simon Glassfea58582014-08-09 15:32:59 -060027def GetActionSummary(is_summary, commits, selected, options):
Simon Glassfc3fe1c2013-04-03 11:07:16 +000028 """Return a string summarising the intended action.
29
30 Returns:
31 Summary string.
32 """
Simon Glassfea58582014-08-09 15:32:59 -060033 if commits:
34 count = len(commits)
Simon Glassc05aa032019-10-31 07:42:53 -060035 count = (count + options.step - 1) // options.step
Simon Glassfea58582014-08-09 15:32:59 -060036 commit_str = '%d commit%s' % (count, GetPlural(count))
37 else:
38 commit_str = 'current source'
39 str = '%s %s for %d boards' % (
40 'Summary of' if is_summary else 'Building', commit_str,
Simon Glassfc3fe1c2013-04-03 11:07:16 +000041 len(selected))
42 str += ' (%d thread%s, %d job%s per thread)' % (options.threads,
43 GetPlural(options.threads), options.jobs, GetPlural(options.jobs))
44 return str
45
Simon Glass06890362018-06-11 23:26:46 -060046def ShowActions(series, why_selected, boards_selected, builder, options,
47 board_warnings):
Simon Glassfc3fe1c2013-04-03 11:07:16 +000048 """Display a list of actions that we would take, if not a dry run.
49
50 Args:
51 series: Series object
52 why_selected: Dictionary where each key is a buildman argument
Simon Glass8d7523c2017-01-23 05:38:56 -070053 provided by the user, and the value is the list of boards
54 brought in by that argument. For example, 'arm' might bring
55 in 400 boards, so in this case the key would be 'arm' and
Simon Glassfc3fe1c2013-04-03 11:07:16 +000056 the value would be a list of board names.
57 boards_selected: Dict of selected boards, key is target name,
58 value is Board object
59 builder: The builder that will be used to build the commits
60 options: Command line options object
Simon Glass06890362018-06-11 23:26:46 -060061 board_warnings: List of warnings obtained from board selected
Simon Glassfc3fe1c2013-04-03 11:07:16 +000062 """
63 col = terminal.Color()
Simon Glassc05aa032019-10-31 07:42:53 -060064 print('Dry run, so not doing much. But I would do this:')
65 print()
Simon Glassfea58582014-08-09 15:32:59 -060066 if series:
67 commits = series.commits
68 else:
69 commits = None
Simon Glassc05aa032019-10-31 07:42:53 -060070 print(GetActionSummary(False, commits, boards_selected,
71 options))
72 print('Build directory: %s' % builder.base_dir)
Simon Glassfea58582014-08-09 15:32:59 -060073 if commits:
74 for upto in range(0, len(series.commits), options.step):
75 commit = series.commits[upto]
Simon Glass252ac582022-01-29 14:14:17 -070076 print(' ', col.build(col.YELLOW, commit.hash[:8], bright=False), end=' ')
Simon Glassc05aa032019-10-31 07:42:53 -060077 print(commit.subject)
78 print()
Simon Glassfc3fe1c2013-04-03 11:07:16 +000079 for arg in why_selected:
80 if arg != 'all':
Simon Glassc05aa032019-10-31 07:42:53 -060081 print(arg, ': %d boards' % len(why_selected[arg]))
Simon Glass8d7523c2017-01-23 05:38:56 -070082 if options.verbose:
Simon Glassc05aa032019-10-31 07:42:53 -060083 print(' %s' % ' '.join(why_selected[arg]))
84 print(('Total boards to build for each commit: %d\n' %
85 len(why_selected['all'])))
Simon Glass06890362018-06-11 23:26:46 -060086 if board_warnings:
87 for warning in board_warnings:
Simon Glass252ac582022-01-29 14:14:17 -070088 print(col.build(col.YELLOW, warning))
Simon Glassfc3fe1c2013-04-03 11:07:16 +000089
Simon Glasscc2c0d12022-07-11 19:04:00 -060090def ShowToolchainPrefix(brds, toolchains):
Simon Glass57cb9d52019-12-05 15:59:14 -070091 """Show information about a the tool chain used by one or more boards
92
Simon Glass4e9162d2020-03-18 09:42:47 -060093 The function checks that all boards use the same toolchain, then prints
94 the correct value for CROSS_COMPILE.
Simon Glass57cb9d52019-12-05 15:59:14 -070095
96 Args:
97 boards: Boards object containing selected boards
98 toolchains: Toolchains object containing available toolchains
Simon Glass57cb9d52019-12-05 15:59:14 -070099
100 Return:
101 None on success, string error message otherwise
102 """
Simon Glass6014db62022-07-11 19:04:02 -0600103 board_selected = brds.get_selected_dict()
Simon Glass57cb9d52019-12-05 15:59:14 -0700104 tc_set = set()
Simon Glasscc2c0d12022-07-11 19:04:00 -0600105 for brd in board_selected.values():
Simon Glass57cb9d52019-12-05 15:59:14 -0700106 tc_set.add(toolchains.Select(brd.arch))
107 if len(tc_set) != 1:
108 return 'Supplied boards must share one toolchain'
109 return False
110 tc = tc_set.pop()
Simon Glass4e9162d2020-03-18 09:42:47 -0600111 print(tc.GetEnvArgs(toolchain.VAR_CROSS_COMPILE))
Simon Glass57cb9d52019-12-05 15:59:14 -0700112 return None
113
Simon Glasscc2c0d12022-07-11 19:04:00 -0600114def DoBuildman(options, args, toolchains=None, make_func=None, brds=None,
Simon Glass8116c782021-04-11 16:27:27 +1200115 clean_dir=False, test_thread_exceptions=False):
Simon Glassfc3fe1c2013-04-03 11:07:16 +0000116 """The main control code for buildman
117
118 Args:
119 options: Command line options object
120 args: Command line arguments (list of strings)
Simon Glassd4144e42014-09-05 19:00:13 -0600121 toolchains: Toolchains to use - this should be a Toolchains()
122 object. If None, then it will be created and scanned
123 make_func: Make function to use for the builder. This is called
124 to execute 'make'. If this is None, the normal function
125 will be used, which calls the 'make' tool with suitable
126 arguments. This setting is useful for tests.
Simon Glasscc2c0d12022-07-11 19:04:00 -0600127 brds: Boards() object to use, containing a list of available
Simon Glass823e60b2014-09-05 19:00:16 -0600128 boards. If this is None it will be created and scanned.
Simon Glass24993312021-04-11 16:27:25 +1200129 clean_dir: Used for tests only, indicates that the existing output_dir
130 should be removed before starting the build
Simon Glass8116c782021-04-11 16:27:27 +1200131 test_thread_exceptions: Uses for tests only, True to make the threads
132 raise an exception instead of reporting their result. This simulates
133 a failure in the code somewhere
Simon Glassfc3fe1c2013-04-03 11:07:16 +0000134 """
Simon Glass883a3212014-09-05 19:00:18 -0600135 global builder
136
Simon Glass48ba5852014-09-05 19:00:11 -0600137 if options.full_help:
Simon Glassc1aa66e2022-01-29 14:14:04 -0700138 tools.print_full_help(
Paul Barker5fe50f92021-09-08 12:38:01 +0100139 os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), 'README')
140 )
Simon Glass48ba5852014-09-05 19:00:11 -0600141 return 0
142
Simon Glass0157b182022-01-29 14:14:11 -0700143 gitutil.setup()
Simon Glass713bea32016-07-27 20:33:02 -0600144 col = terminal.Color()
Simon Glassfc3fe1c2013-04-03 11:07:16 +0000145
Simon Glassfc3fe1c2013-04-03 11:07:16 +0000146 options.git_dir = os.path.join(options.git, '.git')
147
Simon Glass7e92e462016-07-27 20:33:04 -0600148 no_toolchains = toolchains is None
149 if no_toolchains:
Simon Glass00beb242019-01-07 16:44:20 -0700150 toolchains = toolchain.Toolchains(options.override_toolchain)
Simon Glassfc3fe1c2013-04-03 11:07:16 +0000151
Simon Glass827e37b2014-12-01 17:34:06 -0700152 if options.fetch_arch:
153 if options.fetch_arch == 'list':
154 sorted_list = toolchains.ListArchs()
Simon Glass252ac582022-01-29 14:14:17 -0700155 print(col.build(col.BLUE, 'Available architectures: %s\n' %
Simon Glassc05aa032019-10-31 07:42:53 -0600156 ' '.join(sorted_list)))
Simon Glass827e37b2014-12-01 17:34:06 -0700157 return 0
158 else:
159 fetch_arch = options.fetch_arch
160 if fetch_arch == 'all':
161 fetch_arch = ','.join(toolchains.ListArchs())
Simon Glass252ac582022-01-29 14:14:17 -0700162 print(col.build(col.CYAN, '\nDownloading toolchains: %s' %
Simon Glassc05aa032019-10-31 07:42:53 -0600163 fetch_arch))
Simon Glass827e37b2014-12-01 17:34:06 -0700164 for arch in fetch_arch.split(','):
Simon Glassc05aa032019-10-31 07:42:53 -0600165 print()
Simon Glass827e37b2014-12-01 17:34:06 -0700166 ret = toolchains.FetchAndInstall(arch)
167 if ret:
168 return ret
169 return 0
170
Simon Glass7e92e462016-07-27 20:33:04 -0600171 if no_toolchains:
172 toolchains.GetSettings()
Simon Glass40232c92018-11-06 16:02:10 -0700173 toolchains.Scan(options.list_tool_chains and options.verbose)
Simon Glass7e92e462016-07-27 20:33:04 -0600174 if options.list_tool_chains:
175 toolchains.List()
Simon Glassc05aa032019-10-31 07:42:53 -0600176 print()
Simon Glass7e92e462016-07-27 20:33:04 -0600177 return 0
178
Simon Glass88daaef2020-04-17 17:51:32 -0600179 if not options.output_dir:
180 if options.work_in_output:
Simon Glass252ac582022-01-29 14:14:17 -0700181 sys.exit(col.build(col.RED, '-w requires that you specify -o'))
Simon Glass88daaef2020-04-17 17:51:32 -0600182 options.output_dir = '..'
Simon Glasseb70a2c2020-04-09 15:08:51 -0600183
Simon Glass7c66ead2019-12-05 15:59:13 -0700184 # Work out what subset of the boards we are building
Simon Glasscc2c0d12022-07-11 19:04:00 -0600185 if not brds:
Simon Glass7c66ead2019-12-05 15:59:13 -0700186 if not os.path.exists(options.output_dir):
187 os.makedirs(options.output_dir)
188 board_file = os.path.join(options.output_dir, 'boards.cfg')
Simon Glass7c66ead2019-12-05 15:59:13 -0700189
Simon Glassc52bd222022-07-11 19:04:03 -0600190 brds = boards.Boards()
Simon Glassa8a01412022-07-11 19:04:04 -0600191 brds.ensure_board_list(board_file,
192 options.threads or multiprocessing.cpu_count(),
193 force=options.regen_board_list,
194 quiet=not options.verbose)
195 if options.regen_board_list:
196 return 0
Simon Glass6014db62022-07-11 19:04:02 -0600197 brds.read_boards(board_file)
Simon Glass7c66ead2019-12-05 15:59:13 -0700198
199 exclude = []
200 if options.exclude:
201 for arg in options.exclude:
202 exclude += arg.split(',')
203
204 if options.boards:
205 requested_boards = []
206 for b in options.boards:
207 requested_boards += b.split(',')
208 else:
209 requested_boards = None
Simon Glass6014db62022-07-11 19:04:02 -0600210 why_selected, board_warnings = brds.select_boards(args, exclude,
211 requested_boards)
212 selected = brds.get_selected()
Simon Glass7c66ead2019-12-05 15:59:13 -0700213 if not len(selected):
Simon Glass252ac582022-01-29 14:14:17 -0700214 sys.exit(col.build(col.RED, 'No matching boards found'))
Simon Glass7c66ead2019-12-05 15:59:13 -0700215
Simon Glass4e9162d2020-03-18 09:42:47 -0600216 if options.print_prefix:
Simon Glasscc2c0d12022-07-11 19:04:00 -0600217 err = ShowToolchainPrefix(brds, toolchains)
Simon Glass57cb9d52019-12-05 15:59:14 -0700218 if err:
Simon Glass252ac582022-01-29 14:14:17 -0700219 sys.exit(col.build(col.RED, err))
Simon Glass57cb9d52019-12-05 15:59:14 -0700220 return 0
221
Simon Glassfc3fe1c2013-04-03 11:07:16 +0000222 # Work out how many commits to build. We want to build everything on the
223 # branch. We also build the upstream commit as a control so we can see
224 # problems introduced by the first commit on the branch.
Simon Glassfc3fe1c2013-04-03 11:07:16 +0000225 count = options.count
Simon Glass5abab202014-12-01 17:33:57 -0700226 has_range = options.branch and '..' in options.branch
Simon Glassfc3fe1c2013-04-03 11:07:16 +0000227 if count == -1:
228 if not options.branch:
Simon Glassfea58582014-08-09 15:32:59 -0600229 count = 1
230 else:
Simon Glass5abab202014-12-01 17:33:57 -0700231 if has_range:
Simon Glass0157b182022-01-29 14:14:11 -0700232 count, msg = gitutil.count_commits_in_range(options.git_dir,
Simon Glass5abab202014-12-01 17:33:57 -0700233 options.branch)
234 else:
Simon Glass0157b182022-01-29 14:14:11 -0700235 count, msg = gitutil.count_commits_in_branch(options.git_dir,
Simon Glass5abab202014-12-01 17:33:57 -0700236 options.branch)
Simon Glassfea58582014-08-09 15:32:59 -0600237 if count is None:
Simon Glass252ac582022-01-29 14:14:17 -0700238 sys.exit(col.build(col.RED, msg))
Simon Glass5abab202014-12-01 17:33:57 -0700239 elif count == 0:
Simon Glass252ac582022-01-29 14:14:17 -0700240 sys.exit(col.build(col.RED, "Range '%s' has no commits" %
Simon Glass5abab202014-12-01 17:33:57 -0700241 options.branch))
Simon Glass2a9e2c62014-12-01 17:33:54 -0700242 if msg:
Simon Glass252ac582022-01-29 14:14:17 -0700243 print(col.build(col.YELLOW, msg))
Simon Glassfea58582014-08-09 15:32:59 -0600244 count += 1 # Build upstream commit also
Simon Glassfc3fe1c2013-04-03 11:07:16 +0000245
246 if not count:
247 str = ("No commits found to process in branch '%s': "
248 "set branch's upstream or use -c flag" % options.branch)
Simon Glass252ac582022-01-29 14:14:17 -0700249 sys.exit(col.build(col.RED, str))
Simon Glassd829f122020-03-18 09:42:42 -0600250 if options.work_in_output:
251 if len(selected) != 1:
Simon Glass252ac582022-01-29 14:14:17 -0700252 sys.exit(col.build(col.RED,
Simon Glassd829f122020-03-18 09:42:42 -0600253 '-w can only be used with a single board'))
254 if count != 1:
Simon Glass252ac582022-01-29 14:14:17 -0700255 sys.exit(col.build(col.RED,
Simon Glassd829f122020-03-18 09:42:42 -0600256 '-w can only be used with a single commit'))
Simon Glassfc3fe1c2013-04-03 11:07:16 +0000257
Simon Glassfc3fe1c2013-04-03 11:07:16 +0000258 # Read the metadata from the commits. First look at the upstream commit,
259 # then the ones in the branch. We would like to do something like
260 # upstream/master~..branch but that isn't possible if upstream/master is
261 # a merge commit (it will list all the commits that form part of the
262 # merge)
Simon Glass950a2312014-09-05 19:00:23 -0600263 # Conflicting tags are not a problem for buildman, since it does not use
264 # them. For example, Series-version is not useful for buildman. On the
265 # other hand conflicting tags will cause an error. So allow later tags
266 # to overwrite earlier ones by setting allow_overwrite=True
Simon Glassfea58582014-08-09 15:32:59 -0600267 if options.branch:
Simon Glass3b74ba52014-08-09 15:33:09 -0600268 if count == -1:
Simon Glass5abab202014-12-01 17:33:57 -0700269 if has_range:
270 range_expr = options.branch
271 else:
Simon Glass0157b182022-01-29 14:14:11 -0700272 range_expr = gitutil.get_range_in_branch(options.git_dir,
Simon Glass5abab202014-12-01 17:33:57 -0700273 options.branch)
Simon Glass0157b182022-01-29 14:14:11 -0700274 upstream_commit = gitutil.get_upstream(options.git_dir,
Simon Glass3b74ba52014-08-09 15:33:09 -0600275 options.branch)
Simon Glassd93720e2020-10-29 21:46:19 -0600276 series = patchstream.get_metadata_for_list(upstream_commit,
Simon Glass950a2312014-09-05 19:00:23 -0600277 options.git_dir, 1, series=None, allow_overwrite=True)
Simon Glassfea58582014-08-09 15:32:59 -0600278
Simon Glassd93720e2020-10-29 21:46:19 -0600279 series = patchstream.get_metadata_for_list(range_expr,
Simon Glass950a2312014-09-05 19:00:23 -0600280 options.git_dir, None, series, allow_overwrite=True)
Simon Glass3b74ba52014-08-09 15:33:09 -0600281 else:
282 # Honour the count
Simon Glassd93720e2020-10-29 21:46:19 -0600283 series = patchstream.get_metadata_for_list(options.branch,
Simon Glass950a2312014-09-05 19:00:23 -0600284 options.git_dir, count, series=None, allow_overwrite=True)
Simon Glassfea58582014-08-09 15:32:59 -0600285 else:
286 series = None
Simon Glass8d7523c2017-01-23 05:38:56 -0700287 if not options.dry_run:
288 options.verbose = True
289 if not options.summary:
290 options.show_errors = True
Simon Glassfc3fe1c2013-04-03 11:07:16 +0000291
292 # By default we have one thread per CPU. But if there are not enough jobs
293 # we can have fewer threads and use a high '-j' value for make.
Simon Glassb82492b2021-01-30 22:17:46 -0700294 if options.threads is None:
Simon Glassfc3fe1c2013-04-03 11:07:16 +0000295 options.threads = min(multiprocessing.cpu_count(), len(selected))
296 if not options.jobs:
297 options.jobs = max(1, (multiprocessing.cpu_count() +
Simon Glassc05aa032019-10-31 07:42:53 -0600298 len(selected) - 1) // len(selected))
Simon Glassfc3fe1c2013-04-03 11:07:16 +0000299
300 if not options.step:
301 options.step = len(series.commits) - 1
302
Simon Glassd9800692022-01-29 14:14:05 -0700303 gnu_make = command.output(os.path.join(options.git,
Simon Glass785f1542016-07-25 18:59:00 -0600304 'scripts/show-gnu-make'), raise_on_error=False).rstrip()
Masahiro Yamada99796922014-07-22 11:19:09 +0900305 if not gnu_make:
Masahiro Yamada31e21412014-08-16 00:59:26 +0900306 sys.exit('GNU Make not found')
Masahiro Yamada99796922014-07-22 11:19:09 +0900307
Simon Glass05c96b12014-12-01 17:33:52 -0700308 # Create a new builder with the selected options.
309 output_dir = options.output_dir
Simon Glassfea58582014-08-09 15:32:59 -0600310 if options.branch:
Simon Glassf7582ce2014-09-05 19:00:22 -0600311 dirname = options.branch.replace('/', '_')
Simon Glass5971ab52014-12-01 17:33:55 -0700312 # As a special case allow the board directory to be placed in the
313 # output directory itself rather than any subdirectory.
314 if not options.no_subdirs:
315 output_dir = os.path.join(options.output_dir, dirname)
Lothar Waßmann409fc022018-04-08 05:14:11 -0600316 if clean_dir and os.path.exists(output_dir):
317 shutil.rmtree(output_dir)
Simon Glass2b4806e2022-01-22 05:07:33 -0700318 adjust_cfg = cfgutil.convert_list_to_dict(options.adjust_cfg)
319
Simon Glassfc3fe1c2013-04-03 11:07:16 +0000320 builder = Builder(toolchains, output_dir, options.git_dir,
Masahiro Yamada99796922014-07-22 11:19:09 +0900321 options.threads, options.jobs, gnu_make=gnu_make, checkout=True,
Simon Glass5971ab52014-12-01 17:33:55 -0700322 show_unknown=options.show_unknown, step=options.step,
Simon Glassd2ce6582014-12-01 17:34:07 -0700323 no_subdirs=options.no_subdirs, full_path=options.full_path,
Stephen Warrenf79f1e02016-04-11 10:48:44 -0600324 verbose_build=options.verbose_build,
Simon Glasseb70a2c2020-04-09 15:08:51 -0600325 mrproper=options.mrproper,
Simon Glassb50113f2016-11-13 14:25:51 -0700326 per_board_out_dir=options.per_board_out_dir,
Simon Glassb464f8e2016-11-13 14:25:53 -0700327 config_only=options.config_only,
Daniel Schwierzeck2371d1b2018-01-26 16:31:05 +0100328 squash_config_y=not options.preserve_config_y,
Simon Glassd829f122020-03-18 09:42:42 -0600329 warnings_as_errors=options.warnings_as_errors,
Simon Glass8116c782021-04-11 16:27:27 +1200330 work_in_output=options.work_in_output,
Simon Glass2b4806e2022-01-22 05:07:33 -0700331 test_thread_exceptions=test_thread_exceptions,
332 adjust_cfg=adjust_cfg)
Simon Glassfc3fe1c2013-04-03 11:07:16 +0000333 builder.force_config_on_failure = not options.quick
Simon Glassd4144e42014-09-05 19:00:13 -0600334 if make_func:
335 builder.do_make = make_func
Simon Glassfc3fe1c2013-04-03 11:07:16 +0000336
337 # For a dry run, just show our actions as a sanity check
338 if options.dry_run:
Simon Glass06890362018-06-11 23:26:46 -0600339 ShowActions(series, why_selected, selected, builder, options,
340 board_warnings)
Simon Glassfc3fe1c2013-04-03 11:07:16 +0000341 else:
342 builder.force_build = options.force_build
Simon Glass4266dc22014-07-13 12:22:31 -0600343 builder.force_build_failures = options.force_build_failures
Simon Glass97e91522014-07-14 17:51:02 -0600344 builder.force_reconfig = options.force_reconfig
Simon Glass189a4962014-07-14 17:51:03 -0600345 builder.in_tree = options.in_tree
Simon Glassfc3fe1c2013-04-03 11:07:16 +0000346
347 # Work out which boards to build
Simon Glass6014db62022-07-11 19:04:02 -0600348 board_selected = brds.get_selected_dict()
Simon Glassfc3fe1c2013-04-03 11:07:16 +0000349
Simon Glassfea58582014-08-09 15:32:59 -0600350 if series:
351 commits = series.commits
Simon Glass883a3212014-09-05 19:00:18 -0600352 # Number the commits for test purposes
353 for commit in range(len(commits)):
354 commits[commit].sequence = commit
Simon Glassfea58582014-08-09 15:32:59 -0600355 else:
356 commits = None
357
Simon Glassae1a09f2022-07-11 19:03:56 -0600358 if not options.ide:
359 tprint(GetActionSummary(options.summary, commits, board_selected,
360 options))
Simon Glassfc3fe1c2013-04-03 11:07:16 +0000361
Simon Glass7798e222014-09-14 20:23:16 -0600362 # We can't show function sizes without board details at present
363 if options.show_bloat:
364 options.show_detail = True
Simon Glass174592b2020-04-09 15:08:52 -0600365 builder.SetDisplayOptions(
366 options.show_errors, options.show_sizes, options.show_detail,
367 options.show_bloat, options.list_error_boards, options.show_config,
Simon Glass113a8a52020-04-09 15:08:53 -0600368 options.show_environment, options.filter_dtb_warnings,
Simon Glassae1a09f2022-07-11 19:03:56 -0600369 options.filter_migration_warnings, options.ide)
Simon Glassfc3fe1c2013-04-03 11:07:16 +0000370 if options.summary:
Simon Glassb2ea7ab2014-08-09 15:33:02 -0600371 builder.ShowSummary(commits, board_selected)
Simon Glassfc3fe1c2013-04-03 11:07:16 +0000372 else:
Simon Glass8116c782021-04-11 16:27:27 +1200373 fail, warned, excs = builder.BuildBoards(
374 commits, board_selected, options.keep_outputs, options.verbose)
375 if excs:
376 return 102
377 elif fail:
Simon Glassb1e5e6d2020-04-09 10:49:45 -0600378 return 100
Simon Glass7beb43c2020-03-18 09:42:44 -0600379 elif warned and not options.ignore_warnings:
Simon Glassb1e5e6d2020-04-09 10:49:45 -0600380 return 101
Simon Glass2c3deb92014-08-28 09:43:39 -0600381 return 0