Skip to content

Commit c456fac

Browse files
authored
Merge pull request #48 from dscho/fix-bash-deploy-check
missing-deployments: learn about the Bash package's version scheme
2 parents 2be02dc + 1f68e0c commit c456fac

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

GitForWindowsHelper/component-updates.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ const getMissingDeployments = async (package_name, version) => {
149149
if (package_name === 'mintty') version = `1~${version}`
150150
// The `openssh` version looks like this: 9.1p1. But the website calls it 9.1_P1
151151
if (package_name === 'openssh') version = version.replace(/[_.]P/, 'p')
152+
// The `bash` version has its patch-level zero-padded to three digits
153+
if (package_name === 'bash') version = version.replace(/\d+$/, n => n.padStart(3, '0'))
152154

153155
const architectures = ['i686', 'x86_64']
154156
if (package_name === 'msys2-runtime') architectures.shift()

__tests__/component-updates.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,9 @@ const missingMinTTYURL = 'https://wingit.blob.core.windows.net/i686/mintty-1~3.6
8686
const bogus32BitMSYS2RuntimeURL = 'https://wingit.blob.core.windows.net/i686/msys2-runtime-3.4.9-1-i686.pkg.tar.xz'
8787
const bogus64BitMSYS2RuntimeURL = 'https://wingit.blob.core.windows.net/x86-64/msys2-runtime-3.3-3.3.7-1-x86_64.pkg.tar.xz'
8888
const missingOpenSSHURL = 'https://wingit.blob.core.windows.net/i686/openssh-9.5p1-1-i686.pkg.tar.xz'
89+
const missingBashURL = 'https://wingit.blob.core.windows.net/x86-64/bash-5.2.020-1-x86_64.pkg.tar.xz'
8990
const mockDoesURLReturn404 = jest.fn(url => [
90-
missingURL, missingMinTTYURL, bogus32BitMSYS2RuntimeURL, bogus64BitMSYS2RuntimeURL, missingOpenSSHURL
91+
missingURL, missingMinTTYURL, bogus32BitMSYS2RuntimeURL, bogus64BitMSYS2RuntimeURL, missingOpenSSHURL, missingBashURL
9192
].includes(url))
9293
jest.mock('../GitForWindowsHelper/https-request', () => {
9394
return {
@@ -198,4 +199,5 @@ test('getMissingDeployments()', async () => {
198199
expect(await getMissingDeployments('msys2-runtime', '3.4.9')).toEqual([])
199200
expect(await getMissingDeployments('msys2-runtime-3.3', '3.3.7')).toEqual([])
200201
expect(await getMissingDeployments('openssh', '9.5.P1')).toEqual([missingOpenSSHURL])
202+
expect(await getMissingDeployments('bash', '5.2.20')).toEqual([missingBashURL])
201203
})

0 commit comments

Comments
 (0)