Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent trying to download mips64el arch for Electron 2.x #843

Merged
merged 1 commit into from May 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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