Skip to content

Commit 7b317ea

Browse files
authored
Merge pull request #45 from dscho/fix-openssh-already-deployed-check
missing-deployments: learn to handle OpenSSH's version number
2 parents 274da36 + 8400c7e commit 7b317ea

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

GitForWindowsHelper/component-updates.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ const pacmanRepositoryURLs = (package_name, version, architectures) =>
147147
const getMissingDeployments = async (package_name, version) => {
148148
// MinTTY is at epoch 1, which is part of Pacman's versioning scheme
149149
if (package_name === 'mintty') version = `1~${version}`
150+
// The `openssh` version looks like this: 9.1p1. But the website calls it 9.1_P1
151+
if (package_name === 'openssh') version = version.replace(/[_.]P/, 'p')
152+
150153
const architectures = ['i686', 'x86_64']
151154
if (package_name === 'msys2-runtime') architectures.shift()
152155
else if (package_name === 'msys2-runtime-3.3') architectures.pop()

__tests__/component-updates.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ const missingURL = 'https://wingit.blob.core.windows.net/x86-64/curl-8.1.2-1-x86
8585
const missingMinTTYURL = 'https://wingit.blob.core.windows.net/i686/mintty-1~3.6.5-1-i686.pkg.tar.xz'
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'
88+
const missingOpenSSHURL = 'https://wingit.blob.core.windows.net/i686/openssh-9.5p1-1-i686.pkg.tar.xz'
8889
const mockDoesURLReturn404 = jest.fn(url => [
89-
missingURL, missingMinTTYURL, bogus32BitMSYS2RuntimeURL, bogus64BitMSYS2RuntimeURL
90+
missingURL, missingMinTTYURL, bogus32BitMSYS2RuntimeURL, bogus64BitMSYS2RuntimeURL, missingOpenSSHURL
9091
].includes(url))
9192
jest.mock('../GitForWindowsHelper/https-request', () => {
9293
return {
@@ -196,4 +197,5 @@ test('getMissingDeployments()', async () => {
196197
expect(await getMissingDeployments('mintty', '3.6.5')).toEqual([missingMinTTYURL])
197198
expect(await getMissingDeployments('msys2-runtime', '3.4.9')).toEqual([])
198199
expect(await getMissingDeployments('msys2-runtime-3.3', '3.3.7')).toEqual([])
200+
expect(await getMissingDeployments('openssh', '9.5.P1')).toEqual([missingOpenSSHURL])
199201
})

0 commit comments

Comments
 (0)