From patchwork Thu Apr 19 13:58:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 133764 Delivered-To: patch@linaro.org Received: by 10.46.66.142 with SMTP id h14csp669267ljf; Thu, 19 Apr 2018 06:59:41 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq7lnjzV54AFbBitFJcNkGZXxC0tHnFVW/ESl7XcEXE6HpgvkHQ8M1JU0L9c+vmswTkOPKS X-Received: by 10.12.150.137 with SMTP id a9mr920297qvd.7.1524146381469; Thu, 19 Apr 2018 06:59:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524146381; cv=none; d=google.com; s=arc-20160816; b=tB86+/FhZ3+SAMaSRU6baylzZqurfw2i/fj5ggQQsYt100y/0ebcywv05bq6Oiw1Vn M9iXSkSWlMN0VC19gishFVkNpxUoL2PhIfbnM1KrN2O9C0/uuArOmQ14EWgQYYN/mMtC WEDFa7D1LySbZ6i+wNep5R6blMFjky7HVeCLf1rvVarWSEYkPXHReVrl7ZjRd2xK5H+s FqRUBR7kUODiRxsFH7OK4jZkls9ZePuv7uXsGEAUNW8W7lKSblg8s8VPeIEDHXHkG48a 8yOqQvGENhtmNO4ZIXKl9qZzRjShOQm8yEkZ0+GoIqWR3yZ9kLF5rxzZCXjHFfqkN/6C c7AA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=u29oiq3CC+KvaxAcUAHApC35h6dnscSEFhWDu5R5SEM=; b=RK3P22+2x6uE7270y2FerygJiVoz/gV3pylIjUkTp+XaXZ8RZXJGtEw6qWLwqZB6Gs EIzgZJfBHNVzh4ebonevOVte+TVlVQySxIvqzCI1cJYBYHsGGq8VqALhXfKj3PLJ99k2 C/wkyZNifCT5/DQ6uRgtsmwLq/YqBWdnuotwlDQg0EJYJweFxmJHaZb3ukMzvmfB/KjI pkDqfSGacDvaSXFrOMgHzg3Kik91yr4Rb6C9F16kqWR88qAh5wOxZv5Y0075bU1D/dcD YLEgFmcEfyw2WU1w4Jb84rD/GSy7lddSbdnkxcVUsW0PBo/u4vb6ARKvl4HKRkGh/lR0 WNEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=OZnVqa2p; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id z131si4698970qka.265.2018.04.19.06.59.41 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 19 Apr 2018 06:59:41 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=OZnVqa2p; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49802 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f9A68-0005zW-S4 for patch@linaro.org; Thu, 19 Apr 2018 09:59:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42555) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f9A5c-0005vx-8C for qemu-devel@nongnu.org; Thu, 19 Apr 2018 09:59:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f9A5Z-00024Y-6R for qemu-devel@nongnu.org; Thu, 19 Apr 2018 09:59:08 -0400 Received: from mail-wr0-x22f.google.com ([2a00:1450:400c:c0c::22f]:40520) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f9A5Y-000243-VA for qemu-devel@nongnu.org; Thu, 19 Apr 2018 09:59:05 -0400 Received: by mail-wr0-x22f.google.com with SMTP id v60-v6so14336320wrc.7 for ; Thu, 19 Apr 2018 06:59:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=u29oiq3CC+KvaxAcUAHApC35h6dnscSEFhWDu5R5SEM=; b=OZnVqa2pBXjIUT1OJ3KSblkqKzo/9IcMLIVCZf86pAfCO9exzOyIwAodyuhN2nSvAV h7qc6j3O1IqUuEJi7+/3K7TjvNe1BgOvuFBsdVtQEX6eExP3uRRVJLdWza508secjRV5 9tAbMq+FyHEpEJ+7oDFt+ayVmnxwifBlM0V7A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=u29oiq3CC+KvaxAcUAHApC35h6dnscSEFhWDu5R5SEM=; b=TlRzRb5QeRm87u3nivNCdiJQ9HtFg93m1vV5OReytDM3Xpsgvmos0YXSYny88EwQUk LcUJo+Y39ZyzBTN1faHdicclmaXq3reRCLXF6lwrO/8e8iyJtOBb3P0HQg1dmC5Hm/SH dH7ct9k7qxcHentBZGpVoUKzQ1uVktoSfS/DVYyuBm5/jtMroQ1+jSB5VZ3Ec1gxwwx8 WbeiPB7C2GgePZb8cR4AGn07iBPBQbusBP1bJK6qSpGmzC4bhtzy0shsKM6iuSpJT3Nk nHJxh2WXJwOK7fTSc28ek7bl8e02yS5d25Y09S6JGpmr7YA11t3/StWPUIk6eCvC6PxT UZsA== X-Gm-Message-State: ALQs6tBFDkvlztR4bsENm8cyrMBmwKGvQERvaeoykYr8CE2yxrbvDgEj fD42RfiE5uVrEg7c6oDDCJffhA== X-Received: by 2002:adf:ea01:: with SMTP id q1-v6mr243731wrm.50.1524146343766; Thu, 19 Apr 2018 06:59:03 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id 11sm3764188wmd.26.2018.04.19.06.59.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Apr 2018 06:59:02 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 9B69F3E0288; Thu, 19 Apr 2018 14:59:01 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org, cota@braap.org, famz@redhat.com, berrange@redhat.com, f4bug@amsat.org, richard.henderson@linaro.org, balrogg@gmail.com, aurelien@aurel32.net, agraf@suse.de Date: Thu, 19 Apr 2018 14:58:19 +0100 Message-Id: <20180419135901.30035-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180419135901.30035-1-alex.bennee@linaro.org> References: <20180419135901.30035-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::22f Subject: [Qemu-devel] [PATCH v2 01/43] docker: add "probe" command for configure X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell This is a helper function for the configure script. It replies yes, sudo or no to inform the user if non-interactive docker support is available. We trap the Exception to fail gracefully. Signed-off-by: Alex Bennée --- tests/docker/docker.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) -- 2.17.0 Reviewed-by: Fam Zheng diff --git a/tests/docker/docker.py b/tests/docker/docker.py index 1246ba9578..f8267586eb 100755 --- a/tests/docker/docker.py +++ b/tests/docker/docker.py @@ -390,6 +390,24 @@ class ImagesCommand(SubCommand): def run(self, args, argv): return Docker().command("images", argv, args.quiet) + +class ProbeCommand(SubCommand): + """Probe if we can run docker automatically""" + name = "probe" + + def run(self, args, argv): + try: + docker = Docker() + if docker._command[0] == "docker": + print "yes" + elif docker._command[0] == "sudo": + print "sudo" + except Exception: + print "no" + + return + + def main(): parser = argparse.ArgumentParser(description="A Docker helper", usage="%s ..." % os.path.basename(sys.argv[0]))