Skip to content

Commit a0b37b0

Browse files
committed
ci: extract installing msys2 into a script
1 parent c82b87d commit a0b37b0

File tree

3 files changed

+36
-29
lines changed

3 files changed

+36
-29
lines changed

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

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,4 @@
11
steps:
2-
# Download and install MSYS2, needed primarily for the test suite (run-make) but
3-
# also used by the MinGW toolchain for assembling things.
4-
#
5-
# FIXME: we should probe the default azure image and see if we can use the MSYS2
6-
# toolchain there. (if there's even one there). For now though this gets the job
7-
# done.
8-
- bash: |
9-
set -e
10-
choco install msys2 --params="/InstallDir:$(System.Workfolder)/msys2 /NoPath" -y --no-progress
11-
echo "##vso[task.prependpath]$(System.Workfolder)/msys2/usr/bin"
12-
mkdir -p "$(System.Workfolder)/msys2/home/$USERNAME"
13-
displayName: Install msys2
14-
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
15-
16-
- bash: pacman -S --noconfirm --needed base-devel ca-certificates make diffutils tar
17-
displayName: Install msys2 base deps
18-
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
19-
202
# If we need to download a custom MinGW, do so here and set the path
213
# appropriately.
224
#
@@ -58,17 +40,6 @@ steps:
5840
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['MINGW_URL'],''))
5941
displayName: Download standard MinGW
6042

61-
# Make sure we use the native python interpreter instead of some msys equivalent
62-
# one way or another. The msys interpreters seem to have weird path conversions
63-
# baked in which break LLVM's build system one way or another, so let's use the
64-
# native version which keeps everything as native as possible.
65-
- bash: |
66-
set -e
67-
cp C:/Python27amd64/python.exe C:/Python27amd64/python2.7.exe
68-
echo "##vso[task.prependpath]C:/Python27amd64"
69-
displayName: Prefer the "native" Python as LLVM has trouble building with MSYS sometimes
70-
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
71-
7243
# Note that this is originally from the github releases patch of Ninja
7344
- bash: |
7445
set -e

src/ci/azure-pipelines/steps/run.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ steps:
9191
displayName: "Disable git automatic line ending conversion (on C:/)"
9292
condition: and(succeeded(), not(variables.SKIP_JOB))
9393

94+
- bash: src/ci/scripts/install-msys2.sh
95+
env:
96+
AGENT_OS: $(Agent.OS)
97+
SYSTEM_WORKFOLDER: $(System.Workfolder)
98+
displayName: Install msys2
99+
condition: and(succeeded(), not(variables.SKIP_JOB))
100+
94101
- template: install-windows-build-deps.yml
95102

96103
# Looks like docker containers have IPv6 disabled by default, so let's turn it

src/ci/scripts/install-msys2.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
# Download and install MSYS2, needed primarily for the test suite (run-make) but
3+
# also used by the MinGW toolchain for assembling things.
4+
#
5+
# FIXME: we should probe the default azure image and see if we can use the MSYS2
6+
# toolchain there. (if there's even one there). For now though this gets the job
7+
# done.
8+
9+
set -euo pipefail
10+
IFS=$'\n\t'
11+
12+
source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
13+
14+
if isWindows; then
15+
choco install msys2 --params="/InstallDir:${SYSTEM_WORKFOLDER}/msys2 /NoPath" -y --no-progress
16+
mkdir -p "${SYSTEM_WORKFOLDER}/msys2/home/${USERNAME}"
17+
18+
ciCommandAddPath "${SYSTEM_WORKFOLDER}/msys2/usr/bin"
19+
export PATH="${SYSTEM_WORKFOLDER}/msys2/usr/bin"
20+
21+
pacman -S --noconfirm --needed base-devel ca-certificates make diffutils tar
22+
23+
# Make sure we use the native python interpreter instead of some msys equivalent
24+
# one way or another. The msys interpreters seem to have weird path conversions
25+
# baked in which break LLVM's build system one way or another, so let's use the
26+
# native version which keeps everything as native as possible.
27+
cp C:/Python27amd64/python.exe C:/Python27amd64/python2.7.exe
28+
ciCommandAddPath "C:\\Python27amd64"
29+
fi

0 commit comments

Comments
 (0)