From patchwork Thu Apr 19 13:58:26 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: 133775 Delivered-To: patch@linaro.org Received: by 10.46.66.142 with SMTP id h14csp682627ljf; Thu, 19 Apr 2018 07:09:45 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/HtYbMBkfo3wLQZFckHDxNy5D//j34K4tYgULEs/rCO55Z00ik+JC99MrzZWD3dUzFFFrT X-Received: by 10.55.31.161 with SMTP id n33mr6305101qkh.393.1524146985427; Thu, 19 Apr 2018 07:09:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524146985; cv=none; d=google.com; s=arc-20160816; b=aEr8d1CYSI32GL7rLkdZ63Wy5rTTXtzrfXraaQ/XSH6Cp4oG+pZPhGDFkHWXe7OCLy ZJMGWoYq8w9nyPwWyRB5kXU7utdq8wLoMcu29rRwPQKHkykRnJvUZzJ4a22EW3UpVSj4 brL+Yqi6UyOv+WQZNTgptLmTRTuV3Z+YSizkdBJDrYRO7uorOLMNFXUcC/n96xFtKPjL mbbLT91IWT4XyZhBW9pzkTJg+n8SuZIX8dui+Vdyvb//Om76vAfLfTLVVrhwi/I0XHun ILvpvapKIAdhEyIaG/zYEU8HNACBaLd+JF7+OKa2WdE2PgHf1A/O5GXsIeXGk7a9qLfW dHhA== 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=2bTmo5Z3bqje3uvfKSKg6BbcjFDioLuevJQVtr4gvdc=; b=ZhJx4ELt6v5lvSD+VgfxZz62T6/fXZujUZ8c9upu2W01IshuCf55j4fOGV4M3eMFCs ydCN2tOCvuAUlyb76M6UxnBKQX0N1AcxRn4fuC+6/dLOduo3d5R/qaK32P1Ox4pTaqvC efdXmDPGN+9w/nVSgZdTgIcRwUvNEaQgnWIAk0hKV/GyDLxws9S4AIFhlH9G81+0ccr2 OMJ1aRt15M6uQcIftedfpDTyWsWy8Psf/sQfuo6nO3TnnK7oqKN3qqZOQ/7x/AyOPKLu PKrwM6dbi9fwE7ldhYGCAlf9j8JNNGjhx5tHmcYtbyqqbP14iJ0IdTCuSxKQnaLK9isE joAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=SH5smvtJ; 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 d11si453775qvf.95.2018.04.19.07.09.45 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 19 Apr 2018 07:09:45 -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=SH5smvtJ; 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]:50003 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f9AFs-00063P-Q3 for patch@linaro.org; Thu, 19 Apr 2018 10:09:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42747) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f9A5l-00064M-CS for qemu-devel@nongnu.org; Thu, 19 Apr 2018 09:59:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f9A5f-00029i-Mh for qemu-devel@nongnu.org; Thu, 19 Apr 2018 09:59:17 -0400 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:41554) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f9A5f-000295-GD for qemu-devel@nongnu.org; Thu, 19 Apr 2018 09:59:11 -0400 Received: by mail-wr0-x241.google.com with SMTP id v24-v6so14330517wra.8 for ; Thu, 19 Apr 2018 06:59:11 -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=2bTmo5Z3bqje3uvfKSKg6BbcjFDioLuevJQVtr4gvdc=; b=SH5smvtJW78Ri/ZHXYoNlfWRCqyuqDDmtv7n/w50Z2oQpWRY3YXI2dWUmHw2ppET5c NXX8/027v2dnFTN4LGAPbRT73XMLyhZIE6Usw4ZfY3ckuTnO2WQaAncNmhfryUbKe79g IkE9v/0vfoz6ZwkkBXI/UcVWFUdVBbohU18iw= 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=2bTmo5Z3bqje3uvfKSKg6BbcjFDioLuevJQVtr4gvdc=; b=guUNAWucsocsq8GYMkAyF2AWwFudaECB5R+Pbd4F3s3CwexPVd1C9Udx6HAUP4Tccb 5nMuKtvQ0ZL0FLKQbdZTHXUWQv3wAfh+FJV2FN2QY54SGpLrFTYvobu3sPTiqje3OXne Oq/pp2audvVWZ0PKQOmsDSw/1QusZ2e3AZAD6fjw2GMXPwGQ4KwXMaKlyYVhfGCo/lHe a0Y3boJveW910sfkYOTIRk4PsEGVpCjKoQcDLSHMyprAY8J3SFbDHzOtHr2Foa0zZTnd zju6KeQt8K4bIb8Tp+Z606PSwx8YEHOGDpXBl6BkadUpA/CL762hY8V32xLMcc3cSPC7 R9zw== X-Gm-Message-State: ALQs6tB7Gb56Suol7YarJIqeMughAUslyOf+6N/x1LuvHr7IBHTHG+EU d6KvlzEWEXRWAPFwPEqL+Al6YioDDdk= X-Received: by 10.28.135.9 with SMTP id j9mr4946542wmd.68.1524146350330; Thu, 19 Apr 2018 06:59:10 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id d7-v6sm3515865wrj.26.2018.04.19.06.59.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Apr 2018 06:59:06 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 259883E03B9; Thu, 19 Apr 2018 14:59:02 +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:26 +0100 Message-Id: <20180419135901.30035-9-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::241 Subject: [Qemu-devel] [PATCH v2 08/43] docker: Add "cc" subcommand 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" Signed-off-by: Fam Zheng [AJB: add if args.paths check] Signed-off-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé --- v2 - add if args.paths check to avoid iterating null argument --- tests/docker/docker.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) -- 2.17.0 diff --git a/tests/docker/docker.py b/tests/docker/docker.py index f8267586eb..bcc3ee2dee 100755 --- a/tests/docker/docker.py +++ b/tests/docker/docker.py @@ -408,6 +408,31 @@ class ProbeCommand(SubCommand): return +class CcCommand(SubCommand): + """Compile sources with cc in images""" + name = "cc" + + def args(self, parser): + parser.add_argument("--image", "-i", required=True, + help="The docker image in which to run cc") + parser.add_argument("--source-path", "-s", nargs="*", dest="paths", + help="""Extra paths to (ro) mount into container for + reading sources""") + + def run(self, args, argv): + if argv and argv[0] == "--": + argv = argv[1:] + cwd = os.getcwd() + cmd = ["--rm", "-w", cwd, + "-v", "%s:%s:rw" % (cwd, cwd)] + if args.paths: + for p in args.paths: + cmd += ["-v", "%s:%s:ro,z" % (p, p)] + cmd += [args.image, "cc"] + cmd += argv + return Docker().command("run", cmd, args.quiet) + + def main(): parser = argparse.ArgumentParser(description="A Docker helper", usage="%s ..." % os.path.basename(sys.argv[0]))