Bug 1288567 - Pass topsrcdir into create_context_tar; r?dustin draft
authorGregory Szorc <gps@mozilla.com>
Fri, 22 Jul 2016 10:32:58 -0700
changeset 392504 3357e35462bca6ab9dcdd03309387e02e2f181bb
parent 392503 293026da2349c6d42d5d98d30c1e0f5fdf7e294c
child 392505 41c83e6c6aa3c4286ab37ef9482ed0c316d1c9b2
push id24042
push userbmo:gps@mozilla.com
push dateMon, 25 Jul 2016 18:25:42 +0000
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
--- 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)):
-        return create_context_tar(context_dir, destination, image_name)
+        return create_context_tar(GECKO, context_dir, destination, image_name)
     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()
             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.