Skip to content

Commit

Permalink
Auto merge of #4733 - lzutao:how-rtim, r=flip1995
Browse files Browse the repository at this point in the history
build: install RTIM if it doesn't exist and upgrade it if it is in cargo bin home

Replace #4731
changelog: none
  • Loading branch information
bors committed Oct 25, 2019
2 parents 42f32a0 + c38dd2a commit b3ecd48
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions setup-toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,20 @@ set -e

cd "$(dirname "$0")"

if [[ "$CI" == true ]] || ! command -v rustup-toolchain-install-master > /dev/null; then
cargo install -Z install-upgrade rustup-toolchain-install-master --bin rustup-toolchain-install-master
ERRNO=0
RTIM_PATH=$(command -v rustup-toolchain-install-master) || ERRNO=$?
CARGO_HOME=${CARGO_HOME:-$HOME/.cargo}

# Check if people also install RTIM in other locations beside
# ~/.cargo/bin
if [[ "$ERRNO" -ne 0 ]] || [[ "$RTIM_PATH" == $CARGO_HOME/bin/rustup-toolchain-install-master ]]; then
cargo install -Z install-upgrade rustup-toolchain-install-master
else
VERSION=$(rustup-toolchain-install-master -V | grep -o "[0-9.]*")
REMOTE=$(cargo search rustup-toolchain-install-master | grep -o "[0-9.]*")
echo "info: skipping updating rustup-toolchain-install-master at $RTIM_PATH"
echo " current version : $VERSION"
echo " remote version : $REMOTE"
fi

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

0 comments on commit b3ecd48

Please sign in to comment.