From patchwork Tue Apr 24 15:23:20 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: 134112 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp2373276lji; Tue, 24 Apr 2018 08:26:58 -0700 (PDT) X-Google-Smtp-Source: AIpwx49q4E59czczW+ksx9R7NGSNdsxre3dFKv8JCIxCzqeYBs+e2FV3zSbDMuY6eX8IM462MwZb X-Received: by 10.55.86.195 with SMTP id k186mr28056674qkb.0.1524583618328; Tue, 24 Apr 2018 08:26:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524583618; cv=none; d=google.com; s=arc-20160816; b=mROjuw+BVW/tGEgANMNiEBJYKGtJObsHsPf5KjhGv2xwWBMAFgi5xRW2zg5YYuGihL S04LljKDrgCkL/MHLAWWuD2jE415pTD/LxWww5Rr8XT46PEM9yuOuoumWcIKtgzsRin8 XOxW5Ofqfb2ILjraaWiuIlkGQknujbPhTzyJ1UkfABzDTO8su0vzGhip7cW4eexWQw16 Exr8Wld2636K9Gt4L7D/nY+alSsJUJ611y9APoKL0DclfRrDU/P+5HeK01i73GmHidum 5cRntTnKHkNTIv+CLyUpQ4qv6EGNOoTDiN59aWfkuOMK+sq0sfibIsoe7VXtJhN5vjkT wLNA== 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=WlgurOWxgWWNe+eDTvK0gu4sEwGDa5sZBYXXFZPzdAg=; b=mHOM2g2Fswt9T36PWySDRicH6WB+RzjNWYzk/x345w7kT+PXWlmSXyxrYraZKbA07m UkjBFWSo/HM8/Kxd7eBPrVhSQ3aeUu4hmlcV+ZYXyLFMRFO0iJSumifUe/8vF78/K3Fk VoTeoHRV8LTCUE37OUGI0lNCCFd7fEW4xW5rlej9gK7a+557TN/I/sxoEO3DLtshbbfQ qhmJq2Z5DUT+CSVQ8Tne6nBp+VdJxjybJzSn513BvrizYtk/Y1DFX8s1rBCgPrIFAU45 deCrDZ/RUiIUxFJ/GnAcpNH96MRK/eQjQlelGnQB7dWm4dX08m91tQjKGWnrw1GCYY2l yNmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=M1w5lmqU; 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 h11si20875qvd.55.2018.04.24.08.26.58 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 24 Apr 2018 08:26:58 -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=M1w5lmqU; 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]:59080 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fAzqL-0007lU-M4 for patch@linaro.org; Tue, 24 Apr 2018 11:26:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46831) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fAzng-0006Tv-3y for qemu-devel@nongnu.org; Tue, 24 Apr 2018 11:24:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fAznc-0005G9-PR for qemu-devel@nongnu.org; Tue, 24 Apr 2018 11:24:12 -0400 Received: from mail-wm0-x234.google.com ([2a00:1450:400c:c09::234]:54565) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fAznc-0005ER-IV for qemu-devel@nongnu.org; Tue, 24 Apr 2018 11:24:08 -0400 Received: by mail-wm0-x234.google.com with SMTP id f6so1802759wmc.4 for ; Tue, 24 Apr 2018 08:24:08 -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=WlgurOWxgWWNe+eDTvK0gu4sEwGDa5sZBYXXFZPzdAg=; b=M1w5lmqUaiDUFTUMeu5tDTwOWy2fhR8LB9cBIw/CFuD7MfnIKd9bnNRhK9ibY/jLaF unpzgNS4v6NFcqagWX8XPzDI0Na9L6DXuLAzFMeU1R+hLwBcMeW+gIHjMqoQqlx982R1 P+T11d2Vk8EknLhVuL7RJ/aInwqPJaLyYxkqA= 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=WlgurOWxgWWNe+eDTvK0gu4sEwGDa5sZBYXXFZPzdAg=; b=lSiWMwqiWLQK0Y2PN/aQtOXYv9nEjZ+YkphbfoEEK/ryWk5JcfuDP7QELefzABT4la tm+nmlsNCHvbRvdHm97Ho59hbuIRn/oCwzAUYFXy36pJvHe3MpKiAH5rwpqTXOqY4r+B IaqAf0yJQ4F19z6dzeRyGFxdfRGVWxll1Z5HK92f69YtQoANOR/cwJEd7y96HV+3Waez RkUxiSLFwP1sj8VDwzW5NByHlRY+aHNzHiTijITqjLdauC5RCnVlxISGFvSYtBbM6hap Od/2UV/WA18qy3l12Rur4yUzyHj8E71Pf4keILU6IGwqGQ0ondajVRRahFYzK9NtAMvU dS+g== X-Gm-Message-State: ALQs6tD6VHS9mngUbfLawwrAICNnEreHVHetgiqf7kIjxKqfdRj4vYC4 GJczWyC3Fj72WfRQvum8/PpkLA== X-Received: by 10.28.184.132 with SMTP id i126mr12115840wmf.30.1524583447466; Tue, 24 Apr 2018 08:24:07 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id f2-v6sm11965487wre.76.2018.04.24.08.24.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Apr 2018 08:24:05 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 762603E04EC; Tue, 24 Apr 2018 16:24:05 +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: Tue, 24 Apr 2018 16:23:20 +0100 Message-Id: <20180424152405.10304-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180424152405.10304-1-alex.bennee@linaro.org> References: <20180424152405.10304-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:c09::234 Subject: [Qemu-devel] [PATCH v3 01/46] 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 Reviewed-by: Fam Zheng --- tests/docker/docker.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) -- 2.17.0 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]))