Skip to content

Commit 886fa32

Browse files
committed
component-updates: refactor pacmanRepositoryURLs()
This refactoring prepares for the upcoming commit where we want to pass a subset of architectures into the function: `msys2-runtime` is no longer deployed for i686, and `msys2-runtime-3.3` will never be deployed for x86_64. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent aaba09c commit 886fa32

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

GitForWindowsHelper/component-updates.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -109,27 +109,26 @@ const guessReleaseNotes = async (context, issue) => {
109109

110110
const pacmanRepositoryBaseURL = 'https://wingit.blob.core.windows.net/'
111111

112-
const pacmanRepositoryURLs = (package_name, version) =>
113-
isMSYSPackage(package_name)
114-
? [
115-
`${pacmanRepositoryBaseURL}i686/${package_name}-${version}-1-i686.pkg.tar.xz`,
116-
`${pacmanRepositoryBaseURL}x86-64/${package_name}-${version}-1-x86_64.pkg.tar.xz`
117-
] : [
118-
`${pacmanRepositoryBaseURL}i686/${package_name.replace(/^mingw-w64/, '$&-i686')}-${version}-1-any.pkg.tar.xz`,
119-
`${pacmanRepositoryBaseURL}x86-64/${package_name.replace(/^mingw-w64/, '$&-x86_64')}-${version}-1-any.pkg.tar.xz`
120-
]
112+
const pacmanRepositoryURLs = (package_name, version, architectures) =>
113+
architectures.map(arch => {
114+
const fileName = isMSYSPackage(package_name)
115+
? `${package_name}-${version}-1-${arch}.pkg.tar.xz`
116+
: `${package_name.replace(/^mingw-w64/, `$&-${arch}`)}-${version}-1-any.pkg.tar.xz`
117+
return `${pacmanRepositoryBaseURL}${arch.replace(/_/g, '-')}/${fileName}`
118+
})
121119

122120
const getMissingDeployments = async (package_name, version) => {
123121
// MinTTY is at epoch 1, which is part of Pacman's versioning scheme
124122
if (package_name === 'mintty') version = `1~${version}`
123+
const architectures = ['i686', 'x86_64']
125124

126125
const urls = []
127126
const msysName = package_name.replace(/^mingw-w64-/, '')
128127
if (packageNeedsBothMSYSAndMINGW(msysName)) {
129-
urls.push(...pacmanRepositoryURLs(msysName, version))
130-
urls.push(...pacmanRepositoryURLs(`mingw-w64-${msysName}`, version))
128+
urls.push(...pacmanRepositoryURLs(msysName, version, architectures))
129+
urls.push(...pacmanRepositoryURLs(`mingw-w64-${msysName}`, version, architectures))
131130
} else {
132-
urls.push(...pacmanRepositoryURLs(package_name, version))
131+
urls.push(...pacmanRepositoryURLs(package_name, version, architectures))
133132
}
134133
const { doesURLReturn404 } = require('./https-request')
135134
const result = await Promise.all(urls.map(async url => doesURLReturn404(url)))

0 commit comments

Comments
 (0)