From patchwork Wed Jun 1 04:27:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fam Zheng X-Patchwork-Id: 628485 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rKHwJ6zmgz9s9W for ; Wed, 1 Jun 2016 14:50:08 +1000 (AEST) Received: from localhost ([::1]:39640 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7y6Z-0007BJ-2S for incoming@patchwork.ozlabs.org; Wed, 01 Jun 2016 00:50:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33431) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7xki-0004cB-Tt for qemu-devel@nongnu.org; Wed, 01 Jun 2016 00:27:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b7xkc-0007B8-Tg for qemu-devel@nongnu.org; Wed, 01 Jun 2016 00:27:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46658) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7xkc-0007B2-Nv for qemu-devel@nongnu.org; Wed, 01 Jun 2016 00:27:26 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (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 60385C049D5A; Wed, 1 Jun 2016 04:27:26 +0000 (UTC) Received: from ad.usersys.redhat.com (dhcp-15-133.nay.redhat.com [10.66.15.133]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u514ROkU003062; Wed, 1 Jun 2016 00:27:25 -0400 From: Fam Zheng To: qemu-devel@nongnu.org Date: Wed, 1 Jun 2016 12:27:21 +0800 Message-Id: <1464755241-2716-1-git-send-email-famz@redhat.com> In-Reply-To: <87vb1u6yeh.fsf@linaro.org> References: <87vb1u6yeh.fsf@linaro.org> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 01 Jun 2016 04:27:26 +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] [RFC PATCH] docker: Support ".pre" script when building image 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: alex.bennee@linaro.org, Fam Zheng Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" When building "foo.docker", if a "foo.pre" script exists, it will be executed in the building context before "docker build" is invoked. Signed-off-by: Fam Zheng --- tests/docker/docker.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/docker/docker.py b/tests/docker/docker.py index 0151362..7b8f022 100755 --- a/tests/docker/docker.py +++ b/tests/docker/docker.py @@ -99,6 +99,12 @@ class Docker(object): tmp_df.write("LABEL com.qemu.dockerfile-checksum=%s" % _text_checksum(dockerfile)) tmp_df.flush() + pre_path = os.path.abspath(df_path[:-len(".docker")] + ".pre") + if os.path.isfile(pre_path): + if quiet: + subprocess.check_output([pre_path], cwd=tmp_dir) + else: + subprocess.check_call([pre_path], cwd=tmp_dir) self._do(["build", "-t", tag, "-f", tmp_df.name] + argv + \ [tmp_dir], quiet=quiet)