Bug 1427336 - Fix recursive adding of directories through %include in Dockerfiles. r?dustin draft
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 29 Dec 2017 14:42:14 +0900
changeset 714733 2070734d3a09fe05a77ef3c258f67018de597db8
parent 714732 391c87d9911cb12c498a43a1e38a8b02ce901b31
child 714734 200d0ce17749a4eb928f979e38c5e05b4dfa6ad8
child 714739 5f41080c01b2a86a7d364717d7f1df3c1a93227c
push id94017
push userbmo:mh+mozilla@glandium.org
push dateFri, 29 Dec 2017 05:49:20 +0000
reviewersdustin
bugs1427336
milestone59.0a1
Bug 1427336 - Fix recursive adding of directories through %include in Dockerfiles. r?dustin Giving a directory to %include would copy all leaf files under one single directory in the context image. The only image affected is valgrind-build, which ended up having a dot-config/pip.conf file instead of dot-config/pip/pip.conf, meaning valgrind jobs weren't using the pip config.
taskcluster/taskgraph/util/docker.py
--- a/taskcluster/taskgraph/util/docker.py
+++ b/taskcluster/taskgraph/util/docker.py
@@ -128,17 +128,18 @@ def create_context_tar(topsrcdir, contex
 
             if not os.path.exists(fs_path):
                 raise Exception('extra include path does not exist: %s' % p)
 
             if os.path.isdir(fs_path):
                 for root, dirs, files in os.walk(fs_path):
                     for f in files:
                         source_path = os.path.join(root, f)
-                        archive_path = os.path.join(prefix, 'topsrcdir', p, f)
+                        rel = source_path[len(fs_path) + 1:]
+                        archive_path = os.path.join(prefix, 'topsrcdir', p, rel)
                         archive_files[archive_path] = source_path
             else:
                 archive_path = os.path.join(prefix, 'topsrcdir', p)
                 archive_files[archive_path] = fs_path
 
     archive_files[os.path.join(prefix, 'Dockerfile')] = \
         GeneratedFile(b''.join(content))