]> git.proxmox.com Git - rustc.git/blame - compiler/rustc_codegen_cranelift/scripts/rustup.sh
New upstream version 1.61.0+dfsg1
[rustc.git] / compiler / rustc_codegen_cranelift / scripts / rustup.sh
CommitLineData
6a06907d 1#!/usr/bin/env bash
29967ef6
XL
2
3set -e
4
5case $1 in
6 "prepare")
7 TOOLCHAIN=$(date +%Y-%m-%d)
8
9 echo "=> Installing new nightly"
fc512014 10 rustup toolchain install --profile minimal "nightly-${TOOLCHAIN}" # Sanity check to see if the nightly exists
cdc7bbd5 11 sed -i "s/\"nightly-.*\"/\"nightly-${TOOLCHAIN}\"/" rust-toolchain
29967ef6
XL
12 rustup component add rustfmt || true
13
5e7ed085 14 echo "=> Uninstalling all old nightlies"
fc512014
XL
15 for nightly in $(rustup toolchain list | grep nightly | grep -v "$TOOLCHAIN" | grep -v nightly-x86_64); do
16 rustup toolchain uninstall "$nightly"
29967ef6
XL
17 done
18
19 ./clean_all.sh
136023e0 20 ./y.rs prepare
29967ef6
XL
21
22 (cd build_sysroot && cargo update)
23
24 ;;
25 "commit")
26 git add rust-toolchain build_sysroot/Cargo.lock
27 git commit -m "Rustup to $(rustc -V)"
28 ;;
29 "push")
fc512014
XL
30 cg_clif=$(pwd)
31 pushd ../rust
32 git pull origin master
33 branch=sync_cg_clif-$(date +%Y-%m-%d)
34 git checkout -b "$branch"
35 git subtree pull --prefix=compiler/rustc_codegen_cranelift/ https://github.com/bjorn3/rustc_codegen_cranelift.git master
36 git push -u my "$branch"
37
38 # immediately merge the merge commit into cg_clif to prevent merge conflicts when syncing
39 # from rust-lang/rust later
40 git subtree push --prefix=compiler/rustc_codegen_cranelift/ "$cg_clif" sync_from_rust
41 popd
42 git merge sync_from_rust
29967ef6 43 ;;
fc512014
XL
44 "pull")
45 cg_clif=$(pwd)
46 pushd ../rust
47 git pull origin master
48 rust_vers="$(git rev-parse HEAD)"
49 git subtree push --prefix=compiler/rustc_codegen_cranelift/ "$cg_clif" sync_from_rust
50 popd
51 git merge sync_from_rust -m "Sync from rust $rust_vers"
52 git branch -d sync_from_rust
53 ;;
29967ef6
XL
54 *)
55 echo "Unknown command '$1'"
56 echo "Usage: ./rustup.sh prepare|commit"
57 ;;
58esac