From patchwork Wed Jun 21 14:47:56 2017 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: 106087 Delivered-To: patch@linaro.org Received: by 10.182.29.35 with SMTP id g3csp1861716obh; Wed, 21 Jun 2017 07:56:42 -0700 (PDT) X-Received: by 10.159.35.117 with SMTP id 108mr21354058uae.43.1498057002730; Wed, 21 Jun 2017 07:56:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498057002; cv=none; d=google.com; s=arc-20160816; b=Onsa4YRni3CVP0Al98gPLzOzuXn7xvCRm6xTeyBenZA84Oi46LSrpxJFdqf8Ybj/T3 P3RpkGfE7NS0VhcHRUCUYKjwCzSEnXOZCoaARFVjHFugYrjbv7b5JZSHeMMSbhTxtugC WY9XuPefIwBfkMDceJDdLIyBqHYytKZUlCSZJ0wR8QDwQe2dPf1/RJnOVFwlovLr4Ozm kvWBUhHlHC0qzqXIFrnWC81R3FxVyrYxykwnYytMzdtbT+YFRNABno3MOVG4STCV8lWu mxg69zLB+9H7kfrKwL8JKq4TeufR/1w1Ps2+oKFM5YFXQvT7gjqA8gJrAzplQ2iJRJ9j KweQ== 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=bcFC7iMYIw7xrvR1B2fU9IqNnmAG4tibYYaSHK7RHtY=; b=q9zBOdm5wDcpXSZrsVgSNEDAi7Ki7bvNqiFz77M4a3mOrap9Xq93thBQm0OeUi9w0b kfIOeaKr+51duH/0QoZfRdqTEMPukfol/FWaMx4BvbTtVKOa50UWPShCqRjY66BzxqML L8B4YRc/G2kpGAeQk+2mdnr6fop5SLwwcIrn9/Th3Sei5PGCv2f7gZPG8wbqGPU3KloF vL5BO1MZJMDimAEIH6A+E3FZJgWzNztmALtCAD88XAlt9CZPwD4dnYSTWG3G7xhZhWlT A2D+cN+ynMONhs/qhKFuNiEJvIBbfYXqVfybteokDfp7Sf1FtG+8pWL4fj2G+KLblIuP TbmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.b=VXSnXCUl; 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 x14si6365742uai.184.2017.06.21.07.56.42 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 21 Jun 2017 07:56:42 -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.b=VXSnXCUl; 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]:54550 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dNh3g-0006ub-Al for patch@linaro.org; Wed, 21 Jun 2017 10:56:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37765) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dNguv-0006j5-Dy for qemu-devel@nongnu.org; Wed, 21 Jun 2017 10:47:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dNgus-00051Q-Tk for qemu-devel@nongnu.org; Wed, 21 Jun 2017 10:47:37 -0400 Received: from mail-wr0-x22a.google.com ([2a00:1450:400c:c0c::22a]:36423) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dNgus-00050n-MS for qemu-devel@nongnu.org; Wed, 21 Jun 2017 10:47:34 -0400 Received: by mail-wr0-x22a.google.com with SMTP id c11so82679900wrc.3 for ; Wed, 21 Jun 2017 07:47:34 -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=bcFC7iMYIw7xrvR1B2fU9IqNnmAG4tibYYaSHK7RHtY=; b=VXSnXCUljBqNDdL50bERKP7CplZaBhhRGWCHZVaUeYJ5yNmaq++GtixbF3eOHKM+W2 FInRC1RLR/lE5CnUYYMitIlBecVA+OzpVWI09oxQ7eB+sZz76ejsu8Ri2vhLVFnY/sup Oljq3Ebx6kC+rBPzLHh5HDQWPFkNtiYAG94pY= 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=bcFC7iMYIw7xrvR1B2fU9IqNnmAG4tibYYaSHK7RHtY=; b=nOZNLGPJJ74aQApXs14DaOwq3UZ1z0hI3Pv2DrDGqmhybOWqxdAUi+D+SbZ4nBVu1I X1RXemWmOz97oen/92iLxMG93NT2L90HzvZDZNC7xaPUKjQ2SSdq++YJyk/ZTqnoaBHT mbLTzn+RP+SBI0ESmgMtYNhKvDI7bfTMVvhkjAZJ99QMrH94VTPnnaOCCoofi0S9CPlB I9MPDt5Yp/cbWXuQToZEmYSDX0tKlFm4V3INRfeZpOSnXpJogHFEIVnfiJLXuFemJ+r4 WI0EE8F6IyGkSH5aWjdzb1XCTvPRX1vO5SP7uuwlHXPm06wpxaZxH5oae8WWsfzUGZ+8 3eUQ== X-Gm-Message-State: AKS2vOwnvmScMmfOIkNlMkebgRYkU4exZK8zsn1EoxGlh4dJHETmuSkN KJWbic2eZSF9JHQv X-Received: by 10.223.133.186 with SMTP id 55mr13377086wrt.102.1498056453586; Wed, 21 Jun 2017 07:47:33 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id 24sm20653140wrw.0.2017.06.21.07.47.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Jun 2017 07:47:31 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 6AF343E0F68; Wed, 21 Jun 2017 15:48:14 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Wed, 21 Jun 2017 15:47:56 +0100 Message-Id: <20170621144814.15324-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170621144814.15324-1-alex.bennee@linaro.org> References: <20170621144814.15324-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::22a Subject: [Qemu-devel] [PULL 03/21] docker: add --include-files argument to 'build' command 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: Fam Zheng , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Alex Bennée Signed-off-by: Alex Bennée -- 2.13.0 diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include index 0ed8c3d323..61cc0d14e2 100644 --- a/tests/docker/Makefile.include +++ b/tests/docker/Makefile.include @@ -51,6 +51,7 @@ docker-image-%: $(DOCKER_FILES_DIR)/%.docker $(SRC_PATH)/tests/docker/docker.py build qemu:$* $< \ $(if $V,,--quiet) $(if $(NOCACHE),--no-cache) \ $(if $(NOUSER),,--add-current-user) \ + $(if $(EXTRA_FILES),--extra-files $(EXTRA_FILES))\ $(if $(EXECUTABLE),--include-executable=$(EXECUTABLE)),\ "BUILD","$*") @@ -107,6 +108,8 @@ docker: @echo ' NOUSER Define to disable adding current user to containers passwd.' @echo ' NOCACHE=1 Ignore cache when build images.' @echo ' EXECUTABLE= Include executable in image.' + @echo ' EXTRA_FILES=" [... ]"' + @echo ' Include extra files in image.' # This rule if for directly running against an arbitrary docker target. # It is called by the expanded docker targets (e.g. make diff --git a/tests/docker/docker.py b/tests/docker/docker.py index 6ddc6e4c2a..10fa907905 100755 --- a/tests/docker/docker.py +++ b/tests/docker/docker.py @@ -237,6 +237,10 @@ class BuildCommand(SubCommand): help="""Specify a binary that will be copied to the container together with all its dependent libraries""") + parser.add_argument("--extra-files", "-f", nargs='*', + help="""Specify files that will be copied in the + Docker image, fulfilling the ADD directive from the + Dockerfile""") parser.add_argument("--add-current-user", "-u", dest="user", action="store_true", help="Add the current user to image's passwd") @@ -270,10 +274,12 @@ class BuildCommand(SubCommand): print "%s exited with code %d" % (docker_pre, rc) return 1 - # Do we include a extra binary? + # Copy any extra files into the Docker context. These can be + # included by the use of the ADD directive in the Dockerfile. if args.include_executable: - _copy_binary_with_libs(args.include_executable, - docker_dir) + _copy_binary_with_libs(args.include_executable, docker_dir) + for filename in args.extra_files or []: + _copy_with_mkdir(filename, docker_dir) argv += ["--build-arg=" + k.lower() + "=" + v for k, v in os.environ.iteritems()