Bug 1649850 - Refactor minimum Rust version into a common place for `bootstrap` and `configure` r=nalexander
authorRicky Stewart <rstewart@mozilla.com>
Thu, 02 Jul 2020 18:05:58 +0000
changeset 538502 6367a90c7cc308a4097979c64ffe1fcb22a2c6fd
parent 538501 edb60b291eab7ebf33ade3e9b267e26b3abeab49
child 538503 f8d39b8ed5dc3fd1252b01352895165a52b20579
push id120620
push userrstewart@mozilla.com
push dateThu, 02 Jul 2020 19:14:27 +0000
treeherderautoland@6367a90c7cc3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander
bugs1649850, 1649039
milestone80.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 1649850 - Refactor minimum Rust version into a common place for `bootstrap` and `configure` r=nalexander The lack of duplication should prevent bugs like bug 1649039 popping up again. Differential Revision: https://phabricator.services.mozilla.com/D82060
build/moz.configure/rust.configure
python/mozboot/mozboot/base.py
python/mozboot/mozboot/util.py
--- a/build/moz.configure/rust.configure
+++ b/build/moz.configure/rust.configure
@@ -129,31 +129,32 @@ def cargo_info(cargo):
         version = m.group(1)
 
     return namespace(
         version=Version(version),
     )
 
 
 @depends(rustc_info, cargo_info, build_project)
+@imports(_from='mozboot.util', _import='MINIMUM_RUST_VERSION')
 @imports(_from='textwrap', _import='dedent')
 def rust_compiler(rustc_info, cargo_info, build_project):
     if not rustc_info:
         die(dedent('''\
         Rust compiler not found.
         To compile rust language sources, you must have 'rustc' in your path.
         See https://www.rust-lang.org/ for more information.
 
         You can install rust by running './mach bootstrap'
         or by directly running the installer from https://rustup.rs/
         '''))
     if build_project == 'tools/crashreporter':
         rustc_min_version = Version('1.31.0')
     else:
-        rustc_min_version = Version('1.43.0')
+        rustc_min_version = Version(MINIMUM_RUST_VERSION)
     cargo_min_version = rustc_min_version
 
     version = rustc_info.version
     if version < rustc_min_version:
         die(dedent('''\
         Rust compiler {} is too old.
 
         To compile Rust language sources please install at least
--- a/python/mozboot/mozboot/base.py
+++ b/python/mozboot/mozboot/base.py
@@ -7,16 +7,17 @@ from __future__ import absolute_import, 
 import hashlib
 import os
 import re
 import subprocess
 import sys
 
 from distutils.version import LooseVersion
 from mozboot import rust
+from mozboot.util import MINIMUM_RUST_VERSION
 
 # NOTE: This script is intended to be run with a vanilla Python install.  We
 # have to rely on the standard library instead of Python 2+3 helpers like
 # the six module.
 if sys.version_info < (3,):
     from urllib2 import urlopen
     input = raw_input  # noqa
 else:
@@ -148,17 +149,17 @@ ac_add_options --enable-artifact-builds
 
 # Upgrade Mercurial older than this.
 MODERN_MERCURIAL_VERSION = LooseVersion('4.8')
 
 # Upgrade Python older than this.
 MODERN_PYTHON_VERSION = LooseVersion('2.7.3')
 
 # Upgrade rust older than this.
-MODERN_RUST_VERSION = LooseVersion('1.43.0')
+MODERN_RUST_VERSION = LooseVersion(MINIMUM_RUST_VERSION)
 
 # Upgrade nasm older than this.
 MODERN_NASM_VERSION = LooseVersion('2.14')
 
 
 class BaseBootstrapper(object):
     """Base class for system bootstrappers."""
 
--- a/python/mozboot/mozboot/util.py
+++ b/python/mozboot/mozboot/util.py
@@ -6,16 +6,19 @@ from __future__ import absolute_import, 
 
 import hashlib
 import os
 
 
 here = os.path.join(os.path.dirname(__file__))
 
 
+MINIMUM_RUST_VERSION = '1.43.0'
+
+
 def get_state_dir(srcdir=False):
     """Obtain path to a directory to hold state.
 
     Args:
         srcdir (bool): If True, return a state dir specific to the current
             srcdir instead of the global state dir (default: False)
 
     Returns: