]> git.proxmox.com Git - mirror_qemu.git/commitdiff
tests/docker/docker.py: check and run .pre script
authorAlex Bennée <alex.bennee@linaro.org>
Tue, 19 Jul 2016 13:20:38 +0000 (21:20 +0800)
committerFam Zheng <famz@redhat.com>
Wed, 20 Jul 2016 11:19:43 +0000 (19:19 +0800)
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>
Message-id: 1468934445-32183-4-git-send-email-famz@redhat.com
Signed-off-by: Fam Zheng <famz@redhat.com>
tests/docker/docker.py

index 96d906e5bef982f8f48aee6260d8cfab4498a3a8..76750c46d0f0467f0dfb7b0e02f40a7538e14272 100755 (executable)
@@ -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,