From patchwork Tue Apr 10 19:39:00 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: 133099 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1634137ljb; Tue, 10 Apr 2018 12:43:07 -0700 (PDT) X-Google-Smtp-Source: AIpwx48UfyIzpPyhxj8OFHWGKwox/teqtFj4zB4xgsik6ljJKTVAWcG/NBCdKVk1sBWRhOtcFrXI X-Received: by 10.55.192.151 with SMTP id v23mr2630615qkv.83.1523389387474; Tue, 10 Apr 2018 12:43:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523389387; cv=none; d=google.com; s=arc-20160816; b=UZlWEwg2QS39HjnHBKa1Er9EDdg8KfuRAOx4i5v4Fw1FSpKmmTUyAhxIM9Z2ktPpSB RWDjQB1Ra0P8kgC/MoX61aDdlOhtk1ZAtIxtp5BrihTfI9Kfw5R7aT4UNl9WyS31DMds ectxsHTnlijrp5r9Y6fF5MZczjbssd81Z1Wugr1MwYOMpxhBiq6od6p+tFk6V7P5I2kP /2JGVp94bAwgJ3tQ9iM72uGvXajgSwyfFSRxmuQ3wQqXBGkmsHnPVwKXzOPIM0uiP3wh roQFAKoKumj1qSbxXph+5//ekt8hUal78ACtzSmzZvSmmx0gj7RLEHz5VTC88nVP+VlL z1aQ== 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:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=zkZydNp+G2jPgk6EpXCE/NYU6/V5AGVg58PyL26SfZ4=; b=t4HkNObrOmfTgqhEML5umu6/eehDyvzLEmc7HhyLsn/mg/vMHoSK9M+z74Qo3WN3J1 p/GUY3StWZXtSQuBIoCvrBvvjtldqCvTvHfetdGU77jJC+9HoTbNShQ8Jur3zxuPudk3 GwgH2W9LNj7zJJn60Ui3VIaCWzYwCD9pPEZwhQhut4cax0EZYjmCfsAQfVno2dtyi9+1 6jw/VQkzYgHGvZXXhv1aK4vTk7MCvrpReICxGjDPc1i/7yrU51SaMZF6az+oPUIjfWnz mEenVMDB0WRe1SRS0TT/Eth60Z+Ij3+cF74lRPSYuaIpWeZY43ppZZIGjJh+DFfClsUi hWIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=jTcGRh+w; 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 f136si1780579qke.134.2018.04.10.12.43.07 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 10 Apr 2018 12:43:07 -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=jTcGRh+w; 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]:39705 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5zAY-00039Q-TP for patch@linaro.org; Tue, 10 Apr 2018 15:43:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46575) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5z71-00007A-Kl for qemu-devel@nongnu.org; Tue, 10 Apr 2018 15:39:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f5z70-0006Iz-UZ for qemu-devel@nongnu.org; Tue, 10 Apr 2018 15:39:27 -0400 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:43278) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f5z70-0006I4-Nq for qemu-devel@nongnu.org; Tue, 10 Apr 2018 15:39:26 -0400 Received: by mail-wr0-x244.google.com with SMTP id p53so13924591wrc.10 for ; Tue, 10 Apr 2018 12:39:26 -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; bh=zkZydNp+G2jPgk6EpXCE/NYU6/V5AGVg58PyL26SfZ4=; b=jTcGRh+wf7xsAK+VfPaNZ0SjwBNrjc1EZBwk3PrGXF+cWlcVK9EbT0PBV2x8meYdEA /jfoF5DGyVhuWxfYtuH7aeml7WX9H3QA8IHhQC9sFE8+36tn2+Yu++wnCl+Oo7/Yu5lH y2PNdKZFgWwyA47Dphgnv1V6249fGMirV6gOU= 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; bh=zkZydNp+G2jPgk6EpXCE/NYU6/V5AGVg58PyL26SfZ4=; b=n8KO9xhIvRmMjT0qS5x4+e6Wj1zLCDmBhCnJ7P67HKMk9gPROj+RkJQcji9Ovh6qwL v2yxBzzng/yoa4/1mna50QtZQh6nT9JKf7ctsW6nmsybCOdO6JFSnwCA0E2tvdruH+5I vifl3pIMDoG5TfikO0KnJTQDpWpWgw16ShEuHq/GU9OXxPw8XOLmpLbPkzzYCZH0lnpl BtmN2Q8vslX2grFXrEkjTDj80Lck3V82hkDRkpbP2YnguljbKQYimoPZPZRzgCBXBnGD Blw3i2rtF7GZuRZ/ZnVxYOJfCdBwjzTw195XXKGEdmkoG7B3a4ESaJsmy57hPQu+dZUb ZMZg== X-Gm-Message-State: ALQs6tBEoBLBaH7tgU4Xh+LU7vEdtXv+4lNSvF0+Hr4NZTspLg0HahPb JyrxZjqVMIbIpLm/7m6XRQEbvA== X-Received: by 10.223.178.163 with SMTP id g32mr1340384wrd.204.1523389165572; Tue, 10 Apr 2018 12:39:25 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id l73sm5550024wma.10.2018.04.10.12.39.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Apr 2018 12:39:24 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id C03493E0968; Tue, 10 Apr 2018 20:39:19 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Tue, 10 Apr 2018 20:39:00 +0100 Message-Id: <20180410193919.28026-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180410193919.28026-1-alex.bennee@linaro.org> References: <20180410193919.28026-1-alex.bennee@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PATCH v1 05/24] 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?= , famz@redhat.com, cota@braap.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Fam Zheng Signed-off-by: Fam Zheng --- tests/docker/docker.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) -- 2.16.2 Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé diff --git a/tests/docker/docker.py b/tests/docker/docker.py index 1246ba9578..8733266153 100755 --- a/tests/docker/docker.py +++ b/tests/docker/docker.py @@ -390,6 +390,29 @@ class ImagesCommand(SubCommand): def run(self, args, argv): return Docker().command("images", argv, args.quiet) +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)] + for p in args.paths: + cmd += ["-v", "%s:%s:ro,z" % (p, p)] + cmd += [args.image, "cc"] + cmd += argv + return Docker().command("run", cmd, True) + def main(): parser = argparse.ArgumentParser(description="A Docker helper", usage="%s ..." % os.path.basename(sys.argv[0]))