Skip to content

Commit b3ecd48

Browse files
committed
Auto merge of #4733 - lzutao:how-rtim, r=flip1995
build: install RTIM if it doesn't exist and upgrade it if it is in cargo bin home Replace #4731 changelog: none
2 parents 42f32a0 + c38dd2a commit b3ecd48

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

setup-toolchain.sh

+14-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,20 @@ set -e
55

66
cd "$(dirname "$0")"
77

8-
if [[ "$CI" == true ]] || ! command -v rustup-toolchain-install-master > /dev/null; then
9-
cargo install -Z install-upgrade rustup-toolchain-install-master --bin rustup-toolchain-install-master
8+
ERRNO=0
9+
RTIM_PATH=$(command -v rustup-toolchain-install-master) || ERRNO=$?
10+
CARGO_HOME=${CARGO_HOME:-$HOME/.cargo}
11+
12+
# Check if people also install RTIM in other locations beside
13+
# ~/.cargo/bin
14+
if [[ "$ERRNO" -ne 0 ]] || [[ "$RTIM_PATH" == $CARGO_HOME/bin/rustup-toolchain-install-master ]]; then
15+
cargo install -Z install-upgrade rustup-toolchain-install-master
16+
else
17+
VERSION=$(rustup-toolchain-install-master -V | grep -o "[0-9.]*")
18+
REMOTE=$(cargo search rustup-toolchain-install-master | grep -o "[0-9.]*")
19+
echo "info: skipping updating rustup-toolchain-install-master at $RTIM_PATH"
20+
echo " current version : $VERSION"
21+
echo " remote version : $REMOTE"
1022
fi
1123

1224
RUST_COMMIT=$(git ls-remote https://github.com/rust-lang/rust master | awk '{print $1}')

0 commit comments

Comments
 (0)