diff --git a/GitForWindowsHelper/component-updates.js b/GitForWindowsHelper/component-updates.js index a19cec9..7c5cef5 100644 --- a/GitForWindowsHelper/component-updates.js +++ b/GitForWindowsHelper/component-updates.js @@ -14,7 +14,7 @@ const guessComponentUpdateDetails = (title, body) => { else if (['clang', 'llvm', 'mingw-w64-clang'].includes(package_name)) package_name = 'mingw-w64-llvm' version = version - .replace(/^(GCM |openssl-|OpenSSL_|v|V_|GnuTLS |tig-|Heimdal |cygwin-|PCRE2-|Bash-|curl-|gnupg-|is-)/, '') + .replace(/^(GCM |openssl-|OpenSSL_|v|V_|GnuTLS |tig-|Heimdal |cygwin-|PCRE2-|Bash-|curl-|gnupg-|is-|pcre2-)/, '') .replace(/\s+patch\s+/, '.') .replace(/_/g, '.') .replace(/-release$/, '') @@ -147,7 +147,8 @@ const pacmanRepositoryURLs = (package_name, version, architectures) => architectures.map(arch => { const fileName = isMSYSPackage(package_name) ? `${package_name}-${version}-1-${arch}.pkg.tar.xz` - : `${package_name.replace(/^mingw-w64/, `$&-${arch}`)}-${version}-1-any.pkg.tar.xz` + : `${package_name.replace(/^mingw-w64/, + `$&-${arch === 'aarch64' ? `clang-${arch}` : arch}`)}-${version}-1-any.pkg.tar.xz` return `${pacmanRepositoryBaseURL}${arch.replace(/_/g, '-')}/${fileName}` }) @@ -163,11 +164,14 @@ const getMissingDeployments = async (package_name, version) => { if (package_name === 'msys2-runtime') architectures.shift() else if (package_name === 'msys2-runtime-3.3') architectures.pop() + const mingwArchitectures = [...architectures, 'aarch64'] const urls = [] const msysName = package_name.replace(/^mingw-w64-/, '') if (packageNeedsBothMSYSAndMINGW(msysName)) { urls.push(...pacmanRepositoryURLs(msysName, version, architectures)) - urls.push(...pacmanRepositoryURLs(`mingw-w64-${msysName}`, version, architectures)) + urls.push(...pacmanRepositoryURLs(`mingw-w64-${msysName}`, version, mingwArchitectures)) + } else if (package_name !== msysName) { + urls.push(...pacmanRepositoryURLs(package_name, version, mingwArchitectures)) } else { urls.push(...pacmanRepositoryURLs(package_name, version, architectures)) } diff --git a/__tests__/component-updates.test.js b/__tests__/component-updates.test.js index 3cef8ae..d704695 100644 --- a/__tests__/component-updates.test.js +++ b/__tests__/component-updates.test.js @@ -84,13 +84,20 @@ href="20230616162552.879387-1-corinna-cygwin@cygwin.com/">cygwin 3.4.7-1 [... even more stuff...]` } const missingURL = 'https://wingit.blob.core.windows.net/x86-64/curl-8.1.2-1-x86_64.pkg.tar.xz' +const missingAarch64URL = 'https://wingit.blob.core.windows.net/aarch64/mingw-w64-clang-aarch64-curl-8.1.2-1-any.pkg.tar.xz' const missingMinTTYURL = 'https://wingit.blob.core.windows.net/i686/mintty-1~3.6.5-1-i686.pkg.tar.xz' const bogus32BitMSYS2RuntimeURL = 'https://wingit.blob.core.windows.net/i686/msys2-runtime-3.4.9-1-i686.pkg.tar.xz' const bogus64BitMSYS2RuntimeURL = 'https://wingit.blob.core.windows.net/x86-64/msys2-runtime-3.3-3.3.7-1-x86_64.pkg.tar.xz' const missingOpenSSHURL = 'https://wingit.blob.core.windows.net/i686/openssh-9.5p1-1-i686.pkg.tar.xz' const missingBashURL = 'https://wingit.blob.core.windows.net/x86-64/bash-5.2.020-1-x86_64.pkg.tar.xz' const mockDoesURLReturn404 = jest.fn(url => [ - missingURL, missingMinTTYURL, bogus32BitMSYS2RuntimeURL, bogus64BitMSYS2RuntimeURL, missingOpenSSHURL, missingBashURL + missingURL, + missingAarch64URL, + missingMinTTYURL, + bogus32BitMSYS2RuntimeURL, + bogus64BitMSYS2RuntimeURL, + missingOpenSSHURL, + missingBashURL ].includes(url)) jest.mock('../GitForWindowsHelper/https-request', () => { return { @@ -204,10 +211,20 @@ http://www.gnutls.org/news.html#2023-02-10` package: 'msys2-runtime', version: '3.4.7' }) + expect(await guessReleaseNotes(context, { + labels: [{ name: 'component-update' }], + title: '[New pcre2 version] pcre2-10.45', + body: `\n\nhttps://github.com/PCRE2Project/pcre2/releases/tag/pcre2-10.45` + })).toEqual({ + type: 'feature', + message: 'Comes with [PCRE2 v10.45](https://github.com/PCRE2Project/pcre2/releases/tag/pcre2-10.45).', + package: 'pcre2', + version: '10.45' + }) }) test('getMissingDeployments()', async () => { - expect(await getMissingDeployments('curl', '8.1.2')).toEqual([missingURL]) + expect(await getMissingDeployments('curl', '8.1.2')).toEqual([missingURL, missingAarch64URL]) expect(await getMissingDeployments('mintty', '3.6.5')).toEqual([missingMinTTYURL]) expect(await getMissingDeployments('msys2-runtime', '3.4.9')).toEqual([]) expect(await getMissingDeployments('msys2-runtime-3.3', '3.3.7')).toEqual([]) diff --git a/__tests__/index.test.js b/__tests__/index.test.js index 6fc9e44..07f7b39 100644 --- a/__tests__/index.test.js +++ b/__tests__/index.test.js @@ -737,7 +737,7 @@ The workflow run [was started](dispatched-workflow-add-release-note.yml)`, }) expect(mockGetInstallationAccessToken).toHaveBeenCalledTimes(1) expect(mockGitHubApiRequestAsApp).not.toHaveBeenCalled() - expect(mockDoesURLReturn404).toHaveBeenCalledTimes(4) + expect(mockDoesURLReturn404).toHaveBeenCalledTimes(5) expect(dispatchedWorkflows).toHaveLength(1) expect(dispatchedWorkflows[0].payload.inputs).toEqual({ 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' }, { }) expect(mockGetInstallationAccessToken).toHaveBeenCalledTimes(1) expect(mockGitHubApiRequestAsApp).not.toHaveBeenCalled() - expect(mockDoesURLReturn404).toHaveBeenCalledTimes(2) + expect(mockDoesURLReturn404).toHaveBeenCalledTimes(3) expect(dispatchedWorkflows).toHaveLength(0) })