diff mbox

[v5,3/7] tests/docker/docker.py: check and run .pre script

Message ID 1468335639-24582-4-git-send-email-alex.bennee@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Bennée July 12, 2016, 3 p.m. UTC
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 <alex.bennee@linaro.org>

---
v3
  - new for v3, split from previous patch
  - use check_call when running the pre-script
---
 tests/docker/docker.py | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox

Patch

diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index 96d906e..244901d 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -221,6 +221,12 @@  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):
+                subprocess.check_call(os.path.realpath(docker_pre),
+                                      cwd=docker_dir)
+
             # Do we include a extra binary?
             if args.include_executable:
                 _copy_binary_with_libs(args.include_executable,