Patchwork D6715: automation: install Rust in Linux environment

login
register
mail settings
Submitter phabricator
Date Aug. 4, 2019, 4:52 p.m.
Message ID <differential-rev-PHID-DREV-vlcllffe7utqurphcf2w-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/41143/
State Superseded
Headers show

Comments

phabricator - Aug. 4, 2019, 4:52 p.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This will install Rust 1.31.1, 1.34.2, and whatever stable is at
  the time the install runs. We install 1.31.1 as our minimum supported
  Rust version (I think that's what we're currently targeting) and
  1.34 because that's what Debian 10 is shipping.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6715

AFFECTED FILES
  contrib/automation/hgautomation/linux.py

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/contrib/automation/hgautomation/linux.py b/contrib/automation/hgautomation/linux.py
--- a/contrib/automation/hgautomation/linux.py
+++ b/contrib/automation/hgautomation/linux.py
@@ -65,6 +65,18 @@ 
 '''.lstrip().replace('\r\n', '\n')
 
 
+INSTALL_RUST = r'''
+RUSTUP_INIT_SHA256=a46fe67199b7bcbbde2dcbc23ae08db6f29883e260e23899a88b9073effc9076
+wget -O rustup-init --progress dot:mega https://static.rust-lang.org/rustup/archive/1.18.3/x86_64-unknown-linux-gnu/rustup-init
+echo "${RUSTUP_INIT_SHA256} rustup-init" | sha256sum --check -
+
+chmod +x rustup-init
+sudo -H -u hg -g hg ./rustup-init -y
+sudo -H -u hg -g hg /home/hg/.cargo/bin/rustup install 1.31.1 1.34.2
+sudo -H -u hg -g hg /home/hg/.cargo/bin/rustup component add clippy
+'''
+
+
 BOOTSTRAP_VIRTUALENV = r'''
 /usr/bin/virtualenv /hgdev/venv-bootstrap
 
@@ -286,6 +298,8 @@ 
 # Will be normalized to hg:hg later.
 sudo chown `whoami` /hgdev
 
+{install_rust}
+
 cp requirements-py2.txt /hgdev/requirements-py2.txt
 cp requirements-py3.txt /hgdev/requirements-py3.txt
 
@@ -309,6 +323,7 @@ 
 
 sudo chown -R hg:hg /hgdev
 '''.lstrip().format(
+    install_rust=INSTALL_RUST,
     install_pythons=INSTALL_PYTHONS,
     bootstrap_virtualenv=BOOTSTRAP_VIRTUALENV
 ).replace('\r\n', '\n')