From patchwork Tue Jul 19 14:31:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Fam Zheng X-Patchwork-Id: 9237655 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 72E366075D for ; Tue, 19 Jul 2016 14:36:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 63C8826A5C for ; Tue, 19 Jul 2016 14:36:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 586EB2756B; Tue, 19 Jul 2016 14:36:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D072B26A5C for ; Tue, 19 Jul 2016 14:36:46 +0000 (UTC) Received: from localhost ([::1]:56452 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPW8c-0004sY-1k for patchwork-qemu-devel@patchwork.kernel.org; Tue, 19 Jul 2016 10:36:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41456) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPW3X-0006ih-3A for qemu-devel@nongnu.org; Tue, 19 Jul 2016 10:31:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPW3V-0002OD-1A for qemu-devel@nongnu.org; Tue, 19 Jul 2016 10:31:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45174) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPW3U-0002O5-RN for qemu-devel@nongnu.org; Tue, 19 Jul 2016 10:31:28 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 605D8C07EFC3; Tue, 19 Jul 2016 14:31:28 +0000 (UTC) Received: from ad.usersys.redhat.com (dhcp-14-122.nay.redhat.com [10.66.14.122]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6JEVLVg004350; Tue, 19 Jul 2016 10:31:27 -0400 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 19 Jul 2016 22:31:10 +0800 Message-Id: <1468938677-15607-4-git-send-email-famz@redhat.com> In-Reply-To: <1468938677-15607-1-git-send-email-famz@redhat.com> References: <1468938677-15607-1-git-send-email-famz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 19 Jul 2016 14:31:28 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 03/10] tests/docker/docker.py: check and run .pre script 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: peter.maydell@linaro.org, famz@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Alex Bennée The docker script will now search for an associated $dockerfile.pre script which gets run in the same build context as the dockerfile will be. This is to support pre-seeding the build context before running the docker build. Signed-off-by: Alex Bennée Message-id: 1468934445-32183-4-git-send-email-famz@redhat.com Signed-off-by: Fam Zheng --- tests/docker/docker.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/docker/docker.py b/tests/docker/docker.py index 96d906e..76750c4 100755 --- a/tests/docker/docker.py +++ b/tests/docker/docker.py @@ -221,6 +221,18 @@ class BuildCommand(SubCommand): # Create a docker context directory for the build docker_dir = tempfile.mkdtemp(prefix="docker_build") + # Is there a .pre file to run in the build context? + docker_pre = os.path.splitext(args.dockerfile)[0]+".pre" + if os.path.exists(docker_pre): + rc = subprocess.call(os.path.realpath(docker_pre), + cwd=docker_dir) + if rc == 3: + print "Skip" + return 0 + elif rc != 0: + print "%s exited with code %d" % (docker_pre, rc) + return 1 + # Do we include a extra binary? if args.include_executable: _copy_binary_with_libs(args.include_executable,