Bug 1400424 - [tryselect] Make sure taskgraph generation is run from topsrcdir, r?dustin draft
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Sat, 16 Sep 2017 00:31:45 -0400
changeset 665882 1ed7d03cac1d0e1479ee590f03ffb78b10cee4d2
parent 665390 893fe1549e1e7342a66514b65960f08d40810a34
child 731921 4c14be8c2122c2d579248788b9e30138554251aa
push id80213
push userahalberstadt@mozilla.com
push dateSat, 16 Sep 2017 04:54:55 +0000
reviewersdustin
bugs1400424
milestone57.0a1
Bug 1400424 - [tryselect] Make sure taskgraph generation is run from topsrcdir, r?dustin This was preventing us from running ./mach try fuzzy from a subdirectory of the topsrcdir. This also fixes taskgraph/utils/verify.py to find the docs directory based off of topsrcdir instead of cwd. This was needed as cwd was being set at import time. MozReview-Commit-ID: CgQqD6bQ5q4
taskcluster/taskgraph/util/verify.py
tools/tryselect/tasks.py
--- a/taskcluster/taskgraph/util/verify.py
+++ b/taskcluster/taskgraph/util/verify.py
@@ -4,17 +4,19 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import absolute_import, print_function, unicode_literals
 
 import re
 import os
 import sys
 
-base_path = os.path.join(os.getcwd(), "taskcluster/docs/")
+from .. import GECKO
+
+base_path = os.path.join(GECKO, 'taskcluster', 'docs')
 
 
 class VerificationSequence(object):
     """
     Container for a sequence of verifications over a TaskGraph. Each
     verification is represented as a callable taking (task, taskgraph,
     scratch_pad), called for each task in the taskgraph, and one more
     time with no task but with the taskgraph and the same scratch_pad
--- a/tools/tryselect/tasks.py
+++ b/tools/tryselect/tasks.py
@@ -43,15 +43,20 @@ def generate_tasks(params=None, full=Fal
 
     if not os.path.isdir(cache_dir):
         os.makedirs(cache_dir)
 
     print("Task configuration changed, generating {}".format(attr.replace('_', ' ')))
     params = load_parameters_file(params)
     params.check()
 
+    cwd = os.getcwd()
+    os.chdir(build.topsrcdir)
+
     root = os.path.join(build.topsrcdir, 'taskcluster', 'ci')
     tg = getattr(TaskGraphGenerator(root_dir=root, parameters=params), attr)
     labels = [label for label in tg.graph.visit_postorder()]
 
+    os.chdir(cwd)
+
     with open(cache, 'w') as fh:
         fh.write('\n'.join(labels))
     return labels