Skip to content

Commit c701662

Browse files
authored
Merge pull request #24 from git-for-windows/dont-use-system-curl
open-pr: avoid using system curl (because it can't do TLS v1.3)
2 parents 5495428 + e077d68 commit c701662

File tree

2 files changed

+74
-30
lines changed

2 files changed

+74
-30
lines changed

.github/workflows/open-pr.yml

Lines changed: 55 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -74,39 +74,64 @@ jobs:
7474
7575
core.setSecret(accessToken)
7676
core.setOutput('token', accessToken)
77-
- name: set up partial Git for Windows SDK
78-
uses: git-for-windows/setup-git-for-windows-sdk@v1
77+
- name: initialize bare SDK clone
78+
id: clone-g4w-sdk
79+
shell: bash
80+
run: |
81+
git clone --bare --depth=1 --single-branch --branch=main --filter=blob:none \
82+
https://github.com/git-for-windows/git-sdk-64 .tmp &&
83+
echo "rev=$(git -C .tmp rev-parse HEAD)" >>$GITHUB_OUTPUT
84+
- name: restore cached git-sdk-64 subset
85+
id: restore-g4w-sdk
86+
uses: actions/cache/restore@v3
87+
env:
88+
cache-name: cache-g4w-sdk
7989
with:
80-
flavor: minimal
81-
- name: download files necessary for `updpkgsums` to work
90+
path: .sdk
91+
key: g4w-sdk-${{ steps.clone-g4w-sdk.outputs.rev }}
92+
- name: check out git-sdk-64 subset
93+
if: ${{ steps.restore-g4w-sdk.outputs.cache-hit != 'true' }}
8294
shell: bash
95+
env:
96+
GIT_CONFIG_PARAMETERS: "'checkout.workers=56'"
8397
run: |
84-
for p in \
85-
/etc/makepkg.conf \
86-
/usr/bin/gettext.exe \
87-
/usr/bin/makepkg \
88-
/usr/bin/nproc.exe \
89-
/usr/bin/pacman.exe \
90-
/usr/bin/sha256sum.exe \
91-
/usr/bin/updpkgsums
92-
do
93-
curl -sLo $p https://github.com/git-for-windows/git-sdk-64/raw/HEAD$p || exit 1
94-
done &&
95-
for p in /usr/share/makepkg
96-
do
97-
b=${p##*/} &&
98-
d=${p%/$b} &&
99-
if test "z$b" = "z$d"
100-
then
101-
d=
102-
fi &&
103-
tree=$(curl -s https://api.github.com/repos/git-for-windows/git-sdk-64/git/trees/main:${d#/} |
104-
jq -r '.tree[] | select(.path | test("^'$b'$")) | .sha') &&
105-
mkdir -p $p &&
106-
curl -sL https://github.com/git-for-windows/git-sdk-64/tarball/$tree |
107-
tar --strip-components=1 -C $p -xzvf - || exit 1
108-
done &&
109-
ln -s "${COMSPEC%cmd.exe}curl.exe" /usr/bin/
98+
git -C .tmp config extensions.worktreeConfig true &&
99+
git -C .tmp worktree add --no-checkout --detach "$PWD/.sdk" &&
100+
cd .sdk &&
101+
git config --worktree core.sparseCheckout true &&
102+
git config --worktree core.bare false &&
103+
sparse="$(git rev-parse --git-path info/sparse-checkout)" &&
104+
mkdir -p "${sparse%/*}" &&
105+
git show HEAD:.sparse/minimal-sdk >"$sparse" &&
106+
cat >>"$sparse" <<-EOF &&
107+
/etc/makepkg.conf
108+
/usr/bin/gettext.exe
109+
/usr/bin/makepkg
110+
/usr/bin/nproc.exe
111+
/usr/bin/pacman.exe
112+
/usr/bin/sha256sum.exe
113+
/usr/bin/updpkgsums
114+
/usr/share/makepkg/
115+
/mingw64/bin/curl.exe
116+
EOF
117+
git checkout -- &&
118+
119+
# makepkg/updpkgsums expects `curl` to be present in `/usr/bin/`
120+
printf '#!/bin/sh\n\nexec /mingw64/bin/curl.exe "$@"' >usr/bin/curl &&
121+
122+
# add the SDK directories to the `PATH`
123+
cygpath -aw "usr/bin/core_perl" >>$GITHUB_PATH &&
124+
cygpath -aw "usr/bin" >>$GITHUB_PATH &&
125+
cygpath -aw "mingw64/bin" >>$GITHUB_PATH &&
126+
echo "MSYSTEM=MINGW64" >>$GITHUB_ENV
127+
- name: cache git-sdk-64 subset
128+
if: ${{ steps.restore-g4w-sdk.outputs.cache-hit != 'true' }}
129+
uses: actions/cache/save@v3
130+
env:
131+
cache-name: cache-g4w-sdk
132+
with:
133+
path: .sdk
134+
key: g4w-sdk-${{ steps.clone-g4w-sdk.outputs.rev }}
110135
- name: Clone ${{ env.REPO }}
111136
shell: bash
112137
run: |

update-scripts/version/openssh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env node
2+
3+
// The `openssh` version looks like this: 9.1p1. But the website calls it 9.1_P1.
4+
// Let's auto-translate that.
5+
6+
(async () => {
7+
const version = process.argv[2].replace(/_P/, 'p')
8+
9+
const fs = require('fs')
10+
const lines = fs.readFileSync('PKGBUILD').toString('utf-8').split(/\r?\n/)
11+
lines.forEach((line, i) => {
12+
if ((match = line.match(/^(\s*pkgver=)\S+/))) {
13+
lines[i] = `${match[1]}${version}`
14+
} else if ((match = line.match(/^(\s*pkgrel=)\S+/))) {
15+
lines[i] = `${match[1]}1`
16+
}
17+
})
18+
fs.writeFileSync('PKGBUILD', lines.join('\n'))
19+
})().catch(console.log)

0 commit comments

Comments
 (0)