Skip to content

Commit 5487d90

Browse files
authored
Merge pull request #125 from dscho/fix-pcre2-relnotes
Fix PCRE2 `/add release note`
2 parents 35cd252 + 8061e70 commit 5487d90

File tree

3 files changed

+28
-7
lines changed

3 files changed

+28
-7
lines changed

GitForWindowsHelper/component-updates.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const guessComponentUpdateDetails = (title, body) => {
1414
else if (['clang', 'llvm', 'mingw-w64-clang'].includes(package_name)) package_name = 'mingw-w64-llvm'
1515

1616
version = version
17-
.replace(/^(GCM |openssl-|OpenSSL_|v|V_|GnuTLS |tig-|Heimdal |cygwin-|PCRE2-|Bash-|curl-|gnupg-|is-)/, '')
17+
.replace(/^(GCM |openssl-|OpenSSL_|v|V_|GnuTLS |tig-|Heimdal |cygwin-|PCRE2-|Bash-|curl-|gnupg-|is-|pcre2-)/, '')
1818
.replace(/\s+patch\s+/, '.')
1919
.replace(/_/g, '.')
2020
.replace(/-release$/, '')
@@ -147,7 +147,8 @@ const pacmanRepositoryURLs = (package_name, version, architectures) =>
147147
architectures.map(arch => {
148148
const fileName = isMSYSPackage(package_name)
149149
? `${package_name}-${version}-1-${arch}.pkg.tar.xz`
150-
: `${package_name.replace(/^mingw-w64/, `$&-${arch}`)}-${version}-1-any.pkg.tar.xz`
150+
: `${package_name.replace(/^mingw-w64/,
151+
`$&-${arch === 'aarch64' ? `clang-${arch}` : arch}`)}-${version}-1-any.pkg.tar.xz`
151152
return `${pacmanRepositoryBaseURL}${arch.replace(/_/g, '-')}/${fileName}`
152153
})
153154

@@ -163,11 +164,14 @@ const getMissingDeployments = async (package_name, version) => {
163164
if (package_name === 'msys2-runtime') architectures.shift()
164165
else if (package_name === 'msys2-runtime-3.3') architectures.pop()
165166

167+
const mingwArchitectures = [...architectures, 'aarch64']
166168
const urls = []
167169
const msysName = package_name.replace(/^mingw-w64-/, '')
168170
if (packageNeedsBothMSYSAndMINGW(msysName)) {
169171
urls.push(...pacmanRepositoryURLs(msysName, version, architectures))
170-
urls.push(...pacmanRepositoryURLs(`mingw-w64-${msysName}`, version, architectures))
172+
urls.push(...pacmanRepositoryURLs(`mingw-w64-${msysName}`, version, mingwArchitectures))
173+
} else if (package_name !== msysName) {
174+
urls.push(...pacmanRepositoryURLs(package_name, version, mingwArchitectures))
171175
} else {
172176
urls.push(...pacmanRepositoryURLs(package_name, version, architectures))
173177
}

__tests__/component-updates.test.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,20 @@ href="[email protected]/">cygwin 3.4.7-1</a></b>
8484
</pre>[... even more stuff...]</body></html>`
8585
}
8686
const missingURL = 'https://wingit.blob.core.windows.net/x86-64/curl-8.1.2-1-x86_64.pkg.tar.xz'
87+
const missingAarch64URL = 'https://wingit.blob.core.windows.net/aarch64/mingw-w64-clang-aarch64-curl-8.1.2-1-any.pkg.tar.xz'
8788
const missingMinTTYURL = 'https://wingit.blob.core.windows.net/i686/mintty-1~3.6.5-1-i686.pkg.tar.xz'
8889
const bogus32BitMSYS2RuntimeURL = 'https://wingit.blob.core.windows.net/i686/msys2-runtime-3.4.9-1-i686.pkg.tar.xz'
8990
const bogus64BitMSYS2RuntimeURL = 'https://wingit.blob.core.windows.net/x86-64/msys2-runtime-3.3-3.3.7-1-x86_64.pkg.tar.xz'
9091
const missingOpenSSHURL = 'https://wingit.blob.core.windows.net/i686/openssh-9.5p1-1-i686.pkg.tar.xz'
9192
const missingBashURL = 'https://wingit.blob.core.windows.net/x86-64/bash-5.2.020-1-x86_64.pkg.tar.xz'
9293
const mockDoesURLReturn404 = jest.fn(url => [
93-
missingURL, missingMinTTYURL, bogus32BitMSYS2RuntimeURL, bogus64BitMSYS2RuntimeURL, missingOpenSSHURL, missingBashURL
94+
missingURL,
95+
missingAarch64URL,
96+
missingMinTTYURL,
97+
bogus32BitMSYS2RuntimeURL,
98+
bogus64BitMSYS2RuntimeURL,
99+
missingOpenSSHURL,
100+
missingBashURL
94101
].includes(url))
95102
jest.mock('../GitForWindowsHelper/https-request', () => {
96103
return {
@@ -204,10 +211,20 @@ http://www.gnutls.org/news.html#2023-02-10`
204211
package: 'msys2-runtime',
205212
version: '3.4.7'
206213
})
214+
expect(await guessReleaseNotes(context, {
215+
labels: [{ name: 'component-update' }],
216+
title: '[New pcre2 version] pcre2-10.45',
217+
body: `\n\nhttps://github.com/PCRE2Project/pcre2/releases/tag/pcre2-10.45`
218+
})).toEqual({
219+
type: 'feature',
220+
message: 'Comes with [PCRE2 v10.45](https://github.com/PCRE2Project/pcre2/releases/tag/pcre2-10.45).',
221+
package: 'pcre2',
222+
version: '10.45'
223+
})
207224
})
208225

