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

download headers tarball for ~0.12.10 || ~0.10.42 #877

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/process-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ var semver = require('semver')
, url = require('url')
, path = require('path')

// versions where -headers.tar.gz started shipping
, headersTarballRange = '>= 3.0.0 || ~0.12.10 || ~0.10.42'
, bitsre = /\/win-(x86|x64)\//
, bitsreV3 = /\/win-(x86|ia32|x64)\// // io.js v3.x.x shipped with "ia32" but should
// have been "x86"
Expand All @@ -21,6 +23,7 @@ function processRelease (argv, gyp, defaultVersion, defaultRelease) {
, libUrl32
, libUrl64
, tarballUrl
, canGetHeaders

if (!versionSemver) {
// not a valid semver string, nothing we can do
Expand Down Expand Up @@ -93,7 +96,8 @@ function processRelease (argv, gyp, defaultVersion, defaultRelease) {
// making the bold assumption that anything with a version number >3.0.0 will
// have a *-headers.tar.gz file in its dist location, even some frankenstein
// custom version
tarballUrl = url.resolve(baseUrl, name + '-v' + version + (versionSemver.major >= 3 ? '-headers' : '') + '.tar.gz')
canGetHeaders = semver.satisfies(versionSemver, headersTarballRange)
tarballUrl = url.resolve(baseUrl, name + '-v' + version + (canGetHeaders ? '-headers' : '') + '.tar.gz')

return {
version: version,
Expand Down
90 changes: 80 additions & 10 deletions test/test-process-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,93 @@ test('test process release - process.version = 0.10.21', function (t) {
})
})

test('test process release - process.version = 0.12.22', function (t) {
// prior to -headers.tar.gz
test('test process release - process.version = 0.12.9', function (t) {
t.plan(2)

var release = processRelease([], { opts: {} }, 'v0.12.22', null)
var release = processRelease([], { opts: {} }, 'v0.12.9', null)

t.equal(release.semver.version, '0.12.22')
t.equal(release.semver.version, '0.12.9')
delete release.semver

t.deepEqual(release, {
version: '0.12.22',
version: '0.12.9',
name: 'node',
baseUrl: 'https://nodejs.org/dist/v0.12.22/',
tarballUrl: 'https://nodejs.org/dist/v0.12.22/node-v0.12.22.tar.gz',
shasumsUrl: 'https://nodejs.org/dist/v0.12.22/SHASUMS256.txt',
versionDir: '0.12.22',
libUrl32: 'https://nodejs.org/dist/v0.12.22/node.lib',
libUrl64: 'https://nodejs.org/dist/v0.12.22/x64/node.lib',
baseUrl: 'https://nodejs.org/dist/v0.12.9/',
tarballUrl: 'https://nodejs.org/dist/v0.12.9/node-v0.12.9.tar.gz',
shasumsUrl: 'https://nodejs.org/dist/v0.12.9/SHASUMS256.txt',
versionDir: '0.12.9',
libUrl32: 'https://nodejs.org/dist/v0.12.9/node.lib',
libUrl64: 'https://nodejs.org/dist/v0.12.9/x64/node.lib',
libPath32: 'node.lib',
libPath64: 'x64/node.lib'
})
})

// prior to -headers.tar.gz
test('test process release - process.version = 0.10.41', function (t) {
t.plan(2)

var release = processRelease([], { opts: {} }, 'v0.10.41', null)

t.equal(release.semver.version, '0.10.41')
delete release.semver

t.deepEqual(release, {
version: '0.10.41',
name: 'node',
baseUrl: 'https://nodejs.org/dist/v0.10.41/',
tarballUrl: 'https://nodejs.org/dist/v0.10.41/node-v0.10.41.tar.gz',
shasumsUrl: 'https://nodejs.org/dist/v0.10.41/SHASUMS256.txt',
versionDir: '0.10.41',
libUrl32: 'https://nodejs.org/dist/v0.10.41/node.lib',
libUrl64: 'https://nodejs.org/dist/v0.10.41/x64/node.lib',
libPath32: 'node.lib',
libPath64: 'x64/node.lib'
})
})

// has -headers.tar.gz
test('test process release - process.release ~ [email protected]', function (t) {
t.plan(2)

var release = processRelease([], { opts: {} }, 'v0.10.42', null)

t.equal(release.semver.version, '0.10.42')
delete release.semver

t.deepEqual(release, {
version: '0.10.42',
name: 'node',
baseUrl: 'https://nodejs.org/dist/v0.10.42/',
tarballUrl: 'https://nodejs.org/dist/v0.10.42/node-v0.10.42-headers.tar.gz',
shasumsUrl: 'https://nodejs.org/dist/v0.10.42/SHASUMS256.txt',
versionDir: '0.10.42',
libUrl32: 'https://nodejs.org/dist/v0.10.42/node.lib',
libUrl64: 'https://nodejs.org/dist/v0.10.42/x64/node.lib',
libPath32: 'node.lib',
libPath64: 'x64/node.lib'
})
})

// has -headers.tar.gz
test('test process release - process.release ~ [email protected]', function (t) {
t.plan(2)

var release = processRelease([], { opts: {} }, 'v0.12.10', null)

t.equal(release.semver.version, '0.12.10')
delete release.semver

t.deepEqual(release, {
version: '0.12.10',
name: 'node',
baseUrl: 'https://nodejs.org/dist/v0.12.10/',
tarballUrl: 'https://nodejs.org/dist/v0.12.10/node-v0.12.10-headers.tar.gz',
shasumsUrl: 'https://nodejs.org/dist/v0.12.10/SHASUMS256.txt',
versionDir: '0.12.10',
libUrl32: 'https://nodejs.org/dist/v0.12.10/node.lib',
libUrl64: 'https://nodejs.org/dist/v0.12.10/x64/node.lib',
libPath32: 'node.lib',
libPath64: 'x64/node.lib'
})
Expand Down