Skip to content

Commit 9ad1e7c

Browse files
committed
Auto merge of #64553 - alexcrichton:windows-bash-install-scripts, r=Mark-Simulacrum
azure: Convert Windows installations scripts to `bash` Looks like `script`, which uses `cmd.exe`, doesn't have fail-fast behavior and if a leading command fails the script doesn't actually fail so long as the last command succeeds. We instead want the opposite behavior where if any step fails the whole script fails. I don't really know `cmd.exe` that well, nor powershell, so I've opted to move everything to `bash` which should be a good common denominator amongst all platforms to work with. Additionally I know that `set -e` works to cause scripts to fail fast. Closes #64551
2 parents 7225264 + 72ea960 commit 9ad1e7c

File tree

1 file changed

+39
-38
lines changed

1 file changed

+39
-38
lines changed

src/ci/azure-pipelines/steps/install-windows-build-deps.yml

+39-38
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ steps:
1818
# one is MSI installers and one is EXE, but they're not used so frequently at
1919
# this point anyway so perhaps it's a wash!
2020
- script: |
21-
powershell -Command "$ProgressPreference = 'SilentlyContinue'; iwr -outf is-install.exe https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc/2017-08-22-is.exe"
22-
is-install.exe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-
2321
echo ##vso[task.prependpath]C:\Program Files (x86)\Inno Setup 5
22+
curl.exe -o is-install.exe https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc/2017-08-22-is.exe
23+
is-install.exe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-
2424
displayName: Install InnoSetup
2525
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
2626

@@ -43,24 +43,18 @@ steps:
4343
# FIXME: we should probe the default azure image and see if we can use the MSYS2
4444
# toolchain there. (if there's even one there). For now though this gets the job
4545
# done.
46-
- script: |
47-
set MSYS_PATH=%CD%\citools\msys64
48-
choco install msys2 --params="/InstallDir:%MSYS_PATH% /NoPath" -y
49-
set PATH=%MSYS_PATH%\usr\bin;%PATH%
50-
pacman -S --noconfirm --needed base-devel ca-certificates make diffutils tar
51-
IF "%MINGW_URL%"=="" (
52-
IF "%MSYS_BITS%"=="32" pacman -S --noconfirm --needed mingw-w64-i686-toolchain mingw-w64-i686-cmake mingw-w64-i686-gcc mingw-w64-i686-python2
53-
IF "%MSYS_BITS%"=="64" pacman -S --noconfirm --needed mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake mingw-w64-x86_64-gcc mingw-w64-x86_64-python2
54-
)
55-
where rev
56-
rev --help
57-
where make
58-
59-
echo ##vso[task.setvariable variable=MSYS_PATH]%MSYS_PATH%
60-
echo ##vso[task.prependpath]%MSYS_PATH%\usr\bin
46+
- bash: |
47+
set -e
48+
choco install msys2 --params="/InstallDir:$(System.Workfolder)/msys2 /NoPath" -y --no-progress
49+
echo "##vso[task.prependpath]$(System.Workfolder)/msys2/usr/bin"
50+
mkdir -p "$(System.Workfolder)/msys2/home/$USERNAME"
6151
displayName: Install msys2
6252
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
6353

