Skip to content

Commit 91b6f15

Browse files
committed
Use preinstalled MSYS2
1 parent feb3536 commit 91b6f15

File tree

5 files changed

+20
-59
lines changed

5 files changed

+20
-59
lines changed

.github/workflows/ci.yml

-9
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,6 @@ jobs:
102102
- name: install MSYS2
103103
run: src/ci/scripts/install-msys2.sh
104104
if: success() && !env.SKIP_JOB
105-
- name: install MSYS2 packages
106-
run: src/ci/scripts/install-msys2-packages.sh
107-
if: success() && !env.SKIP_JOB
108105
- name: install MinGW
109106
run: src/ci/scripts/install-mingw.sh
110107
if: success() && !env.SKIP_JOB
@@ -212,9 +209,6 @@ jobs:
212209
- name: install MSYS2
213210
run: src/ci/scripts/install-msys2.sh
214211
if: success() && !env.SKIP_JOB
215-
- name: install MSYS2 packages
216-
run: src/ci/scripts/install-msys2-packages.sh
217-
if: success() && !env.SKIP_JOB
218212
- name: install MinGW
219213
run: src/ci/scripts/install-mingw.sh
220214
if: success() && !env.SKIP_JOB
@@ -564,9 +558,6 @@ jobs:
564558
- name: install MSYS2
565559
run: src/ci/scripts/install-msys2.sh
566560
if: success() && !env.SKIP_JOB
567-
- name: install MSYS2 packages
568-
run: src/ci/scripts/install-msys2-packages.sh
569-
if: success() && !env.SKIP_JOB
570561
- name: install MinGW
571562
run: src/ci/scripts/install-mingw.sh
572563
if: success() && !env.SKIP_JOB

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

-4
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,6 @@ steps:
8282
displayName: Install msys2
8383
condition: and(succeeded(), not(variables.SKIP_JOB))
8484

85-
- bash: src/ci/scripts/install-msys2-packages.sh
86-
displayName: Install msys2 packages
87-
condition: and(succeeded(), not(variables.SKIP_JOB))
88-
8985
- bash: src/ci/scripts/install-mingw.sh
9086
displayName: Install MinGW
9187
condition: and(succeeded(), not(variables.SKIP_JOB))

src/ci/github-actions/ci.yml

-4
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,6 @@ x--expand-yaml-anchors--remove:
147147
run: src/ci/scripts/install-msys2.sh
148148
<<: *step
149149

150-
- name: install MSYS2 packages
151-
run: src/ci/scripts/install-msys2-packages.sh
152-
<<: *step
153-
154150
- name: install MinGW
155151
run: src/ci/scripts/install-mingw.sh
156152
<<: *step

src/ci/scripts/install-msys2-packages.sh

-27
This file was deleted.

src/ci/scripts/install-msys2.sh

+20-15
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,33 @@
11
#!/bin/bash
22
# Download and install MSYS2, needed primarily for the test suite (run-make) but
33
# 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.
84

95
set -euo pipefail
106
IFS=$'\n\t'
117

128
source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
139

1410
if isWindows; then
15-
# Pre-followed the api/v2 URL to the CDN since the API can be a bit flakey
16-
curl -sSL https://packages.chocolatey.org/msys2.20190524.0.0.20191030.nupkg > \
17-
msys2.nupkg
18-
curl -sSL https://packages.chocolatey.org/chocolatey-core.extension.1.3.5.1.nupkg > \
19-
chocolatey-core.extension.nupkg
20-
choco install -s . msys2 \
21-
--params="/InstallDir:$(ciCheckoutPath)/msys2 /NoPath" -y --no-progress
22-
rm msys2.nupkg chocolatey-core.extension.nupkg
23-
mkdir -p "$(ciCheckoutPath)/msys2/home/${USERNAME}"
24-
ciCommandAddPath "$(ciCheckoutPath)/msys2/usr/bin"
11+
msys2Path="c:/msys64"
12+
mkdir -p "${msys2Path}/home/${USERNAME}"
13+
ciCommandAddPath "${msys2Path}/usr/bin"
2514

2615
echo "switching shell to use our own bash"
27-
ciCommandSetEnv CI_OVERRIDE_SHELL "$(ciCheckoutPath)/msys2/usr/bin/bash.exe"
16+
ciCommandSetEnv CI_OVERRIDE_SHELL "${msys2Path}/usr/bin/bash.exe"
17+
18+
# Detect the native Python version installed on the agent. On GitHub
19+
# Actions, the C:\hostedtoolcache\windows\Python directory contains a
20+
# subdirectory for each installed Python version.
21+
#
22+
# The -V flag of the sort command sorts the input by version number.
23+
native_python_version="$(ls /c/hostedtoolcache/windows/Python | sort -Vr | head -n 1)"
24+
25+
# Make sure we use the native python interpreter instead of some msys equivalent
26+
# one way or another. The msys interpreters seem to have weird path conversions
27+
# baked in which break LLVM's build system one way or another, so let's use the
28+
# native version which keeps everything as native as possible.
29+
python_home="/c/hostedtoolcache/windows/Python/${native_python_version}/x64"
30+
cp "${python_home}/python.exe" "${python_home}/python3.exe"
31+
ciCommandAddPath "C:\\hostedtoolcache\\windows\\Python\\${native_python_version}\\x64"
32+
ciCommandAddPath "C:\\hostedtoolcache\\windows\\Python\\${native_python_version}\\x64\\Scripts"
2833
fi

0 commit comments

Comments
 (0)