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