Skip to content

Commit d622e0d

Browse files
committed
guessReleaseNotes(msys2-runtime): look harder for Cygwin's release notes
Cygwin's release notes link on their home page is sometimes not updated immediately after a new version has been made available. In the past, i.e. before Git for Windows built and deployed MSYS2 runtime versions via GitHub Actions, there was a fall-back to look for that link directly in the mailing list archives. In the meantime, Cygwin offers access to their mailing list archive via a public-inbox system, which makes the search even nicer. So let's do this, add a fall-back to look for the release notes directly on the mailing list. This corresponds to the code at https://github.com/git-for-windows/build-extra/blob/356779ddb189/please.sh#L1731-L1735 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 72733bf commit d622e0d

2 files changed

Lines changed: 29 additions & 1 deletion

File tree

GitForWindowsHelper/component-updates.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ const guessCygwinReleaseNotesURL = async (version) => {
6161
const match = html.match(new RegExp(`The most recent version of the Cygwin DLL is[^]*?<a href=['"]?([^"' ]*)[^>]*>${version}</a>`))
6262
if (match) return match[1]
6363

64+
// Sometimes Cygwin updates the home page a bit later than we'd want, let's
65+
// find the announcement on the mailing list directly in that case:
66+
const inboxPrefix = 'https://inbox.sourceware.org/cygwin-announce/'
67+
const search = await fetchHTML(`${inboxPrefix}?q=cygwin-${version}`)
68+
const searchMatch = search.match(new RegExp(`<a\\b(?:[^>]*)\\shref=['"]?([^'" ]+)[^>]*>cygwin ${version}-1</a>`))
69+
if (searchMatch) return `${inboxPrefix}${searchMatch[1]}`
70+
6471
throw new Error(`Could not determine Cygwin Release Notes URL for version ${version}`)
6572
}
6673

__tests__/component-updates.test.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,17 @@ const mockFetchHTML = {
6969
The Cygwin DLL currently works with all recent, commercially released
7070
x86_64 versions of Windows, starting with Windows 7.
7171
</p>
72-
</div>`
72+
</div>`,
73+
'https://inbox.sourceware.org/cygwin-announce/?q=cygwin-3.4.7': `<html><head><title>cygwin-3.4.7 - search results</title>[... plenty of stuff...]
74+
<pre>1. <b><a
75+
href="875y7c63s1.fsf@Rainer.invalid/">Re-Released: tar-1.34-2</a></b>
76+
- by ASSI @ 2023-06-24 19:47 UTC [4%]
77+
78+
2. <b><a
79+
href="20230616162552.879387-1-corinna-cygwin@cygwin.com/">cygwin 3.4.7-1</a></b>
80+
- by Corinna Vinschen @ 2023-06-16 14:25 UTC [14%]
81+
82+
</pre>[... even more stuff...]</body></html>`
7383
}
7484
const missingURL = 'https://wingit.blob.core.windows.net/x86-64/curl-8.1.2-1-x86_64.pkg.tar.xz'
7585
const missingMinTTYURL = 'https://wingit.blob.core.windows.net/i686/mintty-1~3.6.5-1-i686.pkg.tar.xz'
@@ -168,6 +178,17 @@ http://www.gnutls.org/news.html#2023-02-10`
168178
package: 'msys2-runtime',
169179
version: '3.4.9'
170180
})
181+
182+
expect(await guessReleaseNotes(context, {
183+
labels: [{ name: 'component-update' }],
184+
title: '[New cygwin version] cygwin-3.4.7',
185+
body: `\nCygwin 3.4.7 release\n\nhttps://github.com/cygwin/cygwin/releases/tag/cygwin-3.4.7`
186+
})).toEqual({
187+
type: 'feature',
188+
message: 'Comes with the MSYS2 runtime (Git for Windows flavor) based on [Cygwin v3.4.7](https://inbox.sourceware.org/cygwin-announce/20230616162552.879387-1-corinna-cygwin@cygwin.com/).',
189+
package: 'msys2-runtime',
190+
version: '3.4.7'
191+
})
171192
})
172193

173194
test('getMissingDeployments()', async () => {

0 commit comments

Comments
 (0)