buildman: Move remaining builder properties to constructor

Do these all in the constructor, so it is consistent.

Move the stray builder comment into the correct place.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2023-07-19 17:48:52 -06:00
parent 573b30377d
commit ffd06d3d8d
2 changed files with 25 additions and 18 deletions

View File

@@ -255,7 +255,10 @@ class Builder:
config_only=False, squash_config_y=False, config_only=False, squash_config_y=False,
warnings_as_errors=False, work_in_output=False, warnings_as_errors=False, work_in_output=False,
test_thread_exceptions=False, adjust_cfg=None, test_thread_exceptions=False, adjust_cfg=None,
allow_missing=False, no_lto=False, reproducible_builds=False): allow_missing=False, no_lto=False, reproducible_builds=False,
force_build=False, force_build_failures=False,
force_reconfig=False, in_tree=False,
force_config_on_failure=False, make_func=None):
"""Create a new Builder object """Create a new Builder object
Args: Args:
@@ -295,7 +298,14 @@ class Builder:
a string Kconfig a string Kconfig
allow_missing: Run build with BINMAN_ALLOW_MISSING=1 allow_missing: Run build with BINMAN_ALLOW_MISSING=1
no_lto (bool): True to set the NO_LTO flag when building no_lto (bool): True to set the NO_LTO flag when building
force_build (bool): Rebuild even commits that are already built
force_build_failures (bool): Rebuild commits that have not been
built, or failed to build
force_reconfig (bool): Reconfigure on each commit
in_tree (bool): Bulid in tree instead of out-of-tree
force_config_on_failure (bool): Reconfigure the build before
retrying a failed build
make_func (function): Function to call to run 'make'
""" """
self.toolchains = toolchains self.toolchains = toolchains
self.base_dir = base_dir self.base_dir = base_dir
@@ -304,7 +314,7 @@ class Builder:
else: else:
self._working_dir = os.path.join(base_dir, '.bm-work') self._working_dir = os.path.join(base_dir, '.bm-work')
self.threads = [] self.threads = []
self.do_make = self.Make self.do_make = make_func or self.Make
self.gnu_make = gnu_make self.gnu_make = gnu_make
self.checkout = checkout self.checkout = checkout
self.num_threads = num_threads self.num_threads = num_threads
@@ -318,11 +328,7 @@ class Builder:
self._complete_delay = None self._complete_delay = None
self._next_delay_update = datetime.now() self._next_delay_update = datetime.now()
self._start_time = datetime.now() self._start_time = datetime.now()
self.force_config_on_failure = True
self.force_build_failures = False
self.force_reconfig = False
self._step = step self._step = step
self.in_tree = False
self._error_lines = 0 self._error_lines = 0
self.no_subdirs = no_subdirs self.no_subdirs = no_subdirs
self.full_path = full_path self.full_path = full_path
@@ -336,6 +342,11 @@ class Builder:
self._ide = False self._ide = False
self.no_lto = no_lto self.no_lto = no_lto
self.reproducible_builds = reproducible_builds self.reproducible_builds = reproducible_builds
self.force_build = force_build
self.force_build_failures = force_build_failures
self.force_reconfig = force_reconfig
self.in_tree = in_tree
self.force_config_on_failure = force_config_on_failure
if not self.squash_config_y: if not self.squash_config_y:
self.config_filenames += EXTRA_CONFIG_FILENAMES self.config_filenames += EXTRA_CONFIG_FILENAMES

View File

@@ -545,8 +545,6 @@ def do_buildman(options, args, toolchains=None, make_func=None, brds=None,
options.no_allow_missing, len(selected), options.no_allow_missing, len(selected),
options.branch) options.branch)
# Create a new builder with the selected options.
adjust_cfg = cfgutil.convert_list_to_dict(options.adjust_cfg) adjust_cfg = cfgutil.convert_list_to_dict(options.adjust_cfg)
# Drop LOCALVERSION_AUTO since it changes the version string on every commit # Drop LOCALVERSION_AUTO since it changes the version string on every commit
@@ -557,6 +555,7 @@ def do_buildman(options, args, toolchains=None, make_func=None, brds=None,
else: else:
adjust_cfg['LOCALVERSION_AUTO'] = '~' adjust_cfg['LOCALVERSION_AUTO'] = '~'
# Create a new builder with the selected options
builder = Builder(toolchains, output_dir, git_dir, builder = Builder(toolchains, output_dir, git_dir,
options.threads, options.jobs, gnu_make=gnu_make, checkout=True, options.threads, options.jobs, gnu_make=gnu_make, checkout=True,
show_unknown=options.show_unknown, step=options.step, show_unknown=options.show_unknown, step=options.step,
@@ -571,16 +570,13 @@ def do_buildman(options, args, toolchains=None, make_func=None, brds=None,
test_thread_exceptions=test_thread_exceptions, test_thread_exceptions=test_thread_exceptions,
adjust_cfg=adjust_cfg, adjust_cfg=adjust_cfg,
allow_missing=allow_missing, no_lto=options.no_lto, allow_missing=allow_missing, no_lto=options.no_lto,
reproducible_builds=options.reproducible_builds) reproducible_builds=options.reproducible_builds,
TEST_BUILDER = builder force_build = options.force_build,
builder.force_config_on_failure = not options.quick force_build_failures = options.force_build_failures,
if make_func: force_reconfig = options.force_reconfig, in_tree = options.in_tree,
builder.do_make = make_func force_config_on_failure=not options.quick, make_func=make_func)
builder.force_build = options.force_build TEST_BUILDER = builder
builder.force_build_failures = options.force_build_failures
builder.force_reconfig = options.force_reconfig
builder.in_tree = options.in_tree
# Work out which boards to build # Work out which boards to build
board_selected = brds.get_selected_dict() board_selected = brds.get_selected_dict()