Bug 1459737 - Teach run-task where to find Mercurial on Windows; r?dustin
Because we can't rely on it being in %PATH%.
MozReview-Commit-ID: H6sMdX7XO5Q
--- a/taskcluster/scripts/run-task
+++ b/taskcluster/scripts/run-task
@@ -67,16 +67,17 @@ where it fails to use new volumes for ta
# The exit code to use when caches should be purged and the task retried.
# This is EX_OSFILE (from sysexits.h):
# Some system file does not exist, cannot be opened, or has some
# sort of error (e.g., syntax error).
EXIT_PURGE_CACHE = 72
IS_POSIX = os.name == 'posix'
+IS_WINDOWS = os.name == 'nt'
def print_line(prefix, m):
now = datetime.datetime.utcnow().isoformat()
now = now[:-3] if now[-7] == '.' else now # slice microseconds to 3 decimals
print(b'[%s %sZ] %s' % (prefix, now, m), end=b'')
@@ -198,18 +199,27 @@ def vcs_checkout(source_repo, dest, stor
revision_value = revision
elif branch:
revision_flag = b'--branch'
revision_value = branch
else:
print('revision is not specified for checkout')
sys.exit(1)
+ if IS_POSIX:
+ hg_bin = b'hg'
+ elif IS_WINDOWS:
+ # This is where OCC installs it in the AMIs.
+ hg_bin = br'C:\Program Files\Mercurial\hg.exe'
+ if not os.path.exists(hg_bin):
+ print('could not find Mercurial executable: %s' % hg_bin)
+ sys.exit(1)
+
args = [
- b'hg',
+ hg_bin,
b'robustcheckout',
b'--sharebase', store_path,
b'--purge',
]
# Obtain certificate fingerprints. Without this, the checkout will use the fingerprint
# on the system, which is managed some other way (such as puppet)
if fetch_hgfingerprint:
@@ -247,17 +257,17 @@ def vcs_checkout(source_repo, dest, stor
res = run_and_prefix_output(b'vcs', args,
extra_env={b'PYTHONUNBUFFERED': b'1'})
if res:
sys.exit(res)
# Update the current revision hash and ensure that it is well formed.
revision = subprocess.check_output(
- [b'hg', b'log',
+ [hg_bin, b'log',
b'--rev', b'.',
b'--template', b'{node}'],
cwd=dest)
assert re.match('^[a-f0-9]{40}$', revision)
repo_name = source_repo.split('/')[-1]
print_line(b'vcs', b"TinderboxPrint:<a href={source_repo}/rev/{revision} "