From patchwork Mon Jun 18 13:07:02 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: 138934 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp3937940lji; Mon, 18 Jun 2018 06:12:17 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI6l+P3Vi2tHqLzqbcMbbozNBgXutpmsizu0ZGBdtFZTpaDWFtYXEix01lX09XUN9or6j/z X-Received: by 2002:a37:2150:: with SMTP id h77-v6mr10386748qkh.424.1529327537350; Mon, 18 Jun 2018 06:12:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529327537; cv=none; d=google.com; s=arc-20160816; b=BiYg2H912zdyzfm+mlXjwTT143ExPFXHJqU6wC9RPXzgSRYnI3VpjWnbUSWnC2JNji BGQ8qYcOkxrd4Dz5JHMw8l5EL7ShuhQZuUjwCCF0Zip+3VuEI4dRdb8f33WFE/9L4Qkv SlGPfxvMI4raZlIQqcOBcVftm0Gg+JwCPkUSp54NqX2R5FHCf8qCAdO7YpYY3fh15HyR BPhY78Hil3xSm8jHbNd0MjcPZqChtWO4EyhswEI5Ob/1h2pMk2MiBZH/uhZ+O1J+bgV8 3gZ/wahoDM1Ri1hQo4bubd92dhGSeY+p0tLrU9Dlz/uR1tu4y5bxKCTH+QjG1Cc4VMjC 2pNg== 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=NfJ5U5jIFnzXeSOLBje2WDYfem2f4jhgHe0dDM3WbUA=; b=PzQG0SYe4kCji85jgFZELvFgZFfOwhkX3rhGyYWO3shG9ENB/PQPYCueHW41XlmhiH hSyAMx8c5bAxaKn+IYMqEiXTJaFQRssyA9rnwfF10Xg9WABGOXXQJ4KUQ0mzkyMyDcua pSBHNzQW2ncmf+HObouHDAVtihqgYHs2We2LCbyGueIN95DUcYBW/uM2U15UYysbLWnb gApRbN+1ruP0ekQ+wDDNg0eKO4NI/fkupSKJ63ooafBl1LI4L8Nhb+/8GZYOuRtRz7Eg qnaTNfCUlavEOKPtg91ZJ0+w/d+eNnC8UPvNEyFk1KSIv1bNMbrdFTIgk1UPYUMmzS0y bDHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=WjzsTLA+; 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 j37-v6si182993qtc.35.2018.06.18.06.12.17 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 18 Jun 2018 06:12:17 -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=WjzsTLA+; 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]:34730 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fUtxA-0000qx-L0 for patch@linaro.org; Mon, 18 Jun 2018 09:12:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52410) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fUtsJ-0005y3-OD for qemu-devel@nongnu.org; Mon, 18 Jun 2018 09:07:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fUtsG-0002d8-Tx for qemu-devel@nongnu.org; Mon, 18 Jun 2018 09:07:15 -0400 Received: from mail-wr0-x229.google.com ([2a00:1450:400c:c0c::229]:35100) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fUtsG-0002cj-OM for qemu-devel@nongnu.org; Mon, 18 Jun 2018 09:07:12 -0400 Received: by mail-wr0-x229.google.com with SMTP id l10-v6so16790011wrn.2 for ; Mon, 18 Jun 2018 06:07:12 -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=NfJ5U5jIFnzXeSOLBje2WDYfem2f4jhgHe0dDM3WbUA=; b=WjzsTLA+c4Z6qB/XcnO9EFXJqfwGPFtbKBazBGL+0fGRbl/A3x/LeEDEane7Ga8wGu hg54A76vz0iADoDUJUTQcdB8l3TDnjb4nuwmNawn+wtlYt9ggUQnMlkMwFiCruv5qqCG Rb0HC8KR/aOLD2fYxOZOqQ2JbtyahACFVcqco= 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=NfJ5U5jIFnzXeSOLBje2WDYfem2f4jhgHe0dDM3WbUA=; b=bQc4Ox7AxRZXgFdzd2SGmkOoCPGp+RsYn3bC+UEK2TVMB088uRRadq3A8D9Pcv00j2 po4nzM1sdsAZZdIhFPzlqh9SOLBmgaMr1S/bT32EV5JW7wpVjObD7c7i1/uIHHqLh6rm aLOzE1odyRxgbHfe1Fdv+7BymaMRmpKsnrXAX4QzUhByIq08nrnYNb3Ve+JPXIHsWb9c ak95GFTBRIM7+Dv2+HH820jph4L8974rxhwHFUVsIZ8DWgi7mfy5EtwW4FVz91S5XiXD C5BxZaxJtsLRm32MLFO5W3dnbUYcjcr4cGfG7L+5aHMm1hC7j/9UO29N5ohcsjhFSdvQ IYgQ== X-Gm-Message-State: APt69E3TGF4ncxfb+KyurwBexjhaO5YBBJ19ZV1PI9f/ThvLH3LOFLRQ 3UkmxNjC06lIcq5gik+UnxOkEg== X-Received: by 2002:adf:a706:: with SMTP id c6-v6mr10767272wrd.61.1529327231705; Mon, 18 Jun 2018 06:07:11 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id c11-v6sm15253238wrm.65.2018.06.18.06.07.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Jun 2018 06:07:10 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 4BD893E05F2; Mon, 18 Jun 2018 14:07:09 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: famz@redhat.com, cota@braap.org, berrange@redhat.com, f4bug@amsat.org, richard.henderson@linaro.org, balrogg@gmail.com, aurelien@aurel32.net, agraf@suse.de Date: Mon, 18 Jun 2018 14:07:02 +0100 Message-Id: <20180618130709.19730-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180618130709.19730-1-alex.bennee@linaro.org> References: <20180618130709.19730-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::229 Subject: [Qemu-devel] [PATCH v1 1/8] 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.1 diff --git a/tests/docker/docker.py b/tests/docker/docker.py index 306e14cf69..4cd6f9b8ec 100755 --- a/tests/docker/docker.py +++ b/tests/docker/docker.py @@ -409,6 +409,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]))