Bug 1410737: Refactor checking out vcs repos in taskcluster mozharness builds.
MozReview-Commit-ID: LyZ5bmEleoW
--- a/taskcluster/taskgraph/transforms/job/mozharness.py
+++ b/taskcluster/taskgraph/transforms/job/mozharness.py
@@ -245,24 +245,31 @@ def mozharness_on_generic_worker(config,
for option in run.get('options', []):
assert ' ' not in option
mh_command.append('--' + option)
if run.get('custom-build-variant-cfg'):
mh_command.append('--custom-build-variant')
mh_command.append(run['custom-build-variant-cfg'])
- hg_command = ['"c:\\Program Files\\Mercurial\\hg.exe"']
- hg_command.append('robustcheckout')
- hg_command.extend(['--sharebase', 'y:\\hg-shared'])
- hg_command.append('--purge')
- hg_command.extend(['--upstream', 'https://hg.mozilla.org/mozilla-unified'])
- hg_command.extend(['--revision', env['GECKO_HEAD_REV']])
- hg_command.append(env['GECKO_HEAD_REPOSITORY'])
- hg_command.append('.\\build\\src')
+ def checkout_repo(base_repo, head_repo, head_rev, path):
+ hg_command = ['"c:\\Program Files\\Mercurial\\hg.exe"']
+ hg_command.append('robustcheckout')
+ hg_command.extend(['--sharebase', 'y:\\hg-shared'])
+ hg_command.append('--purge')
+ hg_command.extend(['--upstream', base_repo])
+ hg_command.extend(['--revision', head_rev])
+ hg_command.append(head_repo)
+ hg_command.append(path)
+
+ hg_commands = checkout_repo(
+ base_repo=env['GECKO_BASE_REPOSITORY'],
+ head_repo=env['GECKO_HEAD_REPOSITORY'],
+ head_rev=env['GECKO_HEAD_REV'],
+ path='.\\build\\src')
worker['command'] = []
if taskdesc.get('needs-sccache'):
worker['command'].extend([
# Make the comment part of the first command, as it will help users to
# understand what is going on, and why these steps are implemented.
dedent('''\
:: sccache currently uses the full compiler commandline as input to the
@@ -270,18 +277,18 @@ def mozharness_on_generic_worker(config,
:: the symlink dir to get consistent paths.
if exist z:\\build rmdir z:\\build'''),
r'mklink /d z:\build %cd%',
# Grant delete permission on the link to everyone.
r'icacls z:\build /grant *S-1-1-0:D /L',
r'cd /d z:\build',
])
+ worker['command'].extend(hg_commands)
worker['command'].extend([
- ' '.join(hg_command),
' '.join(mh_command)
])
@run_job_using('buildbot-bridge', 'mozharness', schema=mozharness_run_schema)
def mozharness_on_buildbot_bridge(config, job, taskdesc):
run = job['run']
worker = taskdesc['worker']