Skip to content

Commit 1694a2a

Browse files
dennisamelingdscho
authored andcommitted
Update pacman to a patched version that does not deadlock on Windows/ARM64
This downloads the PR build artifact of msys2/MSYS2-packages#4583 and installs it in `git-sdk-arm64`. The idea is that the subsequent `sync` job runs as well as the subsequent `build-and-deploy` runs in `git-for-windows-automation` won't hang but instead succeed. Signed-off-by: Dennis Ameling <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 5afd776 commit 1694a2a

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

.github/workflows/update-pacman.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: update-pacman
2+
3+
on:
4+
push:
5+
branches:
6+
- patched-pacman-gpgme
7+
8+
env:
9+
GIT_CONFIG_PARAMETERS: "'user.name=Git for Windows Build Agent' '[email protected]' 'windows.sdk64.path=${{ github.workspace }}' 'windows.sdk32.path=' 'http.sslbackend=schannel' 'core.autocrlf=false' 'checkout.workers=16'"
10+
HOME: "${{ github.workspace }}\\home\\git-ci"
11+
MSYSTEM: MSYS
12+
13+
jobs:
14+
update-pacman:
15+
if: github.repository_owner == 'git-for-windows'
16+
# We can get away with using x86_64 runners because `pacman.exe` is actually an x86_64 program
17+
runs-on: windows-latest
18+
permissions:
19+
contents: write
20+
steps:
21+
- name: clone git-sdk-arm64
22+
uses: actions/checkout@v4
23+
with:
24+
persist-credentials: true
25+
token: ${{ secrets.PUSH_TOKEN }}
26+
- name: use git-sdk-arm64's Bash and Git for Windows' git.exe
27+
run: "usr\\bin\\bash.exe -lc 'cygpath -aw /usr/bin >>$GITHUB_PATH && cygpath -aw /c/Program\ Files/Git/cmd/ >>$GITHUB_PATH'"
28+
- name: download Pacman package
29+
id: download
30+
shell: bash
31+
env:
32+
GH_TOKEN: ${{ github.token }}
33+
run: |
34+
# Only do this unless `pacman` is already prevented from being upgraded
35+
grep '^ *IgnorePkg *= *pacman' etc/pacman.conf && exit 0
36+
37+
sha="$(gh api repos/msys2/MSYS2-packages/pulls/4583 \
38+
--jq '.head.sha')" &&
39+
check_run_url="$(gh api repos/msys2/MSYS2-packages/commits/$sha/check-runs \
40+
--jq '.check_runs[] | select(.name=="MSYS") | .url')" &&
41+
workflow_job_url="$(gh api "${check_run_url#https://api.github.com/}" --jq '.details_url')" &&
42+
workflow_run_url="${workflow_job_url%/job/*}" &&
43+
artifacts_url="$(gh api "repos/${workflow_run_url#https://github.com/}" --jq '.artifacts_url')" &&
44+
zip_url="$(gh api "${artifacts_url#https://api.github.com/}" --jq '.artifacts[].archive_download_url')" &&
45+
curl -H "Authorization: token ${{secrets.GITHUB_TOKEN}}" -#sLo /tmp/MSYS2-packages.zip "$zip_url" &&
46+
unzip /tmp/MSYS2-packages.zip &&
47+
echo "result=$(echo pacman-*.pkg.tar*)" >>$GITHUB_OUTPUT
48+
- name: install and commit ${{ steps.download.outputs.result }}
49+
if: steps.download.outputs.result != ''
50+
shell: bash
51+
run: |
52+
# Give the `/etc/profile.d/` scripts a chance to set things up
53+
bash -lc 'uname -a' &&
54+
55+
pacman -U --noconfirm '${{ steps.download.outputs.result }}' &&
56+
git add -A &&
57+
git commit -m 'Install ${{ steps.download.outputs.result }}' &&
58+
sed -i 's/^# *\(IgnorePkg *=\).*/\1 pacman/' etc/pacman.conf &&
59+
git commit -m 'Prevent `pacman` from being upgraded' \
60+
-m 'It has been overridden with a version that does not deadlock on Windows/ARM64' \
61+
etc/pacman.conf &&
62+
git push origin HEAD

0 commit comments

Comments
 (0)