From patchwork Thu May 17 17:46:30 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: 136169 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp241779lji; Thu, 17 May 2018 10:53:39 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq7/azKb7KKkeaXhf2UqGcsC0NsFhks1lif7u4aTC121Sa+WGCrtd/dQ9ty0kaZxA2fF9Vz X-Received: by 2002:a37:d1d6:: with SMTP id o83-v6mr5648876qkl.203.1526579619159; Thu, 17 May 2018 10:53:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526579619; cv=none; d=google.com; s=arc-20160816; b=FHj4+I+ZkZtU+oGhv8f3Vx79beY3TLqcCkV4unddZ9Oq3nq95wY9uUOlJvSwRkjwP9 yCsfbdrCdf9g9yyT0H+XLWM8vGwZ2acSsKAQGs6RIKidWSV/iqzu8euhOaBuKkPafC7n du8ZeQxx8HoSmqv9Abpjpsvza7gp8f6ZYC0AQ4WYMPl5OVRYUr4QJxksC+/JvHIX2NN4 GG7uJcsqiv2Soo1VVkc8gjumo+mlpcwVyrQzzAVIKvHR4v0SU5DrzOvjbBh5UzjQ6gJ2 wuy0uVgxMpimn+Se0411s8A2bhLR63ppe1L4Ubp8roEpLrdWyVPhbAldJk6QQKllJNqC wNvA== 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=icyhNd5KQavNcvfAeUvX27EOWr3MXvhI7RrpNDKrgu0=; b=NGpLPeAC/MTfckkSxL3OEv/U09FRZAU0oL9glLHrYi8tlPgdnYQShuwtvKsMx0Qy1L cW2FvcMEigbSYuBOEXzXYibbUfm6vrxoX0FeIPtGdhdohwaUM8zJvgl3sv62WVr5PQ4l HK5Q+0XGy7zgoUzGfadtt1akm3j24mR3toPc4ySmOczaJQqsKMwYLEuwvmTW2jb3nZ2V bQbvCr5OJAfi4NPY67INruQiT+x6KpB9rG8q84gVWzscPtquEMwNA5JEJsR6DTIkdBZp AywnzK/r7Q/NfRnNPv2KwF6DdoR9Ndb429BSxHOw5OwWXMuF+gd8LoPRYN3rsjRj6Wod FsYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UthnWQIL; 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 l12-v6si845788qtn.189.2018.05.17.10.53.38 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 17 May 2018 10:53:39 -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=UthnWQIL; 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]:38448 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJN5u-0001nB-L0 for patch@linaro.org; Thu, 17 May 2018 13:53:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50784) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJMzt-0006Df-9t for qemu-devel@nongnu.org; Thu, 17 May 2018 13:47:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fJMzq-0003QN-8e for qemu-devel@nongnu.org; Thu, 17 May 2018 13:47:25 -0400 Received: from mail-wr0-x236.google.com ([2a00:1450:400c:c0c::236]:37341) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fJMzq-0003Py-1w for qemu-devel@nongnu.org; Thu, 17 May 2018 13:47:22 -0400 Received: by mail-wr0-x236.google.com with SMTP id h5-v6so6548886wrm.4 for ; Thu, 17 May 2018 10:47:21 -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=icyhNd5KQavNcvfAeUvX27EOWr3MXvhI7RrpNDKrgu0=; b=UthnWQILZmtX/qxtuSNNe+9Rp4aKIZ2V1DWlHrdUjcR7PEC8jWsNTzpmwl7gW3hSwp cX2k3xxWAYhHqzEGUWzdxOsxY9Y0VA/vxfyr8t5no0ip6Z9f3ZcnclVoz/rCeBGIy2d+ GxHwMAexauYB/GmDNjAvQKeoffisF42sfwYKE= 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=icyhNd5KQavNcvfAeUvX27EOWr3MXvhI7RrpNDKrgu0=; b=GdxHC7eteDSPXJSrQC5lPR6xbVr1GtMr6LMR4VQthNpWGkGAcUk/NeDYFNgwcgC/X9 loqmzbrBv5YgIBomlLz7c/ZQLdff51LTJovZNbAvFLET6krRdPzXDT76l47x4xZ3gdBu alkanW458Wg/D3p1Qb/t6LZ3scWct/opXdt6pvT2hRb9iQWW9P7PjFT6LVlGylRdJv6S 7vJNY1eGPv8WhthyQzElhmW0IkYp7TkhKcOOA/sNVnlZ/BAuVGATx9cDEZpd1oWzhPF8 kgJLW8KdG3rflMkC9AWfuBitOMGGwGX78uaJjZJ1/yL3H0U7+ZJ0WvceTQ1OWwVd+y49 w7+w== X-Gm-Message-State: ALKqPweZqAeL7CeM0ysKFfns+tR1NGIuW/VuOqlY0d4mp/Cv7+UNCcpl 1GCuleU3Wh8t/znErNK9IZ1EniKV5tM= X-Received: by 2002:adf:bc8f:: with SMTP id g15-v6mr5152842wrh.266.1526579240887; Thu, 17 May 2018 10:47:20 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id d54-v6sm8627164wrd.94.2018.05.17.10.47.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 May 2018 10:47:19 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id D38263E0CEF; Thu, 17 May 2018 18:47:18 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: 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, 17 May 2018 18:46:30 +0100 Message-Id: <20180517174718.10107-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180517174718.10107-1-alex.bennee@linaro.org> References: <20180517174718.10107-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::236 Subject: [Qemu-devel] [PATCH v4 01/49] 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" 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]))