Skip to content

Commit

Permalink
Support updating to specific dates in rustup.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Feb 17, 2023
1 parent 3c5d5ba commit 718574a
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions scripts/rustup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
;;
*)
Expand Down

0 comments on commit 718574a

Please sign in to comment.