Bug 1358590 - Update rust-build to v0.4.5. r=ted draft
authorRalph Giles <giles@mozilla.com>
Fri, 21 Apr 2017 12:03:33 -0700
changeset 566581 801ae508bff7d13355702186f5e08dbe16e390cb
parent 566522 23d6b90be69dcb53e359b6a25068b04a9a843a17
child 625359 799c2eeb9f5b4e09b380941906745be9ed2d5a04
push id55265
push userbmo:giles@thaumas.net
push dateFri, 21 Apr 2017 20:36:33 +0000
reviewersted
bugs1358590
milestone55.0a1
Bug 1358590 - Update rust-build to v0.4.5. r=ted Update the repack_rust script for packaging upsteam rust builds for tooltool use in our build automation: - Add --cargo-channel switch. - Remove 32-bit macOS targets. - Add aarch64 Android target. - Update for cargo tarball name changes. - Remove obsolete b2g target manifests. MozReview-Commit-ID: 2ajGO8jPpWD
taskcluster/docker/rust-build/VERSION
taskcluster/docker/rust-build/repack_rust.py
taskcluster/docker/rust-build/splat_rust.py
--- a/taskcluster/docker/rust-build/VERSION
+++ b/taskcluster/docker/rust-build/VERSION
@@ -1,1 +1,1 @@
-0.4.3
+0.4.5
--- 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',
             ],