From 46aa7ba72f9ac2ced43cd56bb9e753251f9aab62 Mon Sep 17 00:00:00 2001 From: Alexander Bachmann Date: Thu, 24 Oct 2024 18:50:20 +0200 Subject: [PATCH] hack: add separate function to create common container engine args Add a separate function to create common container engine arguments to reduce complexity in container_build function. Signed-off-by: Alexander Bachmann --- hack/build-image | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/hack/build-image b/hack/build-image index b5f11bd..6a47bbf 100755 --- a/hack/build-image +++ b/hack/build-image @@ -232,21 +232,26 @@ def container_build(cli, target): # are the same, skip passing the extra argument. args.append(f"--arch={target.arch}") + run(cli, args + create_common_container_engine_args(cli, target), check=True) + +def create_common_container_engine_args(cli, target): + args = [] pkgs_from = PACKAGES_FROM[target.pkg_source] if pkgs_from: args.append(f"--build-arg=INSTALL_PACKAGES_FROM={pkgs_from}") - + if cli.extra_build_arg: args.extend(cli.extra_build_arg) + for tname in target.all_names(baseless=cli.without_repo_bases): args.append("-t") args.append(tname) + args.append("-f") args.append(target_containerfile(target)) args.append(kind_source_dir(target.name)) args = [str(a) for a in args] - run(cli, args, check=True) - + return args def container_push(cli, push_name): """Construct and execute a command to push a container image."""