[PATCH v2 1/3] buildman: allow specifying configuration fragments
Simon Glass
sjg at chromium.org
Thu Apr 17 23:37:24 CEST 2025
Hi Heinrich,
On Wed, 16 Apr 2025 at 16:40, Heinrich Schuchardt
<heinrich.schuchardt at canonical.com> wrote:
>
> Currently we are no able to build with configuration fragments in our CI.
> With this patch buildman gets a new argument --fragments for passing a
> comma separated list of configuration fragments to add to the board
> defconfigs, e.g.
>
> tools/buildman/buildman \
> -o build \
> -k qemu-riscv64_smode \
> --fragments acpi.config
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
> ---
> v2:
> no change
> ---
> tools/buildman/builder.py | 3 ++-
> tools/buildman/builderthread.py | 18 +++++++++++-------
> tools/buildman/cmdline.py | 2 ++
> tools/buildman/control.py | 2 +-
> 4 files changed, 16 insertions(+), 9 deletions(-)
>
> diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
> index 4bea0a02b78..2aa882d77ec 100644
> --- a/tools/buildman/builder.py
> +++ b/tools/buildman/builder.py
> @@ -1784,7 +1784,7 @@ class Builder:
> shutil.rmtree(dirname)
> terminal.print_clear()
>
> - def build_boards(self, commits, board_selected, keep_outputs, verbose):
> + def build_boards(self, commits, board_selected, keep_outputs, verbose, fragments=''):
I think it might be better to change the code to always pass fragments.
Also please document params in the Args: below.
> """Build all commits for a list of boards
>
> Args:
> @@ -1822,6 +1822,7 @@ class Builder:
> job.keep_outputs = keep_outputs
> job.work_in_output = self.work_in_output
> job.adjust_cfg = self.adjust_cfg
> + job.fragments = fragments
> job.step = self._step
> if self.num_threads:
> self.queue.put(job)
> diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
> index b8578d5b97b..de9346327d6 100644
> --- a/tools/buildman/builderthread.py
> +++ b/tools/buildman/builderthread.py
> @@ -383,7 +383,7 @@ class BuilderThread(threading.Thread):
>
> def _config_and_build(self, commit_upto, brd, work_dir, do_config, mrproper,
> config_only, adjust_cfg, commit, out_dir, out_rel_dir,
> - result):
> + fragments, result):
> """Do the build, configuring first if necessary
>
> Args:
> @@ -397,6 +397,7 @@ class BuilderThread(threading.Thread):
> commit (Commit): Commit only being built
> out_dir (str): Output directory for the build
> out_rel_dir (str): Output directory relatie to the current dir
> + fragments (str): config fragments add to defconfig
> result (CommandResult): Previous result
>
> Returns:
> @@ -412,6 +413,8 @@ class BuilderThread(threading.Thread):
> args, cwd, src_dir = self._build_args(brd, out_dir, out_rel_dir,
> work_dir, commit_upto)
> config_args = [f'{brd.target}_defconfig']
> + if fragments != None:
> + config_args.extend(fragments.split(','))
> config_out = io.StringIO()
>
> _remove_old_outputs(out_dir)
> @@ -450,7 +453,7 @@ class BuilderThread(threading.Thread):
>
> def run_commit(self, commit_upto, brd, work_dir, do_config, mrproper,
> config_only, force_build, force_build_failures,
> - work_in_output, adjust_cfg):
> + work_in_output, adjust_cfg, fragments):
again, please check that you add comments for args on every function.
> """Build a particular commit.
>
> If the build is already done, and we are not forcing a build, we skip
> @@ -475,6 +478,7 @@ class BuilderThread(threading.Thread):
> ~C to disable C
> C=val to set the value of C (val must have quotes if C is
> a string Kconfig
> + fragments (str): config fragments add to defconfig
>
> Returns:
> tuple containing:
> @@ -504,7 +508,7 @@ class BuilderThread(threading.Thread):
> result, do_config = self._config_and_build(
> commit_upto, brd, work_dir, do_config, mrproper,
> config_only, adjust_cfg, commit, out_dir, out_rel_dir,
> - result)
> + fragments, result)
> result.already_done = False
>
> result.toolchain = self.toolchain
> @@ -702,7 +706,7 @@ class BuilderThread(threading.Thread):
> self.builder.config_only,
> force_build or self.builder.force_build,
> self.builder.force_build_failures,
> - job.work_in_output, job.adjust_cfg)
> + job.work_in_output, job.adjust_cfg, job.fragments)
> failed = result.return_code or result.stderr
> did_config = do_config
> if failed and not do_config and not self.mrproper:
> @@ -713,7 +717,7 @@ class BuilderThread(threading.Thread):
> brd, work_dir, True,
> self.mrproper or self.builder.fallback_mrproper,
> False, True, False, job.work_in_output,
> - job.adjust_cfg)
> + job.adjust_cfg, job.fragments)
> did_config = True
> if not self.builder.force_reconfig:
> do_config = request_config
> @@ -759,14 +763,14 @@ class BuilderThread(threading.Thread):
> result, request_config = self.run_commit(None, brd, work_dir, True,
> self.mrproper, self.builder.config_only, True,
> self.builder.force_build_failures, job.work_in_output,
> - job.adjust_cfg)
> + job.adjust_cfg, job.fragments)
> failed = result.return_code or result.stderr
> if failed and not self.mrproper:
> result, request_config = self.run_commit(None, brd, work_dir,
> True, self.builder.fallback_mrproper,
> self.builder.config_only, True,
> self.builder.force_build_failures,
> - job.work_in_output, job.adjust_cfg)
> + job.work_in_output, job.adjust_cfg, job.fragments)
>
> result.commit_upto = 0
> self._write_result(result, job.keep_outputs, job.work_in_output)
> diff --git a/tools/buildman/cmdline.py b/tools/buildman/cmdline.py
> index 7573e5bdfe8..38ea7f9f335 100644
> --- a/tools/buildman/cmdline.py
> +++ b/tools/buildman/cmdline.py
> @@ -62,6 +62,8 @@ def add_upto_m(parser):
> help="Fetch a toolchain for architecture FETCH_ARCH ('list' to list)."
> ' You can also fetch several toolchains separate by comma, or'
> " 'all' to download all")
> + parser.add_argument('--fragments', type=str,
> + help="Comma separated list of configuration fragments to be applied")
> parser.add_argument(
> '--full-check', action='store_true',
> help='Check maintainer entries and TARGET configs')
> diff --git a/tools/buildman/control.py b/tools/buildman/control.py
> index 5109b1cd5ce..1a95aa47fc5 100644
> --- a/tools/buildman/control.py
> +++ b/tools/buildman/control.py
> @@ -561,7 +561,7 @@ def run_builder(builder, commits, board_selected, args):
> builder.show_summary(commits, board_selected)
> else:
> fail, warned, excs = builder.build_boards(
> - commits, board_selected, args.keep_outputs, args.verbose)
> + commits, board_selected, args.keep_outputs, args.verbose, args.fragments)
long line?
> if excs:
> return 102
> if fail:
> --
> 2.48.1
>
REgards,
Simon
More information about the U-Boot
mailing list