qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: qemu-devel@nongnu.org
Cc: Fam Zheng <famz@redhat.com>, alex.bennee@linaro.org
Subject: [Qemu-devel] [RFC PATCH] docker: Support ".pre" script when building image
Date: Wed,  1 Jun 2016 12:27:21 +0800	[thread overview]
Message-ID: <1464755241-2716-1-git-send-email-famz@redhat.com> (raw)
In-Reply-To: <87vb1u6yeh.fsf@linaro.org>

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 <famz@redhat.com>
---
 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)
-- 
2.8.2

  parent reply	other threads:[~2016-06-01  4:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-26 14:27 [Qemu-devel] [RFC PATCH 0/2] Support building qemu-user powered docker test images Alex Bennée
2016-05-26 14:27 ` [Qemu-devel] [RFC PATCH 1/2] tests/docker/docker.py: support --qemu option Alex Bennée
2016-05-27 11:28   ` Fam Zheng
2016-05-31 15:23     ` Alex Bennée
2016-06-01  3:00       ` Fam Zheng
2016-05-26 14:27 ` [Qemu-devel] [RFC PATCH 2/2] add debian-bootstrap.docker target Alex Bennée
2016-05-27 12:23   ` Fam Zheng
2016-05-31 15:27     ` Alex Bennée
2016-06-01  1:47       ` Fam Zheng
2016-06-01  4:27       ` Fam Zheng [this message]
2016-05-27 12:27 ` [Qemu-devel] [RFC PATCH 0/2] Support building qemu-user powered docker test images Fam Zheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1464755241-2716-1-git-send-email-famz@redhat.com \
    --to=famz@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).