Previously we had the default baked into Makefile.include but as the meson container logic will also benefit from it we update the configure machinery.
For now we allow direct make invocations to override but for the normal case it is in one place now. Signed-off-by: Alex Bennée <[email protected]> --- v2 - fixed conflicts from the revert. v3 - regen meson-buildoptions.sh --- configure | 8 ++++++++ meson_options.txt | 4 ++++ scripts/meson-buildoptions.sh | 3 +++ tests/docker/Makefile.include | 4 +--- tests/tcg/meson.build | 6 ++++++ 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/configure b/configure index d1b4e6d3ff6..b9d64993835 100755 --- a/configure +++ b/configure @@ -173,6 +173,7 @@ fi # default parameters container_command="" +container_registry="registry.gitlab.com/qemu-project/qemu" cpu="" cross_compile="no" cross_prefix="" @@ -733,6 +734,9 @@ for opt do ;; --container-command=*) container_command="$optarg" ;; + --container-registry=*) container_registry="$optarg" + meson_option_add -Dcontainer_registry="$optarg" + ;; --rust-target-triple=*) rust_target_triple="$optarg" ;; --gdb=*) meson_option_add -Dgdb="$optarg" @@ -867,6 +871,7 @@ Advanced options (experts only): --cpu=CPU Build for host CPU [$cpu] --disable-containers don't use containers for cross-building --container-command=CMD which container command to use [autodetect] + --container-registry=URL which container registry to cache from [$container_registry] --gdb=GDB-path gdb to use for gdbstub tests [autodetect] --wasm64-32bit-address-limit Restrict wasm64 address space to 32-bit (default is to use the whole 64-bit range). @@ -1729,6 +1734,9 @@ echo "GENISOIMAGE=$genisoimage" >> $config_host_mak echo "MESON=$meson" >> $config_host_mak echo "NINJA=$ninja" >> $config_host_mak echo "EXESUF=$EXESUF" >> $config_host_mak +if test -n "$container_registry"; then + echo "DOCKER_DEFAULT_REGISTRY=$container_registry" >> $config_host_mak +fi if test "$default_targets" = "yes"; then echo "CONFIG_DEFAULT_TARGETS=y" >> $config_host_mak fi diff --git a/meson_options.txt b/meson_options.txt index 218d003a80b..5a080b2360c 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -389,3 +389,7 @@ option('rust', type: 'feature', value: 'disabled', description: 'Rust support') option('strict_rust_lints', type: 'boolean', value: false, description: 'Enable stricter set of Rust warnings') + +option('container_registry', type: 'string', + value: 'registry.gitlab.com/qemu-project/qemu', + description: 'container registry to cache from') diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index ba3c9de216b..0cb1d48c982 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -10,6 +10,9 @@ meson_options_help() { printf "%s\n" ' --block-drv-rw-whitelist=VALUE' printf "%s\n" ' set block driver read-write whitelist (by default' printf "%s\n" ' affects only QEMU, not tools like qemu-img)' + printf "%s\n" ' --container-registry=VALUE' + printf "%s\n" ' container registry to cache from' + printf "%s\n" ' [registry.gitlab.com/qemu-project/qemu]' printf "%s\n" ' --datadir=VALUE Data file directory [share]' printf "%s\n" ' --disable-coroutine-pool coroutine freelist (better performance)' printf "%s\n" ' --disable-debug-info Enable debug symbols and other information' diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include index 0adddb6a5c6..74bf471f171 100644 --- a/tests/docker/Makefile.include +++ b/tests/docker/Makefile.include @@ -11,9 +11,7 @@ USER = $(if $(NOUSER),,$(shell id -un)) UID = $(if $(NOUSER),,$(shell id -u)) DOCKER_FILES_DIR := $(SRC_PATH)/tests/docker/dockerfiles -ifeq ($(HOST_ARCH),x86_64) -DOCKER_DEFAULT_REGISTRY := registry.gitlab.com/qemu-project/qemu -endif +DOCKER_DEFAULT_REGISTRY ?= registry.gitlab.com/qemu-project/qemu DOCKER_REGISTRY := $(if $(REGISTRY),$(REGISTRY),$(DOCKER_DEFAULT_REGISTRY)) CONTAINER_COMMAND ?= $(shell $(SRC_PATH)/tests/docker/docker.py probe) diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build index 28a8e7a0558..fce70f8e56f 100644 --- a/tests/tcg/meson.build +++ b/tests/tcg/meson.build @@ -84,6 +84,9 @@ docker_supported = docker_probe.returncode() == 0 if docker_supported docker_wrapper = [docker_wrapper, '--command', docker_probe.stdout().strip()] endif +if get_option('container_registry') != '' + tcg_tests_summary += {'container registry': get_option('container_registry')} +endif # plugins come first, as we need to build the list test_plugins = {} @@ -219,6 +222,9 @@ foreach target, plan: tcg_tests if cc_dockerfile not in image_targets and has_docker cmd = [docker_wrapper, 'build', '-f', dockerfile, '-t', 'qemu/' + cc_dockerfile, '--add-current-user'] + if get_option('container_registry') != '' + cmd += ['--registry', get_option('container_registry')] + endif t = custom_target(image_name, command: cmd, build_by_default: false, output: 'no_output_' + image_name) -- 2.47.3
