From nobody Sat Jul 25 15:25:54 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1784231914; cv=none; d=zohomail.com; s=zohoarc; b=mDqoU4jUumN7fgu0zHIPbtWxSS2tU1jCWNHl2iNF1QZ7B0yi4IQMI3zBhnBnMI6W9OXpjrylqGDDYe8EKb9MnmMdFIhAeaDGbuHSUDeujs/eMY0yM6T2MlgyjKlb9B37vu0mxcWD13dTJ571rjhBb8UFUU7tPuyrrMMzlQaYtqY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784231914; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=1e9Jo1lVKu0FK+FZ4W5sslqq6VV+iUVq7ayVPUwQZVg=; b=iaJX71rIn0EZux/Lps7ZcZDO22s4NYQ0mbh21+Ijk8fggn4GL5OPsdkkRd95QGkVlmlOBzi0S4vFuW7JMV5Bwx11w7uEQyZLXiEx7j+EnNnSb/asEIm71GG/gZ8dLpaTNx8ILW1Q0ceirbQIpuF1PmJBf2X8ZZy15C374WK6ovc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1784231914627115.74488479164313; Thu, 16 Jul 2026 12:58:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wkSE2-0000vH-4r; Thu, 16 Jul 2026 15:58:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wkSDt-0000qy-0p for qemu-devel@nongnu.org; Thu, 16 Jul 2026 15:58:22 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wkSDq-0000K9-Ju for qemu-devel@nongnu.org; Thu, 16 Jul 2026 15:58:20 -0400 Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66GJooGY3841657 for ; Thu, 16 Jul 2026 19:58:16 GMT Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ff3u80hfp-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 16 Jul 2026 19:58:16 +0000 (GMT) Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-38dad28e86eso8560068a91.0 for ; Thu, 16 Jul 2026 12:58:16 -0700 (PDT) Received: from QCOM-qjMf8PBlDw.qualcomm.com (216-71-219-44.dyn.novuscom.net. [216.71.219.44]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3140e6c23c0sm14140471eec.24.2026.07.16.12.58.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jul 2026 12:58:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 1e9Jo1lVKu0FK+FZ4W5sslqq6VV+iUVq7ayVPUwQZVg=; b=nqmwwt22x2e+8Tox mbvWUKhUw+qzOEhg+lscHRzwlwFt1JWuTeuqKQRgDSwDLddMlhFyyutL+XsLZv5A Wx7aPmYy5x/0O/48AEGVv0mlG9seyZE0r7V8bZAAlcM1UijYf5N9r+G0LQyuIlxD O7n5L8I8oSGvp4QJlckDm4WTpqK0gA7K/cM0GpuTryPKEKhUNV5XQATuh8YUBal9 VQVnCVt2CU4g+CfILp7ZAjSHHLP1+IRj+/K3NEWPujb1/U0Mh/OS8Dra+SpXv41X TLsPJEyMotyrawg223cRCUC+JQ/5Md9L6yJn6YlgXyW2vMr25670MeuUf1Q+g88t Yu6iyw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1784231896; x=1784836696; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=1e9Jo1lVKu0FK+FZ4W5sslqq6VV+iUVq7ayVPUwQZVg=; b=c/2aMoSZ06pHRWexE4FWOF06kP5Q3kBKoOmy7zCP6CFVsK13IL+wsNPJ/2P6Mbd1Uu symaexk7C+iRYZcnIbrCsDjIfE9y3g5WkUs+RbpuJRIvDF1rhHh1/rFyEFW/aqSuFGEl bkx9mNjuOoIuiprIAmYrrVjoWDaA8CaSG+qx8aNqpLl1JzrwXyWzIcd7dmblSxR6lIVr AoPiVzhEiJkkz9zFp4cjNYlc38NI1ZW6RmSJdywE9xwSBkOyaZj6AlH3MNGHOdlcHOej BKC42b0ddM5NQUzGjUetYLPBP2Kh13GG3waunCD9upRdSWFr2JP8YM1jMa8gCqzeRP5T txZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784231896; x=1784836696; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=1e9Jo1lVKu0FK+FZ4W5sslqq6VV+iUVq7ayVPUwQZVg=; b=ghxNYwQ3YM0MLLX01IIkqb3w8ANgbwb3eo926xcaAN4BFARgcqq+bysbJ5ZNhkZn6d tSqrptpHUVRehM4eAoGTcLHHdY5FcOuwHNYUlUxLmcAs/gE+RTz4luSHwGlUibm09bQ/ TrNnJUAQca6mN1UymDvFXcQT8Y2MzEUX+IzpM4V/CFW7SeImxkO4PxyraroJ1ZWNIrMp vk+yB2SRx9zZOIW+PiGp/l36ORut8dXpXSo9GyNnHlob5mLLPxOwb1h0lE60aoeLdIOK a5/8T0xik/rH/neBTRCBxSqCktntJ4rKbk+SCN+5soSIf6LSbQ5v2aHynO8fwnH2IMmv xAWw== X-Gm-Message-State: AOJu0YyH+HK3E0AuPwfF8A3mEr7so0xYvZDgzec4aN57AoB0l73U22hI ze9UoyA2GWsiw0FDuxEvfDdMl8PkxUWcAlAeyaJfo4hJ9btCB7o7LXtL/TbrWOHoSvRbmZZX1C3 SLU4RXIciP9Z1XQ+DI1D3wWDuAlHyqXvoyEjetLTBLKW6gtL5h7E3sQD4fH2J/3Kvrw== X-Gm-Gg: AfdE7cmcdIP3LdljREc7IndGntt+c2gfLW7wEreMPw2Y1k3wcsHbojk93Da/T+BzGTs YiF9IgPPIdryqwzivBtqYEFLwvwemoF8GWyXcWpO0FYJuMarZEM9LVMxNKKk9Gsd3OKAAx+TKyC VZldv4LRIs/71PVb3BqsAInjZVN5kd8vJpL5kP86k3bK/5RPHj6QFoKY9UCq0LrDlP/CrntsdRa SCNd1UDb1A0LC8mFvnVbjU3k6suWv09S8kk1kOpJYRATQut6bsYUQr5ds/vLF1VmlgKlKJPI2zP zAtFtv5XnW26fEDYgC09nuDpmEzDaKVJh0PVIUk3vh6QU4V4IgwSr1BAN6devyBY+LBfcLDwev2 X3ZlpTm25NHfoy2O+4xRByZR5SWDLlPuZ4spufdG+02Ss6VpPdmsMiU8WqleazUJIW/fG6Hk= X-Received: by 2002:a05:6a20:c783:b0:3c3:935a:af2c with SMTP id adf61e73a8af0-3c3a5aadb15mr698396637.3.1784231895906; Thu, 16 Jul 2026 12:58:15 -0700 (PDT) X-Received: by 2002:a05:6a20:c783:b0:3c3:935a:af2c with SMTP id adf61e73a8af0-3c3a5aadb15mr698362637.3.1784231895375; Thu, 16 Jul 2026 12:58:15 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org, peter.maydell@linaro.org, richard.henderson@linaro.org, pbonzini@redhat.com, stefanha@redhat.com Cc: pierrick.bouvier@oss.qualcomm.com Subject: [PULL 1/1] tests/docker: ensure container command is probed at most once Date: Thu, 16 Jul 2026 12:58:07 -0700 Message-ID: <20260716195807.3219466-2-pierrick.bouvier@oss.qualcomm.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260716195807.3219466-1-pierrick.bouvier@oss.qualcomm.com> References: <20260716195807.3219466-1-pierrick.bouvier@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzE2MDIwNCBTYWx0ZWRfXzxxbKV+31Qgh S3bDfBXKxHAl6FeB7hYGQ3eMP2pk+CA6TEyRR3XRAwZU1TKxo2cEH89s6o86g6noHZNMYe5m6h0 HM2meQCDl1ht4Wc/rpUo9GuO5In6OqicVt70j51kEuMHwj8FPKZ2YsO39ydSIAc5n9h1JPAs7J2 MsFlCc89DK5RE+UMN3bmQeVq4VnGaaVXMxn6VL+4O03XQKmg3By78Msmb+DKtCBPKWiRlXlXsQR GjYlKQxt4er5M/QCN6gRtgAnF7mJ7k4fz2I8K8ZnU8gVSfiK6ixQnpmcd0DC9/NBmUjLOMzaQd5 zPZP2VHSBI2DrGfkQUMDYTwfaAQhAfdwPRtbqlAL1O8z+XJ6yB5FbznOrL921fLDri9zLf5vIkz GSHKpsRSu5fiyQ9ZAGiTCWsaByoqchHASt8mAeoSx4GBSOt54yhGAI0GQ9XjGwzz9sMkuKtv09W 3mZCU53wWL++BNirJmQ== X-Proofpoint-ORIG-GUID: EhrRSMFzmNsDDjEGKeJBMVnpxBbDw6zT X-Proofpoint-GUID: EhrRSMFzmNsDDjEGKeJBMVnpxBbDw6zT X-Authority-Analysis: v=2.4 cv=VMvtWdPX c=1 sm=1 tr=0 ts=6a5937d8 cx=c_pps a=0uOsjrqzRL749jD1oC5vDA==:117 a=iLqgmErQAxjCjdq5jj1Aqg==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=VwQbUJbxAAAA:8 a=20KFwNOVAAAA:8 a=EUspDBNiAAAA:8 a=p0WdMEafAAAA:8 a=KJo2S6goiHL0rFSjrngA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=mQ_c8vxmzFEMiUWkPHU9:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzE2MDIwNCBTYWx0ZWRfXy6gLPUZe9ln1 rz1EoLZ/jKqtOGo18seheJgIO5ps5ebsIc04RZgw6tUprgZPCTV0RUJamiCyzb7xyjYeKYtC8j0 yw8+Vp8+cr6PqfGMXIKvPJ61eTADMfw= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-16_07,2026-07-15_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 adultscore=0 phishscore=0 spamscore=0 suspectscore=0 impostorscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607160204 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=pierrick.bouvier@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1784231915657158500 From: Daniel P. Berrang=C3=A9 The '--engine' arg accepts either 'podman' or 'docker', which is not sufficiently granular to map directly to a command. This means that docker.py still has to then probe the exact command to use. Meanwhile the 'probe' command prints out the full command to use but this cannot be passed back to docker.py to avoid probing again, so the caching is only useful in the few case where we run a container directly bypassing docker.py. Address this by replacing --engine with --command for docker.py. This in turn requires the --container-engine configure arg to be replaced with --container-command. With these changes the container command is probed at most once during configure and never again, while running in an unconfigured tree will still probe on demand. Tested-by: Pierrick Bouvier Reviewed-by: Pierrick Bouvier Signed-off-by: Daniel P. Berrang=C3=A9 Link: https://lore.kernel.org/qemu-devel/20260716102515.1503404-1-berrange@= redhat.com Signed-off-by: Pierrick Bouvier --- configure | 25 +++++++------ tests/docker/Makefile.include | 13 ++++--- tests/docker/docker.py | 67 ++++++++++++----------------------- 3 files changed, 40 insertions(+), 65 deletions(-) diff --git a/configure b/configure index d8bc10060e1..6ddfe4b5342 100755 --- a/configure +++ b/configure @@ -172,7 +172,7 @@ fi # some defaults, based on the host environment =20 # default parameters -container_engine=3D"auto" +container_command=3D"" cpu=3D"" cross_compile=3D"no" cross_prefix=3D"" @@ -734,7 +734,7 @@ for opt do ;; --disable-containers) use_containers=3D"no" ;; - --container-engine=3D*) container_engine=3D"$optarg" + --container-command=3D*) container_command=3D"$optarg" ;; --rust-target-triple=3D*) rust_target_triple=3D"$optarg" ;; @@ -869,7 +869,7 @@ Advanced options (experts only): --enable-debug enable common debug build options --cpu=3DCPU Build for host CPU [$cpu] --disable-containers don't use containers for cross-building - --container-engine=3DTYPE which container engine to use [$container_eng= ine] + --container-command=3DCMD which container command to use [autodetect] --gdb=3DGDB-path gdb to use for gdbstub tests [$gdb_bin] --wasm64-32bit-address-limit Restrict wasm64 address space to 32-bit (de= fault is to use the whole 64-bit range). @@ -1291,12 +1291,12 @@ fi ########################################## # functions to probe cross compilers =20 -runc=3D"no" -if test $use_containers =3D "yes" && (has "docker" || has "podman"); then - runc=3D$($python "$source_path"/tests/docker/docker.py --engine "$cont= ainer_engine" probe) - if test "$runc" !=3D "no"; then - docker_py=3D"$python $source_path/tests/docker/docker.py --engine = $container_engine" - fi +if test "$container_command" =3D ""; then + container_command=3D$($python "$source_path"/tests/docker/docker.py pr= obe) + test "$container_command" =3D "no" && container_command=3D"" +fi +if test $use_containers =3D "yes" && test "$container_command" !=3D ""; th= en + docker_py=3D"$python $source_path/tests/docker/docker.py --command $co= ntainer_command" fi =20 # cross compilers defaults, can be overridden with --cross-cc-ARCH @@ -1415,7 +1415,7 @@ probe_target_compiler() { esac =20 for host in $container_hosts; do - test "$runc" !=3D no || continue + test "$container_command" !=3D "" || continue test "$host" =3D "$cpu" || continue case $target_arch in # debian-all-test-cross architectures @@ -1736,9 +1736,8 @@ echo all: >> $config_host_mak echo "SRC_PATH=3D$source_path" >> $config_host_mak echo "TARGET_DIRS=3D$target_list" >> $config_host_mak echo "GDB=3D$gdb_bin" >> $config_host_mak -if test "$runc" !=3D no; then - echo "RUNC=3D$runc" >> $config_host_mak - echo "CONTAINER_ENGINE=3D$container_engine" >> $config_host_mak +if test "$container_command" !=3D ""; then + echo "CONTAINER_COMMAND=3D$container_command" >> $config_host_mak fi echo "SUBDIRS=3D$subdirs" >> $config_host_mak if test "$rust" !=3D disabled; then diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include index 4725c39807b..0adddb6a5c6 100644 --- a/tests/docker/Makefile.include +++ b/tests/docker/Makefile.include @@ -16,9 +16,8 @@ DOCKER_DEFAULT_REGISTRY :=3D registry.gitlab.com/qemu-pro= ject/qemu endif DOCKER_REGISTRY :=3D $(if $(REGISTRY),$(REGISTRY),$(DOCKER_DEFAULT_REGISTR= Y)) =20 -CONTAINER_ENGINE =3D auto -DOCKER_SCRIPT=3D$(SRC_PATH)/tests/docker/docker.py --engine $(CONTAINER_EN= GINE) -RUNC ?=3D $(shell $(DOCKER_SCRIPT) probe) +CONTAINER_COMMAND ?=3D $(shell $(SRC_PATH)/tests/docker/docker.py probe) +DOCKER_SCRIPT=3D$(SRC_PATH)/tests/docker/docker.py --command "$(CONTAINER_= COMMAND)" =20 CUR_TIME :=3D $(shell date +%Y-%m-%d-%H.%M.%S.$$$$) DOCKER_SRC_COPY :=3D $(BUILD_DIR)/docker-src.$(CUR_TIME) @@ -41,7 +40,7 @@ docker-qemu-src: $(DOCKER_SRC_COPY) # General rule for building docker images. docker-image-%: $(DOCKER_FILES_DIR)/%.docker $(call quiet-command, \ - DOCKER_BUILDKIT=3D1 $(RUNC) build \ + DOCKER_BUILDKIT=3D1 $(CONTAINER_COMMAND) build \ $(if $(DOCKER_V),,--quiet) \ $(if $(NOCACHE),--no-cache, \ $(if $(DOCKER_REGISTRY),--cache-from $(DOCKER_REGISTRY)/qemu/$*)) \ @@ -152,7 +151,7 @@ $(foreach i,$(filter-out $(DOCKER_PARTIAL_IMAGES),$(DOC= KER_IMAGES)), \ ) =20 docker: - @echo 'Build QEMU and run tests inside $(RUNC) containers' + @echo 'Build QEMU and run tests inside $(CONTAINER_COMMAND) containers' @echo @echo 'Available targets:' @echo @@ -219,10 +218,10 @@ docker-run: docker-qemu-src $(IMAGE) --executable $(EXECUTABLE), \ " COPYING $(EXECUTABLE) to $(IMAGE)")) $(call quiet-command, \ - $(RUNC) run \ + $(CONTAINER_COMMAND) run \ --rm \ $(if $(NOUSER),, \ - $(if $(filter docker,$(RUNC)), \ + $(if $(filter docker,$(CONTAINER_COMMAND)), \ -u $(UID), \ --userns keep-id \ ) \ diff --git a/tests/docker/docker.py b/tests/docker/docker.py index 9e18b984f45..d2f39b5645b 100755 --- a/tests/docker/docker.py +++ b/tests/docker/docker.py @@ -35,27 +35,6 @@ =20 DEVNULL =3D open(os.devnull, 'wb') =20 -class EngineEnum(enum.IntEnum): - AUTO =3D 1 - DOCKER =3D 2 - PODMAN =3D 3 - - def __str__(self): - return self.name.lower() - - def __repr__(self): - return str(self) - - @staticmethod - def argparse(s): - try: - return EngineEnum[s.upper()] - except KeyError: - return s - - -USE_ENGINE =3D EngineEnum.AUTO - def _bytes_checksum(bytes): """Calculate a digest string unique to the text content""" return hashlib.sha1(bytes).hexdigest() @@ -73,12 +52,11 @@ def _file_checksum(filename): =20 def _guess_engine_command(): """ Guess a working engine command or raise exception if not found""" - commands =3D [] - - if USE_ENGINE in [EngineEnum.AUTO, EngineEnum.PODMAN]: - commands +=3D [["podman"], ["podman-remote"], ["podman", "--remote= "]] - if USE_ENGINE in [EngineEnum.AUTO, EngineEnum.DOCKER]: - commands +=3D [["docker"], ["sudo", "-n", "docker"]] + commands =3D [["podman"], + ["podman-remote"], + ["podman", "--remote"], + ["docker"], + ["sudo", "-n", "docker"]] for cmd in commands: try: # 'version' is not sufficient to prove a working binary @@ -222,8 +200,11 @@ def _dockerfile_verify_flat(df): =20 class Docker(object): """ Running Docker commands """ - def __init__(self): - self._command =3D _guess_engine_command() + def __init__(self, commandstr=3DNone): + if commandstr is None: + self._command =3D _guess_engine_command() + else: + self._command =3D commandstr.split(" ") =20 if ("docker" in self._command and "TRAVIS" not in os.environ and @@ -411,8 +392,8 @@ def args(self, parser): help=3D"Run container using the current user's= uid") =20 def run(self, args, argv): - return Docker().run(argv, args.keep, quiet=3Dargs.quiet, - as_user=3Dargs.run_as_current_user) + return Docker(args.command).run(argv, args.keep, quiet=3Dargs.quie= t, + as_user=3Dargs.run_as_current_user) =20 =20 class BuildCommand(SubCommand): @@ -445,7 +426,7 @@ def run(self, args, argv): dockerfile =3D _read_dockerfile(args.dockerfile) tag =3D args.tag =20 - dkr =3D Docker() + dkr =3D Docker(args.command) if "--no-cache" not in argv and \ dkr.image_matches_dockerfile(tag, dockerfile): if not args.quiet: @@ -512,7 +493,7 @@ def args(self, parser): help=3D"Docker registry") =20 def run(self, args, argv): - dkr =3D Docker() + dkr =3D Docker(args.command) dkr.command(cmd=3D"pull", quiet=3Dargs.quiet, argv=3D["%s/%s" % (args.registry, args.tag)]) dkr.command(cmd=3D"tag", quiet=3Dargs.quiet, @@ -590,7 +571,7 @@ def run(self, args, argv): tmp.seek(0) =20 # Run the build with our tarball context - dkr =3D Docker() + dkr =3D Docker(args.command) dkr.update_image(args.tag, tmp, quiet=3Dargs.quiet) =20 return 0 @@ -601,7 +582,7 @@ class CleanCommand(SubCommand): name =3D "clean" =20 def run(self, args, argv): - Docker().clean() + Docker(args.command).clean() return 0 =20 =20 @@ -610,7 +591,7 @@ class ImagesCommand(SubCommand): name =3D "images" =20 def run(self, args, argv): - return Docker().command("images", argv, args.quiet) + return Docker(args.command).command("images", argv, args.quiet) =20 =20 class ProbeCommand(SubCommand): @@ -619,7 +600,7 @@ class ProbeCommand(SubCommand): =20 def run(self, args, argv): try: - docker =3D Docker() + docker =3D Docker(args.command) print(" ".join(docker._command)) except Exception: print("no") @@ -651,18 +632,16 @@ def run(self, args, argv): cmd +=3D ["-v", "%s:%s:ro,z" % (p, p)] cmd +=3D [args.image, args.cc] cmd +=3D argv - return Docker().run(cmd, False, quiet=3Dargs.quiet, - as_user=3DTrue) + return Docker(args.command).run(cmd, False, quiet=3Dargs.quiet, + as_user=3DTrue) =20 =20 def main(): - global USE_ENGINE - parser =3D argparse.ArgumentParser(description=3D"A Docker helper", usage=3D"%s ..." % os.path.basename(sys.argv[0])) - parser.add_argument("--engine", type=3DEngineEnum.argparse, choices=3D= list(EngineEnum), - help=3D"specify which container engine to use") + parser.add_argument("--command", + help=3D"specify which container engine command to = use") subparsers =3D parser.add_subparsers(title=3D"subcommands", help=3DNon= e) for cls in SubCommand.__subclasses__(): cmd =3D cls() @@ -671,8 +650,6 @@ def main(): cmd.args(subp) subp.set_defaults(cmdobj=3Dcmd) args, argv =3D parser.parse_known_args() - if args.engine: - USE_ENGINE =3D args.engine return args.cmdobj.run(args, argv) =20 =20 --=20 2.47.3