From 1f68e0c87197323e7584b2ea65f2ff10b2d2a56f Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Sat, 11 Nov 2023 23:13:57 +0100 Subject: [PATCH] missing-deployments: learn about the Bash package's version scheme The patch-level of the Bash package is 0-padded to 3 digits. Signed-off-by: Johannes Schindelin --- GitForWindowsHelper/component-updates.js | 2 ++ __tests__/component-updates.test.js | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/GitForWindowsHelper/component-updates.js b/GitForWindowsHelper/component-updates.js index eec8ba4..1f64709 100644 --- a/GitForWindowsHelper/component-updates.js +++ b/GitForWindowsHelper/component-updates.js @@ -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() diff --git a/__tests__/component-updates.test.js b/__tests__/component-updates.test.js index 1cb97e5..bbaef67 100644 --- a/__tests__/component-updates.test.js +++ b/__tests__/component-updates.test.js @@ -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 { @@ -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]) })