Skip to content

Commit 718574a

Browse files
committed
Support updating to specific dates in rustup.sh
Fixes rust-lang#1294
1 parent 3c5d5ba commit 718574a

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

scripts/rustup.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
set -e
44

5+
TOOLCHAIN=${TOOLCHAIN:-$(date +%Y-%m-%d)}
6+
57
case $1 in
68
"prepare")
7-
TOOLCHAIN=$(date +%Y-%m-%d)
8-
99
echo "=> Installing new nightly"
1010
rustup toolchain install --profile minimal "nightly-${TOOLCHAIN}" # Sanity check to see if the nightly exists
1111
sed -i "s/\"nightly-.*\"/\"nightly-${TOOLCHAIN}\"/" rust-toolchain
@@ -42,13 +42,16 @@ case $1 in
4242
git merge sync_from_rust
4343
;;
4444
"pull")
45+
RUST_VERS=$(curl "https://static.rust-lang.org/dist/$TOOLCHAIN/channel-rust-nightly-git-commit-hash.txt")
46+
echo "Pulling $RUST_VERS ($TOOLCHAIN)"
47+
4548
cg_clif=$(pwd)
4649
pushd ../rust
47-
git pull origin master
48-
rust_vers="$(git rev-parse HEAD)"
50+
git fetch origin master
51+
git checkout "$RUST_VERS"
4952
git subtree push --prefix=compiler/rustc_codegen_cranelift/ "$cg_clif" sync_from_rust
5053
popd
51-
git merge sync_from_rust -m "Sync from rust $rust_vers"
54+
git merge sync_from_rust -m "Sync from rust $RUST_VERS"
5255
git branch -d sync_from_rust
5356
;;
5457
*)

0 commit comments

Comments
 (0)