54+
- bash: pacman -S --noconfirm --needed base-devel ca-certificates make diffutils tar
55+
displayName: Install msys2 base deps
56+
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
57+
6458
# If we need to download a custom MinGW, do so here and set the path
6559
# appropriately.
6660
#
@@ -81,39 +75,46 @@ steps:
8175
#
8276
# Note that we don't literally overwrite the gdb.exe binary because it appears
8377
# to just use gdborig.exe, so that's the binary we deal with instead.
84-
- script: |
85-
powershell -Command "$ProgressPreference = 'SilentlyContinue'; iwr -outf %MINGW_ARCHIVE% %MINGW_URL%/%MINGW_ARCHIVE%"
86-
7z x -y %MINGW_ARCHIVE% > nul
87-
powershell -Command "$ProgressPreference = 'SilentlyContinue'; iwr -outf 2017-04-20-%MSYS_BITS%bit-gdborig.exe %MINGW_URL%/2017-04-20-%MSYS_BITS%bit-gdborig.exe"
88-
mv 2017-04-20-%MSYS_BITS%bit-gdborig.exe %MINGW_DIR%\bin\gdborig.exe
89-
echo ##vso[task.prependpath]%CD%\%MINGW_DIR%\bin
78+
- bash: |
79+
set -e
80+
curl -o mingw.7z $MINGW_URL/$MINGW_ARCHIVE
81+
7z x -y mingw.7z > /dev/null
82+
curl -o $MINGW_DIR/bin/gdborig.exe $MINGW_URL/2017-04-20-${MSYS_BITS}bit-gdborig.exe
83+
echo "##vso[task.prependpath]`pwd`/$MINGW_DIR/bin"
9084
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'), ne(variables['MINGW_URL'],''))
9185
displayName: Download custom MinGW
9286

93-
# Otherwise pull in the MinGW installed on appveyor
94-
- script: |
95-
echo ##vso[task.prependpath]%MSYS_PATH%\mingw%MSYS_BITS%\bin
87+
# Otherwise install MinGW through `pacman`
88+
- bash: |
89+
set -e
90+
arch=i686
91+
if [ "$MSYS_BITS" = "64" ]; then
92+
arch=x86_64
93+
fi
94+
pacman -S --noconfirm --needed mingw-w64-$arch-toolchain mingw-w64-$arch-cmake mingw-w64-$arch-gcc mingw-w64-$arch-python2
95+
echo "##vso[task.prependpath]$(System.Workfolder)/msys2/mingw$MSYS_BITS/bin"
9696
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['MINGW_URL'],''))
97-
displayName: Add MinGW to path
97+
displayName: Download standard MinGW
9898

9999
# Make sure we use the native python interpreter instead of some msys equivalent
100100
# one way or another. The msys interpreters seem to have weird path conversions
101101
# baked in which break LLVM's build system one way or another, so let's use the
102102
# native version which keeps everything as native as possible.
103-
- script: |
104-
copy C:\Python27amd64\python.exe C:\Python27amd64\python2.7.exe
105-
echo ##vso[task.prependpath]C:\Python27amd64
103+
- bash: |
104+
set -e
105+
cp C:/Python27amd64/python.exe C:/Python27amd64/python2.7.exe
106+
echo "##vso[task.prependpath]C:/Python27amd64"
106107
displayName: Prefer the "native" Python as LLVM has trouble building with MSYS sometimes
107108
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
108109

109110
# Note that this is originally from the github releases patch of Ninja
110-
- script: |
111-
md ninja
112-
powershell -Command "$ProgressPreference = 'SilentlyContinue'; iwr -outf 2017-03-15-ninja-win.zip https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc/2017-03-15-ninja-win.zip"
113-
7z x -oninja 2017-03-15-ninja-win.zip
114-
del 2017-03-15-ninja-win.zip
115-
set RUST_CONFIGURE_ARGS=%RUST_CONFIGURE_ARGS% --enable-ninja
116-
echo ##vso[task.setvariable variable=RUST_CONFIGURE_ARGS]%RUST_CONFIGURE_ARGS%
117-
echo ##vso[task.prependpath]%CD%\ninja
111+
- bash: |
112+
set -e
113+
mkdir ninja
114+
curl -o ninja.zip https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc/2017-03-15-ninja-win.zip
115+
7z x -oninja ninja.zip
116+
rm ninja.zip
117+
echo "##vso[task.setvariable variable=RUST_CONFIGURE_ARGS]$RUST_CONFIGURE_ARGS --enable-ninja"
118+
echo "##vso[task.prependpath]`pwd`/ninja"
118119
displayName: Download and install ninja
119120
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))

0 commit comments

Comments
 (0)