Skip to content

Commit

Permalink
Merge pull request #843 from electron-userland/mips64el-not-supported…
Browse files Browse the repository at this point in the history
…-by-2.0.0

Prevent trying to download mips64el arch for Electron 2.x
  • Loading branch information
malept committed May 14, 2018
2 parents a7af94d + 3010573 commit b3c610c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
20 changes: 10 additions & 10 deletions targets.js
Expand Up @@ -13,9 +13,9 @@ const officialPlatformArchCombos = {
win32: ['ia32', 'x64']
}

const minimumLinuxArchBuildVersions = {
arm64: '1.8.0',
mips64el: '1.8.2-beta.5'
const linuxArchBuildVersions = {
arm64: '>= 1.8.0',
mips64el: '^1.8.2-beta.5'
}

// Maps to module filename for each platform (lazy-required if used)
Expand All @@ -40,9 +40,9 @@ function createPlatformArchPairs (opts, selectedPlatforms, selectedArchs, ignore
warnIfAllNotSpecified(opts, `The platform/arch combination ${platform}/${arch} is not currently supported by Electron Packager`)
continue
} else if (platform === 'linux') {
const minimumBuildVersion = minimumLinuxArchBuildVersions[arch]
if (minimumBuildVersion && !officialLinuxBuildExists(opts, minimumBuildVersion)) {
warnIfAllNotSpecified(opts, `Official linux/${arch} support only exists in Electron ${minimumBuildVersion} and above`)
const buildVersion = linuxArchBuildVersions[arch]
if (buildVersion && !officialLinuxBuildExists(opts, buildVersion)) {
warnIfAllNotSpecified(opts, `Official linux/${arch} support only exists in Electron ${buildVersion}`)
continue
}
}
Expand All @@ -67,8 +67,8 @@ function validOfficialPlatformArch (opts, platform, arch) {
return officialPlatformArchCombos[platform] && officialPlatformArchCombos[platform].indexOf(arch) !== -1
}

function officialLinuxBuildExists (opts, minimumBuildVersion) {
return semver.gte(opts.electronVersion, minimumBuildVersion)
function officialLinuxBuildExists (opts, buildVersion) {
return semver.satisfies(opts.electronVersion, buildVersion)
}

function allPlatformsOrArchsSpecified (opts) {
Expand Down Expand Up @@ -100,8 +100,8 @@ module.exports = {
allOfficialArchsForPlatformAndVersion: function allOfficialArchsForPlatformAndVersion (platform, electronVersion) {
const archs = officialPlatformArchCombos[platform]
if (platform === 'linux') {
const excludedArchs = Object.keys(minimumLinuxArchBuildVersions)
.filter(arch => !officialLinuxBuildExists({electronVersion: electronVersion}, minimumLinuxArchBuildVersions[arch]))
const excludedArchs = Object.keys(linuxArchBuildVersions)
.filter(arch => !officialLinuxBuildExists({electronVersion: electronVersion}, linuxArchBuildVersions[arch]))
return archs.filter(arch => excludedArchs.indexOf(arch) === -1)
}

Expand Down
1 change: 1 addition & 0 deletions test/targets.js
Expand Up @@ -126,6 +126,7 @@ testMultiTarget('platform=linux and arch=arm64 with a supported official Electro
testMultiTarget('platform=linux and arch=arm64 with an unsupported official Electron version', {arch: 'arm64', platform: 'linux'}, 0, 'Package should not be generated for arm64')
testMultiTarget('platform=linux and arch=mips64el with a supported official Electron version', {arch: 'mips64el', platform: 'linux', electronVersion: '1.8.2-beta.5'}, 1, 'Package should be generated for mips64el')
testMultiTarget('platform=linux and arch=mips64el with an unsupported official Electron version', {arch: 'mips64el', platform: 'linux'}, 0, 'Package should not be generated for mips64el')
testMultiTarget('platform=linux and arch=mips64el with an unsupported official Electron version (2.0.0)', {arch: 'mips64el', platform: 'linux', electronVersion: '2.0.0'}, 0, 'Package should not be generated for mips64el')
testMultiTarget('unofficial arch', {arch: 'z80', platform: 'linux', download: {mirror: 'mirror'}}, 1,
'Package should be generated for non-standard arch from non-official mirror')
testMultiTarget('unofficial platform', {arch: 'ia32', platform: 'minix', download: {mirror: 'mirror'}}, 1,
Expand Down

0 comments on commit b3c610c

Please sign in to comment.