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
--- 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