about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2023-02-17 18:55:51 +0100
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2023-02-17 18:55:51 +0100
commit718574a53e1262c7370106ec606c8fabe0fb6a23 (patch)
tree1ef9bdd9edffcb1b8e563a775dcdfc1c2c84b9fa
parent3c5d5bab967c2ce5e05dac7c30543a8a0c5abd43 (diff)
downloadrust-718574a53e1262c7370106ec606c8fabe0fb6a23.tar.gz
rust-718574a53e1262c7370106ec606c8fabe0fb6a23.zip
Support updating to specific dates in rustup.sh
Fixes #1294
-rwxr-xr-xscripts/rustup.sh13
1 files changed, 8 insertions, 5 deletions
diff --git a/scripts/rustup.sh b/scripts/rustup.sh
index 34e3981b538..75219c82e82 100755
--- a/scripts/rustup.sh
+++ b/scripts/rustup.sh
@@ -2,10 +2,10 @@
 
 set -e
 
+TOOLCHAIN=${TOOLCHAIN:-$(date +%Y-%m-%d)}
+
 case $1 in
     "prepare")
-        TOOLCHAIN=$(date +%Y-%m-%d)
-
         echo "=> Installing new nightly"
         rustup toolchain install --profile minimal "nightly-${TOOLCHAIN}" # Sanity check to see if the nightly exists
         sed -i "s/\"nightly-.*\"/\"nightly-${TOOLCHAIN}\"/" rust-toolchain
@@ -42,13 +42,16 @@ case $1 in
         git merge sync_from_rust
 	;;
     "pull")
+        RUST_VERS=$(curl "https://static.rust-lang.org/dist/$TOOLCHAIN/channel-rust-nightly-git-commit-hash.txt")
+        echo "Pulling $RUST_VERS ($TOOLCHAIN)"
+
         cg_clif=$(pwd)
         pushd ../rust
-        git pull origin master
-        rust_vers="$(git rev-parse HEAD)"
+        git fetch origin master
+        git checkout "$RUST_VERS"
         git subtree push --prefix=compiler/rustc_codegen_cranelift/ "$cg_clif" sync_from_rust
         popd
-        git merge sync_from_rust -m "Sync from rust $rust_vers"
+        git merge sync_from_rust -m "Sync from rust $RUST_VERS"
         git branch -d sync_from_rust
         ;;
     *)