diff --git a/configure b/configure index 5e114acea2..b99ba65d71 100755 --- a/configure +++ b/configure @@ -1319,17 +1319,11 @@ fi ########################################## # functions to probe cross compilers -container="no" -runc="" +runc="no" if test $use_containers = "yes" && (has "docker" || has "podman"); then - case $($python "$source_path"/tests/docker/docker.py --engine "$container_engine" probe) in - *docker) container=docker ;; - podman) container=podman ;; - no) container=no ;; - esac - if test "$container" != "no"; then - docker_py="$python $source_path/tests/docker/docker.py --engine $container" - runc=$container + runc=$($python "$source_path"/tests/docker/docker.py --engine "$container_engine" probe) + if test "$runc" != "no"; then + docker_py="$python $source_path/tests/docker/docker.py --engine $container_engine" fi fi @@ -1449,7 +1443,7 @@ probe_target_compiler() { esac for host in $container_hosts; do - test "$container" != no || continue + test "$runc" != no || continue test "$host" = "$cpu" || continue case $target_arch in # debian-all-test-cross architectures @@ -1771,8 +1765,9 @@ echo all: >> $config_host_mak echo "SRC_PATH=$source_path" >> $config_host_mak echo "TARGET_DIRS=$target_list" >> $config_host_mak echo "GDB=$gdb_bin" >> $config_host_mak -if test "$container" != no; then +if test "$runc" != no; then echo "RUNC=$runc" >> $config_host_mak + echo "CONTAINER_ENGINE=$container_engine" >> $config_host_mak fi echo "SUBDIRS=$subdirs" >> $config_host_mak if test "$rust" != disabled; then diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include index 38467cca61..7d4582b6a8 100644 --- a/tests/docker/Makefile.include +++ b/tests/docker/Makefile.include @@ -16,8 +16,9 @@ DOCKER_DEFAULT_REGISTRY := registry.gitlab.com/qemu-project/qemu endif DOCKER_REGISTRY := $(if $(REGISTRY),$(REGISTRY),$(DOCKER_DEFAULT_REGISTRY)) -RUNC ?= $(if $(shell command -v docker), docker, podman) -DOCKER_SCRIPT=$(SRC_PATH)/tests/docker/docker.py --engine $(RUNC) +CONTAINER_ENGINE = auto +DOCKER_SCRIPT=$(SRC_PATH)/tests/docker/docker.py --engine $(CONTAINER_ENGINE) +RUNC ?= $(shell $(DOCKER_SCRIPT) probe) CUR_TIME := $(shell date +%Y-%m-%d-%H.%M.%S.$$$$) DOCKER_SRC_COPY := $(BUILD_DIR)/docker-src.$(CUR_TIME) diff --git a/tests/docker/docker.py b/tests/docker/docker.py index 3b8a26704d..ff68c7bf6f 100755 --- a/tests/docker/docker.py +++ b/tests/docker/docker.py @@ -618,12 +618,7 @@ class ProbeCommand(SubCommand): def run(self, args, argv): try: docker = Docker() - if docker._command[0] == "docker": - print("docker") - elif docker._command[0] == "sudo": - print("sudo docker") - elif docker._command[0] == "podman": - print("podman") + print(" ".join(docker._command)) except Exception: print("no")