Bug 1421002: Get tasks for `mach try fuzzy` from the root of the repository; r=ahal
authorTom Prince <mozilla@hocat.ca>
Tue, 21 Nov 2017 13:39:21 -0700
changeset 448268 e8f1edcdecbeb97f3ec4ef2d387d19da620c1a99
parent 448267 d76f30fd68022233f6368bcab6fb03dad3b4744e
child 448269 f7515403128275f4f5690e564ff4e48286df055c
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersahal
bugs1421002
milestone59.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 1421002: Get tasks for `mach try fuzzy` from the root of the repository; r=ahal `mach try` pushes the repository containing the current directory. When this is a comm-central checkout, the taskcluster configuration should also come from that repository. MozReview-Commit-ID: KWbNAe4jrHT
tools/tryselect/selectors/fuzzy.py
tools/tryselect/tasks.py
--- a/tools/tryselect/selectors/fuzzy.py
+++ b/tools/tryselect/selectors/fuzzy.py
@@ -193,17 +193,17 @@ def run_fuzzy_try(update=False, query=No
 
     if not fzf:
         print(FZF_NOT_FOUND)
         return
 
     vcs = VCSHelper.create()
     vcs.check_working_directory(push)
 
-    all_tasks = generate_tasks(parameters, full)
+    all_tasks = generate_tasks(parameters, full, root=vcs.root)
 
     key_shortcuts = [k + ':' + v for k, v in fzf_shortcuts.iteritems()]
     cmd = [
         fzf, '-m',
         '--bind', ','.join(key_shortcuts),
         '--header', format_header(),
         # Using python to split the preview string is a bit convoluted,
         # but is guaranteed to be available on all platforms.
--- a/tools/tryselect/tasks.py
+++ b/tools/tryselect/tasks.py
@@ -28,36 +28,36 @@ in your working copy:
     {}
 
 To fix this, either rebase onto the latest mozilla-central or pass in
 -p/--parameters. For more information on how to define parameters, see:
 https://firefox-source-docs.mozilla.org/taskcluster/taskcluster/mach.html#parameters
 """
 
 
-def invalidate(cache):
+def invalidate(cache, root):
     if not os.path.isfile(cache):
         return
 
-    tc_dir = os.path.join(build.topsrcdir, 'taskcluster')
+    tc_dir = os.path.join(root, 'taskcluster')
     tmod = max(os.path.getmtime(os.path.join(tc_dir, p)) for p, _ in FileFinder(tc_dir))
     cmod = os.path.getmtime(cache)
 
     if tmod > cmod:
         os.remove(cache)
 
 
-def generate_tasks(params=None, full=False):
+def generate_tasks(params, full, root):
     params = params or "project=mozilla-central"
 
     cache_dir = os.path.join(get_state_dir()[0], 'cache', 'taskgraph')
     attr = 'full_task_set' if full else 'target_task_set'
     cache = os.path.join(cache_dir, attr)
 
-    invalidate(cache)
+    invalidate(cache, root)
     if os.path.isfile(cache):
         with open(cache, 'r') as fh:
             return fh.read().splitlines()
 
     if not os.path.isdir(cache_dir):
         os.makedirs(cache_dir)
 
     print("Task configuration changed, generating {}".format(attr.replace('_', ' ')))
@@ -66,17 +66,17 @@ def generate_tasks(params=None, full=Fal
         params.check()
     except ParameterMismatch as e:
         print(PARAMETER_MISMATCH.format(e.args[0]))
         sys.exit(1)
 
     cwd = os.getcwd()
     os.chdir(build.topsrcdir)
 
-    root = os.path.join(build.topsrcdir, 'taskcluster', 'ci')
+    root = os.path.join(root, '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