2018-05-06 21:58:06 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0+
|
2013-04-03 11:07:16 +00:00
|
|
|
# Copyright (c) 2013 The Chromium OS Authors.
|
|
|
|
#
|
|
|
|
|
|
|
|
import multiprocessing
|
2023-04-22 14:42:48 +00:00
|
|
|
try:
|
|
|
|
import importlib.resources
|
|
|
|
except ImportError:
|
|
|
|
# for Python 3.6
|
|
|
|
import importlib_resources
|
2013-04-03 11:07:16 +00:00
|
|
|
import os
|
2014-09-06 01:00:18 +00:00
|
|
|
import shutil
|
2020-04-18 00:09:02 +00:00
|
|
|
import subprocess
|
2013-04-03 11:07:16 +00:00
|
|
|
import sys
|
|
|
|
|
2022-07-12 01:04:03 +00:00
|
|
|
from buildman import boards
|
2020-04-18 00:09:02 +00:00
|
|
|
from buildman import bsettings
|
2022-01-22 12:07:33 +00:00
|
|
|
from buildman import cfgutil
|
2020-04-18 00:09:02 +00:00
|
|
|
from buildman import toolchain
|
|
|
|
from buildman.builder import Builder
|
2020-04-18 00:09:04 +00:00
|
|
|
from patman import gitutil
|
|
|
|
from patman import patchstream
|
2023-02-24 01:18:04 +00:00
|
|
|
from u_boot_pylib import command
|
|
|
|
from u_boot_pylib import terminal
|
|
|
|
from u_boot_pylib import tools
|
|
|
|
from u_boot_pylib.terminal import tprint
|
2013-04-03 11:07:16 +00:00
|
|
|
|
|
|
|
def GetPlural(count):
|
|
|
|
"""Returns a plural 's' if count is not 1"""
|
|
|
|
return 's' if count != 1 else ''
|
|
|
|
|
2014-08-09 21:32:59 +00:00
|
|
|
def GetActionSummary(is_summary, commits, selected, options):
|
2013-04-03 11:07:16 +00:00
|
|
|
"""Return a string summarising the intended action.
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
Summary string.
|
|
|
|
"""
|
2014-08-09 21:32:59 +00:00
|
|
|
if commits:
|
|
|
|
count = len(commits)
|
2019-10-31 13:42:53 +00:00
|
|
|
count = (count + options.step - 1) // options.step
|
2014-08-09 21:32:59 +00:00
|
|
|
commit_str = '%d commit%s' % (count, GetPlural(count))
|
|
|
|
else:
|
|
|
|
commit_str = 'current source'
|
|
|
|
str = '%s %s for %d boards' % (
|
|
|
|
'Summary of' if is_summary else 'Building', commit_str,
|
2013-04-03 11:07:16 +00:00
|
|
|
len(selected))
|
|
|
|
str += ' (%d thread%s, %d job%s per thread)' % (options.threads,
|
|
|
|
GetPlural(options.threads), options.jobs, GetPlural(options.jobs))
|
|
|
|
return str
|
|
|
|
|
2018-06-12 05:26:46 +00:00
|
|
|
def ShowActions(series, why_selected, boards_selected, builder, options,
|
|
|
|
board_warnings):
|
2013-04-03 11:07:16 +00:00
|
|
|
"""Display a list of actions that we would take, if not a dry run.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
series: Series object
|
|
|
|
why_selected: Dictionary where each key is a buildman argument
|
2017-01-23 12:38:56 +00:00
|
|
|
provided by the user, and the value is the list of boards
|
|
|
|
brought in by that argument. For example, 'arm' might bring
|
|
|
|
in 400 boards, so in this case the key would be 'arm' and
|
2013-04-03 11:07:16 +00:00
|
|
|
the value would be a list of board names.
|
|
|
|
boards_selected: Dict of selected boards, key is target name,
|
|
|
|
value is Board object
|
|
|
|
builder: The builder that will be used to build the commits
|
|
|
|
options: Command line options object
|
2018-06-12 05:26:46 +00:00
|
|
|
board_warnings: List of warnings obtained from board selected
|
2013-04-03 11:07:16 +00:00
|
|
|
"""
|
|
|
|
col = terminal.Color()
|
2019-10-31 13:42:53 +00:00
|
|
|
print('Dry run, so not doing much. But I would do this:')
|
|
|
|
print()
|
2014-08-09 21:32:59 +00:00
|
|
|
if series:
|
|
|
|
commits = series.commits
|
|
|
|
else:
|
|
|
|
commits = None
|
2019-10-31 13:42:53 +00:00
|
|
|
print(GetActionSummary(False, commits, boards_selected,
|
|
|
|
options))
|
|
|
|
print('Build directory: %s' % builder.base_dir)
|
2014-08-09 21:32:59 +00:00
|
|
|
if commits:
|
|
|
|
for upto in range(0, len(series.commits), options.step):
|
|
|
|
commit = series.commits[upto]
|
2022-01-29 21:14:17 +00:00
|
|
|
print(' ', col.build(col.YELLOW, commit.hash[:8], bright=False), end=' ')
|
2019-10-31 13:42:53 +00:00
|
|
|
print(commit.subject)
|
|
|
|
print()
|
2013-04-03 11:07:16 +00:00
|
|
|
for arg in why_selected:
|
|
|
|
if arg != 'all':
|
2019-10-31 13:42:53 +00:00
|
|
|
print(arg, ': %d boards' % len(why_selected[arg]))
|
2017-01-23 12:38:56 +00:00
|
|
|
if options.verbose:
|
2019-10-31 13:42:53 +00:00
|
|
|
print(' %s' % ' '.join(why_selected[arg]))
|
|
|
|
print(('Total boards to build for each commit: %d\n' %
|
|
|
|
len(why_selected['all'])))
|
2018-06-12 05:26:46 +00:00
|
|
|
if board_warnings:
|
|
|
|
for warning in board_warnings:
|
2022-01-29 21:14:17 +00:00
|
|
|
print(col.build(col.YELLOW, warning))
|
2013-04-03 11:07:16 +00:00
|
|
|
|
2022-07-12 01:04:00 +00:00
|
|
|
def ShowToolchainPrefix(brds, toolchains):
|
2019-12-05 22:59:14 +00:00
|
|
|
"""Show information about a the tool chain used by one or more boards
|
|
|
|
|
2020-03-18 15:42:47 +00:00
|
|
|
The function checks that all boards use the same toolchain, then prints
|
|
|
|
the correct value for CROSS_COMPILE.
|
2019-12-05 22:59:14 +00:00
|
|
|
|
|
|
|
Args:
|
|
|
|
boards: Boards object containing selected boards
|
|
|
|
toolchains: Toolchains object containing available toolchains
|
|
|
|
|
|
|
|
Return:
|
|
|
|
None on success, string error message otherwise
|
|
|
|
"""
|
2022-07-12 01:04:02 +00:00
|
|
|
board_selected = brds.get_selected_dict()
|
2019-12-05 22:59:14 +00:00
|
|
|
tc_set = set()
|
2022-07-12 01:04:00 +00:00
|
|
|
for brd in board_selected.values():
|
2019-12-05 22:59:14 +00:00
|
|
|
tc_set.add(toolchains.Select(brd.arch))
|
|
|
|
if len(tc_set) != 1:
|
|
|
|
return 'Supplied boards must share one toolchain'
|
|
|
|
return False
|
|
|
|
tc = tc_set.pop()
|
2020-03-18 15:42:47 +00:00
|
|
|
print(tc.GetEnvArgs(toolchain.VAR_CROSS_COMPILE))
|
2019-12-05 22:59:14 +00:00
|
|
|
return None
|
|
|
|
|
2022-11-10 02:14:53 +00:00
|
|
|
def get_allow_missing(opt_allow, opt_no_allow, num_selected, has_branch):
|
|
|
|
allow_missing = False
|
|
|
|
am_setting = bsettings.GetGlobalItemValue('allow-missing')
|
|
|
|
if am_setting:
|
|
|
|
if am_setting == 'always':
|
|
|
|
allow_missing = True
|
|
|
|
if 'multiple' in am_setting and num_selected > 1:
|
|
|
|
allow_missing = True
|
|
|
|
if 'branch' in am_setting and has_branch:
|
|
|
|
allow_missing = True
|
|
|
|
|
|
|
|
if opt_allow:
|
|
|
|
allow_missing = True
|
|
|
|
if opt_no_allow:
|
|
|
|
allow_missing = False
|
|
|
|
return allow_missing
|
|
|
|
|
2022-07-12 01:04:00 +00:00
|
|
|
def DoBuildman(options, args, toolchains=None, make_func=None, brds=None,
|
2021-04-11 04:27:27 +00:00
|
|
|
clean_dir=False, test_thread_exceptions=False):
|
2013-04-03 11:07:16 +00:00
|
|
|
"""The main control code for buildman
|
|
|
|
|
|
|
|
Args:
|
|
|
|
options: Command line options object
|
|
|
|
args: Command line arguments (list of strings)
|
2014-09-06 01:00:13 +00:00
|
|
|
toolchains: Toolchains to use - this should be a Toolchains()
|
|
|
|
object. If None, then it will be created and scanned
|
|
|
|
make_func: Make function to use for the builder. This is called
|
|
|
|
to execute 'make'. If this is None, the normal function
|
|
|
|
will be used, which calls the 'make' tool with suitable
|
|
|
|
arguments. This setting is useful for tests.
|
2022-07-12 01:04:00 +00:00
|
|
|
brds: Boards() object to use, containing a list of available
|
2014-09-06 01:00:16 +00:00
|
|
|
boards. If this is None it will be created and scanned.
|
2021-04-11 04:27:25 +00:00
|
|
|
clean_dir: Used for tests only, indicates that the existing output_dir
|
|
|
|
should be removed before starting the build
|
2021-04-11 04:27:27 +00:00
|
|
|
test_thread_exceptions: Uses for tests only, True to make the threads
|
|
|
|
raise an exception instead of reporting their result. This simulates
|
|
|
|
a failure in the code somewhere
|
2013-04-03 11:07:16 +00:00
|
|
|
"""
|
2014-09-06 01:00:18 +00:00
|
|
|
global builder
|
|
|
|
|
2014-09-06 01:00:11 +00:00
|
|
|
if options.full_help:
|
2023-02-24 01:18:12 +00:00
|
|
|
with importlib.resources.path('buildman', 'README.rst') as readme:
|
|
|
|
tools.print_full_help(str(readme))
|
2014-09-06 01:00:11 +00:00
|
|
|
return 0
|
|
|
|
|
2022-01-29 21:14:11 +00:00
|
|
|
gitutil.setup()
|
2016-07-28 02:33:02 +00:00
|
|
|
col = terminal.Color()
|
2013-04-03 11:07:16 +00:00
|
|
|
|
|
|
|
options.git_dir = os.path.join(options.git, '.git')
|
|
|
|
|
2016-07-28 02:33:04 +00:00
|
|
|
no_toolchains = toolchains is None
|
|
|
|
if no_toolchains:
|
2019-01-07 23:44:20 +00:00
|
|
|
toolchains = toolchain.Toolchains(options.override_toolchain)
|
2013-04-03 11:07:16 +00:00
|
|
|
|
2014-12-02 00:34:06 +00:00
|
|
|
if options.fetch_arch:
|
|
|
|
if options.fetch_arch == 'list':
|
|
|
|
sorted_list = toolchains.ListArchs()
|
2022-01-29 21:14:17 +00:00
|
|
|
print(col.build(col.BLUE, 'Available architectures: %s\n' %
|
2019-10-31 13:42:53 +00:00
|
|
|
' '.join(sorted_list)))
|
2014-12-02 00:34:06 +00:00
|
|
|
return 0
|
|
|
|
else:
|
|
|
|
fetch_arch = options.fetch_arch
|
|
|
|
if fetch_arch == 'all':
|
|
|
|
fetch_arch = ','.join(toolchains.ListArchs())
|
2022-01-29 21:14:17 +00:00
|
|
|
print(col.build(col.CYAN, '\nDownloading toolchains: %s' %
|
2019-10-31 13:42:53 +00:00
|
|
|
fetch_arch))
|
2014-12-02 00:34:06 +00:00
|
|
|
for arch in fetch_arch.split(','):
|
2019-10-31 13:42:53 +00:00
|
|
|
print()
|
2014-12-02 00:34:06 +00:00
|
|
|
ret = toolchains.FetchAndInstall(arch)
|
|
|
|
if ret:
|
|
|
|
return ret
|
|
|
|
return 0
|
|
|
|
|
2016-07-28 02:33:04 +00:00
|
|
|
if no_toolchains:
|
|
|
|
toolchains.GetSettings()
|
2018-11-06 23:02:10 +00:00
|
|
|
toolchains.Scan(options.list_tool_chains and options.verbose)
|
2016-07-28 02:33:04 +00:00
|
|
|
if options.list_tool_chains:
|
|
|
|
toolchains.List()
|
2019-10-31 13:42:53 +00:00
|
|
|
print()
|
2016-07-28 02:33:04 +00:00
|
|
|
return 0
|
|
|
|
|
2020-04-17 23:51:32 +00:00
|
|
|
if not options.output_dir:
|
|
|
|
if options.work_in_output:
|
2022-01-29 21:14:17 +00:00
|
|
|
sys.exit(col.build(col.RED, '-w requires that you specify -o'))
|
2020-04-17 23:51:32 +00:00
|
|
|
options.output_dir = '..'
|
2020-04-09 21:08:51 +00:00
|
|
|
|
2023-07-19 23:48:27 +00:00
|
|
|
nr_cups = options.threads or multiprocessing.cpu_count()
|
|
|
|
|
2013-04-03 11:07:16 +00:00
|
|
|
# Work out what subset of the boards we are building
|
2022-07-12 01:04:00 +00:00
|
|
|
if not brds:
|
2019-11-19 20:14:33 +00:00
|
|
|
if not os.path.exists(options.output_dir):
|
|
|
|
os.makedirs(options.output_dir)
|
2019-10-28 14:24:59 +00:00
|
|
|
board_file = os.path.join(options.output_dir, 'boards.cfg')
|
2023-07-19 23:48:28 +00:00
|
|
|
if options.regen_board_list and options.regen_board_list != '-':
|
|
|
|
board_file = options.regen_board_list
|
2014-09-06 01:00:16 +00:00
|
|
|
|
2022-07-12 01:04:03 +00:00
|
|
|
brds = boards.Boards()
|
2023-07-19 23:48:27 +00:00
|
|
|
if options.maintainer_check:
|
|
|
|
warnings = brds.build_board_list(jobs=nr_cups)[1]
|
|
|
|
if warnings:
|
|
|
|
for warn in warnings:
|
|
|
|
print(warn, file=sys.stderr)
|
|
|
|
return 2
|
|
|
|
return 0
|
|
|
|
|
|
|
|
ok = brds.ensure_board_list(board_file, nr_cups,
|
2022-07-12 01:04:08 +00:00
|
|
|
force=options.regen_board_list,
|
|
|
|
quiet=not options.verbose)
|
2022-07-12 01:04:04 +00:00
|
|
|
if options.regen_board_list:
|
2022-07-12 01:04:08 +00:00
|
|
|
return 0 if ok else 2
|
2022-07-12 01:04:02 +00:00
|
|
|
brds.read_boards(board_file)
|
2014-08-28 15:43:41 +00:00
|
|
|
|
|
|
|
exclude = []
|
|
|
|
if options.exclude:
|
|
|
|
for arg in options.exclude:
|
|
|
|
exclude += arg.split(',')
|
|
|
|
|
2018-06-12 05:26:46 +00:00
|
|
|
if options.boards:
|
|
|
|
requested_boards = []
|
|
|
|
for b in options.boards:
|
|
|
|
requested_boards += b.split(',')
|
|
|
|
else:
|
|
|
|
requested_boards = None
|
2022-07-12 01:04:02 +00:00
|
|
|
why_selected, board_warnings = brds.select_boards(args, exclude,
|
|
|
|
requested_boards)
|
|
|
|
selected = brds.get_selected()
|
2013-04-03 11:07:16 +00:00
|
|
|
if not len(selected):
|
2022-01-29 21:14:17 +00:00
|
|
|
sys.exit(col.build(col.RED, 'No matching boards found'))
|
2013-04-03 11:07:16 +00:00
|
|
|
|
2020-03-18 15:42:47 +00:00
|
|
|
if options.print_prefix:
|
2022-07-12 01:04:00 +00:00
|
|
|
err = ShowToolchainPrefix(brds, toolchains)
|
2019-12-05 22:59:14 +00:00
|
|
|
if err:
|
2022-01-29 21:14:17 +00:00
|
|
|
sys.exit(col.build(col.RED, err))
|
2019-12-05 22:59:14 +00:00
|
|
|
return 0
|
|
|
|
|
2019-12-05 22:59:13 +00:00
|
|
|
# Work out how many commits to build. We want to build everything on the
|
|
|
|
# branch. We also build the upstream commit as a control so we can see
|
|
|
|
# problems introduced by the first commit on the branch.
|
|
|
|
count = options.count
|
|
|
|
has_range = options.branch and '..' in options.branch
|
|
|
|
if count == -1:
|
|
|
|
if not options.branch:
|
|
|
|
count = 1
|
|
|
|
else:
|
|
|
|
if has_range:
|
2022-01-29 21:14:11 +00:00
|
|
|
count, msg = gitutil.count_commits_in_range(options.git_dir,
|
2019-12-05 22:59:13 +00:00
|
|
|
options.branch)
|
|
|
|
else:
|
2022-01-29 21:14:11 +00:00
|
|
|
count, msg = gitutil.count_commits_in_branch(options.git_dir,
|
2019-12-05 22:59:13 +00:00
|
|
|
options.branch)
|
|
|
|
if count is None:
|
2022-01-29 21:14:17 +00:00
|
|
|
sys.exit(col.build(col.RED, msg))
|
2019-12-05 22:59:13 +00:00
|
|
|
elif count == 0:
|
2022-01-29 21:14:17 +00:00
|
|
|
sys.exit(col.build(col.RED, "Range '%s' has no commits" %
|
2019-12-05 22:59:13 +00:00
|
|
|
options.branch))
|
|
|
|
if msg:
|
2022-01-29 21:14:17 +00:00
|
|
|
print(col.build(col.YELLOW, msg))
|
2019-12-05 22:59:13 +00:00
|
|
|
count += 1 # Build upstream commit also
|
|
|
|
|
|
|
|
if not count:
|
2023-02-24 01:18:11 +00:00
|
|
|
msg = ("No commits found to process in branch '%s': "
|
2019-12-05 22:59:13 +00:00
|
|
|
"set branch's upstream or use -c flag" % options.branch)
|
2023-02-24 01:18:11 +00:00
|
|
|
sys.exit(col.build(col.RED, msg))
|
2020-03-18 15:42:42 +00:00
|
|
|
if options.work_in_output:
|
|
|
|
if len(selected) != 1:
|
2022-01-29 21:14:17 +00:00
|
|
|
sys.exit(col.build(col.RED,
|
2020-03-18 15:42:42 +00:00
|
|
|
'-w can only be used with a single board'))
|
|
|
|
if count != 1:
|
2022-01-29 21:14:17 +00:00
|
|
|
sys.exit(col.build(col.RED,
|
2020-03-18 15:42:42 +00:00
|
|
|
'-w can only be used with a single commit'))
|
2019-12-05 22:59:13 +00:00
|
|
|
|
2013-04-03 11:07:16 +00:00
|
|
|
# Read the metadata from the commits. First look at the upstream commit,
|
|
|
|
# then the ones in the branch. We would like to do something like
|
|
|
|
# upstream/master~..branch but that isn't possible if upstream/master is
|
|
|
|
# a merge commit (it will list all the commits that form part of the
|
|
|
|
# merge)
|
2014-09-06 01:00:23 +00:00
|
|
|
# Conflicting tags are not a problem for buildman, since it does not use
|
|
|
|
# them. For example, Series-version is not useful for buildman. On the
|
|
|
|
# other hand conflicting tags will cause an error. So allow later tags
|
|
|
|
# to overwrite earlier ones by setting allow_overwrite=True
|
2014-08-09 21:32:59 +00:00
|
|
|
if options.branch:
|
2014-08-09 21:33:09 +00:00
|
|
|
if count == -1:
|
2014-12-02 00:33:57 +00:00
|
|
|
if has_range:
|
|
|
|
range_expr = options.branch
|
|
|
|
else:
|
2022-01-29 21:14:11 +00:00
|
|
|
range_expr = gitutil.get_range_in_branch(options.git_dir,
|
2014-12-02 00:33:57 +00:00
|
|
|
options.branch)
|
2022-01-29 21:14:11 +00:00
|
|
|
upstream_commit = gitutil.get_upstream(options.git_dir,
|
2014-08-09 21:33:09 +00:00
|
|
|
options.branch)
|
2020-10-30 03:46:19 +00:00
|
|
|
series = patchstream.get_metadata_for_list(upstream_commit,
|
2014-09-06 01:00:23 +00:00
|
|
|
options.git_dir, 1, series=None, allow_overwrite=True)
|
2014-08-09 21:33:09 +00:00
|
|
|
|
2020-10-30 03:46:19 +00:00
|
|
|
series = patchstream.get_metadata_for_list(range_expr,
|
2014-09-06 01:00:23 +00:00
|
|
|
options.git_dir, None, series, allow_overwrite=True)
|
2014-08-09 21:33:09 +00:00
|
|
|
else:
|
|
|
|
# Honour the count
|
2020-10-30 03:46:19 +00:00
|
|
|
series = patchstream.get_metadata_for_list(options.branch,
|
2014-09-06 01:00:23 +00:00
|
|
|
options.git_dir, count, series=None, allow_overwrite=True)
|
2014-08-09 21:32:59 +00:00
|
|
|
else:
|
|
|
|
series = None
|
2017-01-23 12:38:56 +00:00
|
|
|
if not options.dry_run:
|
|
|
|
options.verbose = True
|
|
|
|
if not options.summary:
|
|
|
|
options.show_errors = True
|
2013-04-03 11:07:16 +00:00
|
|
|
|
|
|
|
# By default we have one thread per CPU. But if there are not enough jobs
|
|
|
|
# we can have fewer threads and use a high '-j' value for make.
|
2021-01-31 05:17:46 +00:00
|
|
|
if options.threads is None:
|
2013-04-03 11:07:16 +00:00
|
|
|
options.threads = min(multiprocessing.cpu_count(), len(selected))
|
|
|
|
if not options.jobs:
|
|
|
|
options.jobs = max(1, (multiprocessing.cpu_count() +
|
2019-10-31 13:42:53 +00:00
|
|
|
len(selected) - 1) // len(selected))
|
2013-04-03 11:07:16 +00:00
|
|
|
|
|
|
|
if not options.step:
|
|
|
|
options.step = len(series.commits) - 1
|
|
|
|
|
2022-01-29 21:14:05 +00:00
|
|
|
gnu_make = command.output(os.path.join(options.git,
|
2016-07-26 00:59:00 +00:00
|
|
|
'scripts/show-gnu-make'), raise_on_error=False).rstrip()
|
2014-07-22 02:19:09 +00:00
|
|
|
if not gnu_make:
|
2014-08-15 15:59:26 +00:00
|
|
|
sys.exit('GNU Make not found')
|
2014-07-22 02:19:09 +00:00
|
|
|
|
2022-11-10 02:14:53 +00:00
|
|
|
allow_missing = get_allow_missing(options.allow_missing,
|
|
|
|
options.no_allow_missing, len(selected),
|
|
|
|
options.branch)
|
|
|
|
|
2014-12-02 00:33:52 +00:00
|
|
|
# Create a new builder with the selected options.
|
|
|
|
output_dir = options.output_dir
|
2014-08-09 21:32:59 +00:00
|
|
|
if options.branch:
|
2014-09-06 01:00:22 +00:00
|
|
|
dirname = options.branch.replace('/', '_')
|
2014-12-02 00:33:55 +00:00
|
|
|
# As a special case allow the board directory to be placed in the
|
|
|
|
# output directory itself rather than any subdirectory.
|
|
|
|
if not options.no_subdirs:
|
|
|
|
output_dir = os.path.join(options.output_dir, dirname)
|
2018-04-08 11:14:11 +00:00
|
|
|
if clean_dir and os.path.exists(output_dir):
|
|
|
|
shutil.rmtree(output_dir)
|
2022-01-22 12:07:33 +00:00
|
|
|
adjust_cfg = cfgutil.convert_list_to_dict(options.adjust_cfg)
|
|
|
|
|
2023-02-21 19:40:29 +00:00
|
|
|
# Drop LOCALVERSION_AUTO since it changes the version string on every commit
|
|
|
|
if options.reproducible_builds:
|
|
|
|
# If these are mentioned, leave the local version alone
|
|
|
|
if 'LOCALVERSION' in adjust_cfg or 'LOCALVERSION_AUTO' in adjust_cfg:
|
|
|
|
print('Not dropping LOCALVERSION_AUTO for reproducible build')
|
|
|
|
else:
|
|
|
|
adjust_cfg['LOCALVERSION_AUTO'] = '~'
|
|
|
|
|
2013-04-03 11:07:16 +00:00
|
|
|
builder = Builder(toolchains, output_dir, options.git_dir,
|
2014-07-22 02:19:09 +00:00
|
|
|
options.threads, options.jobs, gnu_make=gnu_make, checkout=True,
|
2014-12-02 00:33:55 +00:00
|
|
|
show_unknown=options.show_unknown, step=options.step,
|
2014-12-02 00:34:07 +00:00
|
|
|
no_subdirs=options.no_subdirs, full_path=options.full_path,
|
2016-04-11 16:48:44 +00:00
|
|
|
verbose_build=options.verbose_build,
|
2020-04-09 21:08:51 +00:00
|
|
|
mrproper=options.mrproper,
|
2016-11-13 21:25:51 +00:00
|
|
|
per_board_out_dir=options.per_board_out_dir,
|
2016-11-13 21:25:53 +00:00
|
|
|
config_only=options.config_only,
|
2018-01-26 15:31:05 +00:00
|
|
|
squash_config_y=not options.preserve_config_y,
|
2020-03-18 15:42:42 +00:00
|
|
|
warnings_as_errors=options.warnings_as_errors,
|
2021-04-11 04:27:27 +00:00
|
|
|
work_in_output=options.work_in_output,
|
2022-01-22 12:07:33 +00:00
|
|
|
test_thread_exceptions=test_thread_exceptions,
|
2022-11-10 02:14:53 +00:00
|
|
|
adjust_cfg=adjust_cfg,
|
2023-02-21 19:40:29 +00:00
|
|
|
allow_missing=allow_missing, no_lto=options.no_lto,
|
|
|
|
reproducible_builds=options.reproducible_builds)
|
2013-04-03 11:07:16 +00:00
|
|
|
builder.force_config_on_failure = not options.quick
|
2014-09-06 01:00:13 +00:00
|
|
|
if make_func:
|
|
|
|
builder.do_make = make_func
|
2013-04-03 11:07:16 +00:00
|
|
|
|
|
|
|
# For a dry run, just show our actions as a sanity check
|
|
|
|
if options.dry_run:
|
2018-06-12 05:26:46 +00:00
|
|
|
ShowActions(series, why_selected, selected, builder, options,
|
|
|
|
board_warnings)
|
2013-04-03 11:07:16 +00:00
|
|
|
else:
|
|
|
|
builder.force_build = options.force_build
|
2014-07-13 18:22:31 +00:00
|
|
|
builder.force_build_failures = options.force_build_failures
|
2014-07-14 23:51:02 +00:00
|
|
|
builder.force_reconfig = options.force_reconfig
|
2014-07-14 23:51:03 +00:00
|
|
|
builder.in_tree = options.in_tree
|
2013-04-03 11:07:16 +00:00
|
|
|
|
|
|
|
# Work out which boards to build
|
2022-07-12 01:04:02 +00:00
|
|
|
board_selected = brds.get_selected_dict()
|
2013-04-03 11:07:16 +00:00
|
|
|
|
2014-08-09 21:32:59 +00:00
|
|
|
if series:
|
|
|
|
commits = series.commits
|
2014-09-06 01:00:18 +00:00
|
|
|
# Number the commits for test purposes
|
|
|
|
for commit in range(len(commits)):
|
|
|
|
commits[commit].sequence = commit
|
2014-08-09 21:32:59 +00:00
|
|
|
else:
|
|
|
|
commits = None
|
|
|
|
|
2022-07-12 01:03:56 +00:00
|
|
|
if not options.ide:
|
|
|
|
tprint(GetActionSummary(options.summary, commits, board_selected,
|
|
|
|
options))
|
2013-04-03 11:07:16 +00:00
|
|
|
|
2014-09-15 02:23:16 +00:00
|
|
|
# We can't show function sizes without board details at present
|
|
|
|
if options.show_bloat:
|
|
|
|
options.show_detail = True
|
2020-04-09 21:08:52 +00:00
|
|
|
builder.SetDisplayOptions(
|
|
|
|
options.show_errors, options.show_sizes, options.show_detail,
|
|
|
|
options.show_bloat, options.list_error_boards, options.show_config,
|
2020-04-09 21:08:53 +00:00
|
|
|
options.show_environment, options.filter_dtb_warnings,
|
2022-07-12 01:03:56 +00:00
|
|
|
options.filter_migration_warnings, options.ide)
|
2013-04-03 11:07:16 +00:00
|
|
|
if options.summary:
|
2014-08-09 21:33:02 +00:00
|
|
|
builder.ShowSummary(commits, board_selected)
|
2013-04-03 11:07:16 +00:00
|
|
|
else:
|
2021-04-11 04:27:27 +00:00
|
|
|
fail, warned, excs = builder.BuildBoards(
|
|
|
|
commits, board_selected, options.keep_outputs, options.verbose)
|
|
|
|
if excs:
|
|
|
|
return 102
|
|
|
|
elif fail:
|
2020-04-09 16:49:45 +00:00
|
|
|
return 100
|
2020-03-18 15:42:44 +00:00
|
|
|
elif warned and not options.ignore_warnings:
|
2020-04-09 16:49:45 +00:00
|
|
|
return 101
|
2014-08-28 15:43:39 +00:00
|
|
|
return 0
|