From patchwork Tue Apr 24 15:23:27 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: 134113 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp2373561lji; Tue, 24 Apr 2018 08:27:13 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqkdNrLBbadR6eyjow3AAbbW3sb5hgGacdv6pPyKEN+V8IasMtzI9LFNqWRt9mP2YFTZ+RX X-Received: by 10.233.216.65 with SMTP id u62mr28240076qkf.133.1524583633184; Tue, 24 Apr 2018 08:27:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524583633; cv=none; d=google.com; s=arc-20160816; b=g+X90jMrdprpE1mMl9eNP3cdEunn86bDAimrwghp/Rnb4XrV+E9dKAoty1/Pj8XWh5 XyqSTvdsBr+1qIz2EzB6JZwGgP8T2jNn6OH+DAc1zDiNLlF7yEan5erHUU8NwT/3fgpf u0WQ91Oj0inM9E0qAvfjlb4hMB9nXhwm/PrlIbA+1b7hr2P0LGTvyiyyKHkealpBtHBd bjyaNpxhx1e/6LBBmwOta1t3oXik7BjG7mtv2Q1/EJ+ORD7s2zr+fknVSMCspfj8kLLK AHntQOvCrzHF+EX3Fr4k9Ty58NxyonzDxlLWwhg1DmkXpjgmIomqYdsxv19XvznYrn7R sYFw== 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=Wqvx3mHbV8XVHYTNhVTXVFCoc8fIxH+T0OqAWlhgdEtuWIaParMgdNs/zyEPRUdX2l j1hRkBqOBVilTr3vzOYeeGA9WAwTsIGEU0K9ebn0oJz3tNdgYSxHAFwBpTYXoXxjMK+w C4u2qr7iJQFKndJxy+vfx9TXxm84Iplh304T5M6l2rWia50Tn+iReZ9s4iSrA5zkh0dK 93zUvyizgmLb9NRepPUnTamvaezGjQU3O4ojaO5ZOSYTAxojQ85NOaaE6pW6D+k7+e8n KXHzvBu3dsrIAjy/nSI9h5I+TjP35ygcoPG5mCkDESqYRod+rW0YzFFzi1GbZQPPV2u6 fFrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=SlzE7rZP; 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 q10-v6si7188589qte.161.2018.04.24.08.27.13 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 24 Apr 2018 08:27:13 -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=SlzE7rZP; 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]:59082 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fAzqa-00081m-KN for patch@linaro.org; Tue, 24 Apr 2018 11:27:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46995) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fAznq-0006f4-M2 for qemu-devel@nongnu.org; Tue, 24 Apr 2018 11:24:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fAznk-0005V7-TU for qemu-devel@nongnu.org; Tue, 24 Apr 2018 11:24:22 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:37633) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fAznk-0005To-Mz for qemu-devel@nongnu.org; Tue, 24 Apr 2018 11:24:16 -0400 Received: by mail-wm0-x241.google.com with SMTP id l16so1563593wmh.2 for ; Tue, 24 Apr 2018 08:24:16 -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=SlzE7rZPBO+dLT5f5yR8NPIUZys6bjBUu3SUoDCmcHCKOSNkgTnJJZ8ntouabxrMfe aGaMJNkNWgthksi0uBPhiYSVpXiiKan0QmSsQzoQn8yucdRnvtAXeNJ0Z8YfVLAk6Gom pmTBheCGLdMIEW5fb1IeV9MafGDqzpBcivItM= 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=p1dyZhbrAnl2EuJboPBuZEkJD4+T8WjIsyLsjZ8owP5LI0nGTyRVJTc2WPmVbdnRyy XnEAaN8zUxKaa9lIZ9bHXEPrVC0oTUN+RQYzXBG92nvGdnIvigB3JAXL8G4wmg5indzX oeCWX+TyAA2J2/2k10Gl7Kycb0fB9dS7w3mZq7/XgCdwCTOXiYnaA4TJMqbqUz0V2xXS /BZZASutP4RBb6ALrphdG5eqoD30vpwgzenE6ld556rT46v7b8mbDqW1SN40OlAi1T76 qjbBdAkwARe++fZU84dfh0sPE1TMA4jQ18wrwtnuK3Lpmf/bwaNjKYipx7+4M84sb1/g 0Jig== X-Gm-Message-State: ALQs6tDTHtWa2LV82H8wph4hjF6I737FLh84a3DwrgZTmt+6QBBnXI4+ fQKP9SqGNLslZ4LsJXYwvqO2Sw== X-Received: by 10.28.136.199 with SMTP id k190mr12837108wmd.154.1524583455717; Tue, 24 Apr 2018 08:24:15 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id m83sm11652322wma.17.2018.04.24.08.24.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Apr 2018 08:24:13 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 041B43E0992; Tue, 24 Apr 2018 16:24:06 +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:27 +0100 Message-Id: <20180424152405.10304-9-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::241 Subject: [Qemu-devel] [PATCH v3 08/46] 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]))