Bug 1545968 - Update repack_rust.py to include rust stdlib src and analysis data. r=glandium
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 14 May 2019 17:30:55 +0000
changeset 535697 f1ace2853a4c8e42c77eea943f2938147a111118
parent 535696 01fcbba06f1c5a79a6881c4a4378b0bd2476e22e
child 535698 f17162f343b657c6ac2f57937ff49a1840465a6b
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1545968
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1545968 - Update repack_rust.py to include rust stdlib src and analysis data. r=glandium This makes the rust toolchain artifacts contain the rust stdlib as well, for use by searchfox. It does bring up the size of the toolchain artifact slightly - rustc.tar.xz file for the Linux/rust 1.34 job for example goes from 270483672 bytes to 273803148 bytes (1.23% larger) and the equivalent android tarball goes from 230503888 to 235698736 bytes (2.25% larger). Differential Revision: https://phabricator.services.mozilla.com/D28282
taskcluster/scripts/misc/repack_rust.py
--- a/taskcluster/scripts/misc/repack_rust.py
+++ b/taskcluster/scripts/misc/repack_rust.py
@@ -200,17 +200,22 @@ def install(filename, target):
     log('Cleaning %s...' % basename)
     shutil.rmtree(basename)
 
 
 def package(manifest, pkg, target):
     '''Pull out the package dict for a particular package and target
     from the given manifest.'''
     version = manifest['pkg'][pkg]['version']
-    info = manifest['pkg'][pkg]['target'][target]
+    if target in manifest['pkg'][pkg]['target']:
+        info = manifest['pkg'][pkg]['target'][target]
+    else:
+        # rust-src is the same for all targets, and has a literal '*' in the
+        # section key/name instead of a target
+        info = manifest['pkg'][pkg]['target']['*']
     return (version, info)
 
 
 def fetch_package(manifest, pkg, host):
     version, info = package(manifest, pkg, host)
     log('%s %s\n  %s\n  %s' % (pkg, version, info['url'], info['hash']))
     if not info['available']:
         log('%s marked unavailable for %s' % (pkg, host))
@@ -221,18 +226,18 @@ def fetch_package(manifest, pkg, host):
             '\n  %s' % sha)
         raise AssertionError
     return info
 
 
 def fetch_std(manifest, targets):
     stds = []
     for target in targets:
-        info = fetch_package(manifest, 'rust-std', target)
-        stds.append(info)
+        stds.append(fetch_package(manifest, 'rust-std', target))
+        stds.append(fetch_package(manifest, 'rust-analysis', target))
     return stds
 
 
 def fetch_optional(manifest, pkg, host):
     try:
         return fetch_package(manifest, pkg, host)
     except KeyError:
         # The package is not available, oh well!
@@ -273,28 +278,30 @@ def repack(host, targets, channel='stabl
         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(cargo_manifest, 'cargo', host)
     stds = fetch_std(manifest, targets)
+    rustsrc = fetch_package(manifest, 'rust-src', host)
     rustfmt = fetch_optional(manifest, 'rustfmt-preview', host)
 
     log('Installing packages...')
     install_dir = 'rustc'
     # Clear any previous install directory.
     try:
         shutil.rmtree(install_dir)
     except OSError as e:
         if e.errno != errno.ENOENT:
             raise
     install(os.path.basename(rustc['url']), install_dir)
     install(os.path.basename(cargo['url']), install_dir)
+    install(os.path.basename(rustsrc['url']), install_dir)
     if rustfmt:
         install(os.path.basename(rustfmt['url']), install_dir)
     for std in stds:
         install(os.path.basename(std['url']), install_dir)
         pass
 
     log('Creating archive...')
     tar_options, tar_ext = tar_for_host(host)