209226
test('getMissingDeployments()', async () => {
210-
expect(await getMissingDeployments('curl', '8.1.2')).toEqual([missingURL])
227+
expect(await getMissingDeployments('curl', '8.1.2')).toEqual([missingURL, missingAarch64URL])
211228
expect(await getMissingDeployments('mintty', '3.6.5')).toEqual([missingMinTTYURL])
212229
expect(await getMissingDeployments('msys2-runtime', '3.4.9')).toEqual([])
213230
expect(await getMissingDeployments('msys2-runtime-3.3', '3.3.7')).toEqual([])

__tests__/index.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ The workflow run [was started](dispatched-workflow-add-release-note.yml)`,
737737
})
738738
expect(mockGetInstallationAccessToken).toHaveBeenCalledTimes(1)
739739
expect(mockGitHubApiRequestAsApp).not.toHaveBeenCalled()
740-
expect(mockDoesURLReturn404).toHaveBeenCalledTimes(4)
740+
expect(mockDoesURLReturn404).toHaveBeenCalledTimes(5)
741741
expect(dispatchedWorkflows).toHaveLength(1)
742742
expect(dispatchedWorkflows[0].payload.inputs).toEqual({
743743
message: 'Comes with [GNU TLS v3.8.0](https://lists.gnupg.org/pipermail/gnutls-help/2023-February/004816.html).',
@@ -763,7 +763,7 @@ testIssueComment({ comment: '/add release note', note: 'missing deployment' }, {
763763
})
764764
expect(mockGetInstallationAccessToken).toHaveBeenCalledTimes(1)
765765
expect(mockGitHubApiRequestAsApp).not.toHaveBeenCalled()
766-
expect(mockDoesURLReturn404).toHaveBeenCalledTimes(2)
766+
expect(mockDoesURLReturn404).toHaveBeenCalledTimes(3)
767767
expect(dispatchedWorkflows).toHaveLength(0)
768768
})
769769

0 commit comments

Comments
 (0)