Bug 1288567 - Pass topsrcdir into create_context_tar; r=dustin
authorGregory Szorc <gps@mozilla.com>
Fri, 22 Jul 2016 10:32:58 -0700
changeset 346526 f13b4d398a1b6df8c19216994194c073dd6e188b
parent 346525 df2587962e55286f9f46070df84620fc92d3cf50
child 346527 a8b8e6806110c51de467dadadc573ab11c1f5a1c
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdustin
bugs1288567
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1288567 - Pass topsrcdir into create_context_tar; r=dustin Relying on global variables like GECKO is a bit dangerous. To facilitate testing of archive generation in subsequent commits, let's pass an path into this function. The argument is currently unused. MozReview-Commit-ID: Et1UYraflDP
taskcluster/taskgraph/task/docker_image.py
taskcluster/taskgraph/util/docker.py
--- a/taskcluster/taskgraph/task/docker_image.py
+++ b/taskcluster/taskgraph/task/docker_image.py
@@ -138,17 +138,17 @@ class DockerImageTask(base.Task):
         """Creates a tar file of a particular context directory.
 
         Returns the SHA-256 hex digest of the created file.
         """
         destination = os.path.abspath(destination)
         if not os.path.exists(os.path.dirname(destination)):
             os.makedirs(os.path.dirname(destination))
 
-        return create_context_tar(context_dir, destination, image_name)
+        return create_context_tar(GECKO, context_dir, destination, image_name)
 
     @classmethod
     def from_json(cls, task_dict):
         # Generating index_paths for optimization
         routes = task_dict['task']['routes']
         index_paths = []
         for route in routes:
             index_path_regex = re.compile(INDEX_REGEX)
--- a/taskcluster/taskgraph/util/docker.py
+++ b/taskcluster/taskgraph/util/docker.py
@@ -55,17 +55,17 @@ def generate_context_hash(image_path):
             file_hash = hashlib.sha256()
             data = f.read()
             file_hash.update(data)
             context_hash.update(file_hash.hexdigest() + '\t' + relative_filename + '\n')
 
     return context_hash.hexdigest()
 
 
-def create_context_tar(context_dir, out_path, prefix):
+def create_context_tar(topsrcdir, context_dir, out_path, prefix):
     """Create a context tarball.
 
     A directory ``context_dir`` containing a Dockerfile will be assembled into
     a gzipped tar file at ``out_path``. Files inside the archive will be
     prefixed by directory ``prefix``.
 
     Returns the SHA-256 hex digest of the created archive.
     """