Skip to content

Commit

Permalink
Merge pull request #48 from dscho/fix-bash-deploy-check
Browse files Browse the repository at this point in the history
missing-deployments: learn about the Bash package's version scheme
  • Loading branch information
dscho authored Nov 12, 2023
2 parents 2be02dc + 1f68e0c commit c456fac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions GitForWindowsHelper/component-updates.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ const getMissingDeployments = async (package_name, version) => {
if (package_name === 'mintty') version = `1~${version}`
// The `openssh` version looks like this: 9.1p1. But the website calls it 9.1_P1
if (package_name === 'openssh') version = version.replace(/[_.]P/, 'p')
// The `bash` version has its patch-level zero-padded to three digits
if (package_name === 'bash') version = version.replace(/\d+$/, n => n.padStart(3, '0'))

const architectures = ['i686', 'x86_64']
if (package_name === 'msys2-runtime') architectures.shift()
Expand Down
4 changes: 3 additions & 1 deletion __tests__/component-updates.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ const missingMinTTYURL = 'https://wingit.blob.core.windows.net/i686/mintty-1~3.6
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
missingURL, missingMinTTYURL, bogus32BitMSYS2RuntimeURL, bogus64BitMSYS2RuntimeURL, missingOpenSSHURL, missingBashURL
].includes(url))
jest.mock('../GitForWindowsHelper/https-request', () => {
return {
Expand Down Expand Up @@ -198,4 +199,5 @@ test('getMissingDeployments()', async () => {
expect(await getMissingDeployments('msys2-runtime', '3.4.9')).toEqual([])
expect(await getMissingDeployments('msys2-runtime-3.3', '3.3.7')).toEqual([])
expect(await getMissingDeployments('openssh', '9.5.P1')).toEqual([missingOpenSSHURL])
expect(await getMissingDeployments('bash', '5.2.20')).toEqual([missingBashURL])
})

0 comments on commit c456fac

Please sign in to comment.