Skip to content

Commit 30fdb59

Browse files
committed
Merge branch 'update-mingw-w64-git-lfs-checksums'
We needed to redo the update in git-for-windows/build-extra#450 because the first attempt resulted in bogus changes. Signed-off-by: Johannes Schindelin <[email protected]>
2 parents 8dcfb6d + 62b6c2a commit 30fdb59

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

.github/workflows/open-pr.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,13 @@ jobs:
152152
exit 0
153153
fi &&
154154
155-
updpkgsums &&
155+
update_script="$GITHUB_WORKSPACE/update-scripts/$PACKAGE_TO_UPGRADE"
156+
if test -f "$update_script"
157+
then
158+
$update_script "$UPGRADE_TO_VERSION"
159+
else
160+
updpkgsums
161+
fi &&
156162
msg="$PACKAGE_TO_UPGRADE: update to $UPGRADE_TO_VERSION" &&
157163
git commit -sm "$msg" PKGBUILD &&
158164
echo "msg=$msg" >>$GITHUB_OUTPUT &&

update-scripts/mingw-w64-git-lfs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env node
2+
3+
// The `PKGBUILD` file of `mingw-w64-git-lfs` is a bit complicated, as it has
4+
// separate `case` arms for the different architectures.
5+
6+
// Therefore we need to be a bit more careful when updating than just running
7+
// `updpkgsums`.
8+
9+
(async () => {
10+
const version = process.argv[2]
11+
12+
const githubApiRequest = require('../github-api-request')
13+
const { body: releaseNotes } = await githubApiRequest(
14+
console,
15+
null,
16+
'GET',
17+
`/repos/git-lfs/git-lfs/releases/tags/v${version}`
18+
)
19+
20+
const sha256sums = {}
21+
let architecture
22+
let match
23+
for (const line of releaseNotes.split(/\r?\n/)) {
24+
if (line.match(/^[0-9a-f]{64}$/)) sha256sums[architecture] = line
25+
else if ((match = line.match(/git-lfs-windows-(\S+)-v\S+\.zip/))) architecture = match[1]
26+
else architecture = undefined
27+
}
28+
29+
const msys2lfsArchitecture = {
30+
'i686': '386',
31+
'x86_64': 'amd64',
32+
'aarch64': 'arm64',
33+
}
34+
35+
const fs = require('fs')
36+
const lines = fs.readFileSync('PKGBUILD').toString('utf-8').split(/\r?\n/)
37+
lines.forEach((line, i) => {
38+
if ((match = line.match(/^(\S+)\)$/))) {
39+
architecture = msys2lfsArchitecture[match[1]]
40+
} else if ((match = line.match(/^(\s*sha256sum=)[0-9a-f]{64}$/))) {
41+
lines[i] = `${match[1]}${sha256sums[architecture]}`
42+
}
43+
})
44+
fs.writeFileSync('PKGBUILD', lines.join('\n'))
45+
})().catch(console.log)

0 commit comments

Comments
 (0)