Skip to content
/ rust Public
forked from rust-lang/rust

Commit

Permalink
Rollup merge of rust-lang#125546 - ChrisDenton:mingw-ci, r=Mark-Simul…
Browse files Browse the repository at this point in the history
…acrum

Try to not reinstall tools in mingw CI

Reinstalling the tools seems prone to failure (e.g. [latest](rust-lang#125529 (comment))) and is more work. It also seems unnecessary as CI actually uses a vendored tarball for builds.

cc `@mati865`
  • Loading branch information
jhpratt authored May 26, 2024
2 parents f31540e + 2429e1b commit e459cc4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 38 deletions.
8 changes: 4 additions & 4 deletions src/ci/scripts/install-mingw.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ if isWindows; then
esac

if [[ "${CUSTOM_MINGW:-0}" == 0 ]]; then
pacboy -S --noconfirm toolchain:p
# According to the comment in the Windows part of install-clang.sh, in the future we might
# want to do this instead:
# pacboy -S --noconfirm clang:p ...
pacman -S --noconfirm --needed mingw-w64-$arch-toolchain mingw-w64-$arch-cmake \
mingw-w64-$arch-gcc \
mingw-w64-$arch-python # the python package is actually for python3
ciCommandAddPath "$(ciCheckoutPath)/msys2/mingw${bits}/bin"
else
mingw_dir="mingw${bits}"

Expand Down
36 changes: 2 additions & 34 deletions src/ci/scripts/install-msys2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ IFS=$'\n\t'

source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
if isWindows; then
ciCommandAddPath "c:/msys64/usr/bin"

# Detect the native Python version installed on the agent. On GitHub
# Actions, the C:\hostedtoolcache\windows\Python directory contains a
# subdirectory for each installed Python version.
Expand All @@ -24,38 +26,4 @@ if isWindows; then
fi
ciCommandAddPath "C:\\hostedtoolcache\\windows\\Python\\${native_python_version}\\x64"
ciCommandAddPath "C:\\hostedtoolcache\\windows\\Python\\${native_python_version}\\x64\\Scripts"

# Install pacboy for easily installing packages
pacman -S --noconfirm pactoys

# Remove these pre-installed tools so we can't accidentally use them, because we are using the
# MSYS2 setup action versions instead. Because `rm -r`-ing them is slow, we mv them off path
# instead.
# Remove pre-installed version of MSYS2
echo "Cleaning up existing tools in PATH"
notpath="/c/NOT/ON/PATH/"
mkdir --parents "$notpath"
mv -t "$notpath" "/c/msys64/"
# Remove Strawberry Perl, which contains a version of mingw
mv -t "$notpath" "/c/Strawberry/"
# Remove these other copies of mingw, I don't even know where they come from.
mv -t "$notpath" "/c/mingw64/"
mv -t "$notpath" "/c/mingw32/"
echo "Finished cleaning up tools in PATH"

if isKnownToBeMingwBuild; then
# Use the mingw version of CMake for mingw builds.
# However, the MSVC build needs native CMake, as it fails with the mingw one.
# Delete native CMake
rm -r "/c/Program Files/CMake/"
# Install mingw-w64-$arch-cmake
pacboy -S --noconfirm cmake:p

# It would be nice to use MSYS's git in MinGW builds so that it's tested and known to
# work. But it makes everything extremely slow, so it's commented out for now.
# # Delete Windows-Git
# rm -r "/c/Program Files/Git/"
# # Install MSYS2 git
# pacman -S --noconfirm git
fi
fi

0 comments on commit e459cc4

Please sign in to comment.