--- a/taskcluster/docker/rust-build/repack_rust.py
+++ b/taskcluster/docker/rust-build/repack_rust.py
@@ -57,17 +57,16 @@ def fetch(url):
def install(filename, target):
'''Run a package's installer script against the given target directory.'''
log('Unpacking %s...' % filename)
subprocess.check_call(['tar', 'xf', filename])
basename = filename.split('.tar')[0]
# Work around bad tarball naming in 1.15+ cargo packages.
- basename = basename.replace('cargo-beta', 'cargo-nightly')
basename = re.sub(r'cargo-0\.[\d\.]+', 'cargo-nightly', basename)
log('Installing %s...' % basename)
install_cmd = [os.path.join(basename, 'install.sh')]
install_cmd += ['--prefix=' + os.path.abspath(target)]
install_cmd += ['--disable-ldconfig']
subprocess.check_call(install_cmd)
log('Cleaning %s...' % basename)
subprocess.check_call(['rm', '-rf', basename])
@@ -104,43 +103,57 @@ def tar_for_host(host):
tar_options = 'cJf'
tar_ext = '.tar.xz'
else:
tar_options = 'cjf'
tar_ext = '.tar.bz2'
return tar_options, tar_ext
-def repack(host, targets, channel='stable', suffix=''):
- log("Repacking rust for %s..." % host)
+def fetch_manifest(channel='stable'):
url = 'https://static.rust-lang.org/dist/channel-rust-' + channel + '.toml'
req = requests.get(url)
req.raise_for_status()
manifest = toml.loads(req.content)
if manifest['manifest-version'] != '2':
- log('ERROR: unrecognized manifest version %s.' %
- manifest['manifest-version'])
- return
+ raise NotImplementedError('Unrecognized manifest version %s.' %
+ manifest['manifest-version'])
+ return manifest
+
+
+def repack(host, targets, channel='stable', suffix='', cargo_channel=None):
+ log("Repacking rust for %s..." % host)
+
+ manifest = fetch_manifest(channel)
log('Using manifest for rust %s as of %s.' % (channel, manifest['date']))
+ if cargo_channel == channel:
+ cargo_manifest = manifest
+ else:
+ cargo_manifest = fetch_manifest(cargo_channel)
+ log('Using manifest for cargo %s as of %s.' %
+ (cargo_channel, cargo_manifest['date']))
+
log('Fetching packages...')
rustc = fetch_package(manifest, 'rustc', host)
- cargo = fetch_package(manifest, 'cargo', host)
+ cargo = fetch_package(cargo_manifest, 'cargo', host)
stds = fetch_std(manifest, targets)
+
log('Installing packages...')
tar_basename = 'rustc-' + host
if suffix:
tar_basename += '-' + suffix
tar_basename += '-repack'
install_dir = 'rustc'
subprocess.check_call(['rm', '-rf', install_dir])
install(os.path.basename(rustc['url']), install_dir)
install(os.path.basename(cargo['url']), install_dir)
for std in stds:
install(os.path.basename(std['url']), install_dir)
pass
+
log('Tarring %s...' % tar_basename)
tar_options, tar_ext = tar_for_host(host)
subprocess.check_call(
['tar', tar_options, tar_basename + tar_ext, install_dir])
subprocess.check_call(['rm', '-rf', install_dir])
def repack_cargo(host, channel='nightly'):
@@ -184,37 +197,43 @@ def repack_cargo(host, channel='nightly'
subprocess.check_call(
['tar', tar_options, tar_basename + tar_ext, install_dir])
subprocess.check_call(['rm', '-rf', install_dir])
# rust platform triples
android = "armv7-linux-androideabi"
android_x86 = "i686-linux-android"
+android_aarch64 = "aarch64-linux-android"
linux64 = "x86_64-unknown-linux-gnu"
linux32 = "i686-unknown-linux-gnu"
mac64 = "x86_64-apple-darwin"
mac32 = "i686-apple-darwin"
win64 = "x86_64-pc-windows-msvc"
win32 = "i686-pc-windows-msvc"
def args():
'''Read command line arguments and return options.'''
parser = argparse.ArgumentParser()
- parser.add_argument('--channel', help='Release channel to use: '
- 'stable, beta, or nightly')
+ parser.add_argument('--channel',
+ help='Release channel to use: '
+ 'stable, beta, or nightly',
+ default='stable')
+ parser.add_argument('--cargo-channel',
+ help='Release channel to use for cargo: '
+ 'stable, beta, or nightly.'
+ 'Defaults to the same as --channel.')
args = parser.parse_args()
- if args.channel:
- return args.channel
- else:
- return 'stable'
+ if not args.cargo_channel:
+ args.cargo_channel = args.channel
+ return args
+
if __name__ == '__main__':
- channel = args()
- repack(mac64, [mac64, mac32], channel=channel)
- repack(win32, [win32], channel=channel)
- repack(win64, [win64], channel=channel)
- repack(linux64, [linux64, linux32], channel=channel)
- repack(linux64, [linux64, mac64, mac32],
- channel=channel, suffix='mac-cross')
- repack(linux64, [linux64, android, android_x86],
- channel=channel, suffix='android-cross')
+ args = vars(args())
+ repack(mac64, [mac64], **args)
+ repack(win32, [win32], **args)
+ repack(win64, [win64], **args)
+ repack(linux64, [linux64, linux32], **args)
+ repack(linux64, [linux64, mac64], suffix='mac-cross', **args)
+ repack(linux64, [linux64, android, android_x86, android_aarch64],
+ suffix='android-cross', **args)
--- a/taskcluster/docker/rust-build/splat_rust.py
+++ b/taskcluster/docker/rust-build/splat_rust.py
@@ -53,18 +53,16 @@ def update_manifest(source_manifest, tar
old = load_manifest(target_filename)
replace(old, stanza)
save_manifest(old, target_filename)
break
'''Mapping from targets to target filenames.'''
TARGETS = {
'x86_64-unknown-linux-gnu-repack': [
- 'b2g/dev/config/tooltool-manifests/linux64/hazard.manifest',
- 'b2g/dev/config/tooltool-manifests/linux64/releng.manifest',
'browser/config/tooltool-manifests/linux32/releng.manifest',
'browser/config/tooltool-manifests/linux64/asan.manifest',
'browser/config/tooltool-manifests/linux64/clang.manifest',
'browser/config/tooltool-manifests/linux64/clang.manifest.centos6',
'browser/config/tooltool-manifests/linux64/hazard.manifest',
'browser/config/tooltool-manifests/linux64/msan.manifest',
'browser/config/tooltool-manifests/linux64/releng.manifest',
],