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

Remove deprecated compatibility code. #1670

Merged
merged 2 commits into from
May 6, 2019
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 5 additions & 27 deletions lib/process-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ function processRelease (argv, gyp, defaultVersion, defaultRelease) {
, versionSemver = semver.parse(version)
, overrideDistUrl = gyp.opts['dist-url'] || gyp.opts.disturl
, isDefaultVersion
, isIojs
, name
, distBaseUrl
, baseUrl
Expand All @@ -42,45 +41,24 @@ function processRelease (argv, gyp, defaultVersion, defaultRelease) {

if (defaultRelease) {
// v3 onward, has process.release
name = defaultRelease.name.replace(/io\.js/, 'iojs') // remove the '.' for directory naming purposes
isIojs = name === 'iojs'
name = defaultRelease.name
} else {
// old node or alternative --target=
// semver.satisfies() doesn't like prerelease tags so test major directly
isIojs = versionSemver.major >= 1 && versionSemver.major < 4
name = isIojs ? 'iojs' : 'node'
name = 'node'
}

// check for the nvm.sh standard mirror env variables
if (!overrideDistUrl) {
if (isIojs) {
if (process.env.IOJS_ORG_MIRROR) {
overrideDistUrl = process.env.IOJS_ORG_MIRROR
} else if (process.env.NVM_IOJS_ORG_MIRROR) {// remove on next semver-major
overrideDistUrl = process.env.NVM_IOJS_ORG_MIRROR
log.warn('download',
'NVM_IOJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, ' +
'please use IOJS_ORG_MIRROR')
}
} else {
if (process.env.NODEJS_ORG_MIRROR) {
overrideDistUrl = process.env.NODEJS_ORG_MIRROR
} else if (process.env.NVM_NODEJS_ORG_MIRROR) {// remove on next semver-major
overrideDistUrl = process.env.NVM_NODEJS_ORG_MIRROR
log.warn('download',
'NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, ' +
'please use NODEJS_ORG_MIRROR')
}
}
}
if (!overrideDistUrl && process.env.NODEJS_ORG_MIRROR)
overrideDistUrl = process.env.NODEJS_ORG_MIRROR

if (overrideDistUrl)
log.verbose('download', 'using dist-url', overrideDistUrl)

if (overrideDistUrl)
distBaseUrl = overrideDistUrl.replace(/\/+$/, '')
else
distBaseUrl = isIojs ? 'https://iojs.org/download/release' : 'https://nodejs.org/dist'
distBaseUrl = 'https://nodejs.org/dist'
distBaseUrl += '/v' + version + '/'

// new style, based on process.release so we have a lot of the data we need
Expand Down
54 changes: 1 addition & 53 deletions test/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

#set -e

test_node_versions="0.8.28 0.10.40 0.12.7 4.3.0 5.6.0"
test_iojs_versions="1.8.4 2.4.0 3.3.0"
test_node_versions="6.17.0 8.15.1 10.15.3 11.12.0"

myuid=$(id -u)
mygid=$(id -g)
Expand Down Expand Up @@ -77,25 +76,6 @@ for v in $test_node_versions; do
"
done

# An image for each of the io.js versions we want to test with that version installed and the latest npm
for v in $test_iojs_versions; do
setup_container "node-gyp-test/${v}" "node-gyp-test/clones" "
curl -sL https://iojs.org/dist/v${v}/iojs-v${v}-linux-x64.tar.gz | tar -zxv --strip-components=1 -C /usr/ &&
npm install npm@latest -g &&
node -v && npm -v
"
done

# Run the tests for all of the test images we've created,
# we should see node-gyp doing its download, configure and run thing
# _NOTE: bignum doesn't compile on 0.8 currently so it'll fail for that version only_
for v in $test_node_versions $test_iojs_versions; do
run_tests $v "
cd node-buffertools && npm install --loglevel=info && npm test && cd
"
# removed for now, too noisy: cd node-bignum && npm install --loglevel=info && npm test
done

# Test use of --target=x.y.z to compile against alternate versions
test_download_node_version() {
local run_with_ver="$1"
Expand All @@ -112,9 +92,7 @@ test_download_node_version() {
}

test_download_node_version "0.12.7" "0.10.30/src" "0.10.30"
test_download_node_version "3.3.0" "iojs-1.8.4/src" "1.8.4"
# should download the headers file
test_download_node_version "3.3.0" "iojs-3.3.0/include/node" "3.3.0"
test_download_node_version "4.3.0" "4.3.0/include/node" "4.3.0"
test_download_node_version "5.6.0" "5.6.0/include/node" "5.6.0"

Expand All @@ -124,36 +102,6 @@ test_download_node_version "5.6.0" "5.6.0/include/node" "5.6.0"
# point for tarballs
# we can test whether it uses the proxy because after 2 connections the proxy will
# die and therefore should not be running at the end of the test, `nc` can tell us this
run_tests "3.3.0" "
(node /node-gyp-src/test/simple-proxy.js 8080 /foobar/ https://iojs.org/dist/ &) &&
cd node-buffertools &&
/node-gyp-src/bin/node-gyp.js --loglevel=info --dist-url=http://localhost:8080/foobar/ rebuild &&
nc -z localhost 8080 && echo -e \"\\n\\n\\033[31mFAILED TO USE LOCAL PROXY\\033[39m\\n\\n\"
"

# REMOVE after next semver-major
run_tests "3.3.0" "
(node /node-gyp-src/test/simple-proxy.js 8080 /doobar/ https://iojs.org/dist/ &) &&
cd node-buffertools &&
NVM_IOJS_ORG_MIRROR=http://localhost:8080/doobar/ /node-gyp-src/bin/node-gyp.js --loglevel=info rebuild &&
nc -z localhost 8080 && echo -e \"\\n\\n\\033[31mFAILED TO USE LOCAL PROXY\\033[39m\\n\\n\"
"

# REMOVE after next semver-major
run_tests "0.12.7" "
(node /node-gyp-src/test/simple-proxy.js 8080 /boombar/ https://nodejs.org/dist/ &) &&
cd node-buffertools &&
NVM_NODEJS_ORG_MIRROR=http://localhost:8080/boombar/ /node-gyp-src/bin/node-gyp.js --loglevel=info rebuild &&
nc -z localhost 8080 && echo -e \"\\n\\n\\033[31mFAILED TO USE LOCAL PROXY\\033[39m\\n\\n\"
"

run_tests "3.3.0" "
(node /node-gyp-src/test/simple-proxy.js 8080 /doobar/ https://iojs.org/dist/ &) &&
cd node-buffertools &&
IOJS_ORG_MIRROR=http://localhost:8080/doobar/ /node-gyp-src/bin/node-gyp.js --loglevel=info rebuild &&
nc -z localhost 8080 && echo -e \"\\n\\n\\033[31mFAILED TO USE LOCAL PROXY\\033[39m\\n\\n\"
"

run_tests "0.12.7" "
(node /node-gyp-src/test/simple-proxy.js 8080 /boombar/ https://nodejs.org/dist/ &) &&
cd node-buffertools &&
Expand Down
238 changes: 0 additions & 238 deletions test/test-process-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,131 +187,6 @@ test('test process release - process.release ~ [email protected] / corp build', functi
})
})

test('test process release - process.version = 1.8.4', function (t) {
t.plan(2)

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

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

t.deepEqual(release, {
version: '1.8.4',
name: 'iojs',
baseUrl: 'https://iojs.org/download/release/v1.8.4/',
tarballUrl: 'https://iojs.org/download/release/v1.8.4/iojs-v1.8.4.tar.gz',
shasumsUrl: 'https://iojs.org/download/release/v1.8.4/SHASUMS256.txt',
versionDir: 'iojs-1.8.4',
libUrl32: 'https://iojs.org/download/release/v1.8.4/win-x86/iojs.lib',
libUrl64: 'https://iojs.org/download/release/v1.8.4/win-x64/iojs.lib',
libPath32: 'win-x86/iojs.lib',
libPath64: 'win-x64/iojs.lib'
})
})

test('test process release - process.release ~ [email protected]', function (t) {
t.plan(2)

var release = processRelease([], { opts: {} }, 'v3.2.24', {
name: 'io.js',
headersUrl: 'https://iojs.org/download/release/v3.2.24/iojs-v3.2.24-headers.tar.gz'
})

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

t.deepEqual(release, {
version: '3.2.24',
name: 'iojs',
baseUrl: 'https://iojs.org/download/release/v3.2.24/',
tarballUrl: 'https://iojs.org/download/release/v3.2.24/iojs-v3.2.24-headers.tar.gz',
shasumsUrl: 'https://iojs.org/download/release/v3.2.24/SHASUMS256.txt',
versionDir: 'iojs-3.2.24',
libUrl32: 'https://iojs.org/download/release/v3.2.24/win-x86/iojs.lib',
libUrl64: 'https://iojs.org/download/release/v3.2.24/win-x64/iojs.lib',
libPath32: 'win-x86/iojs.lib',
libPath64: 'win-x64/iojs.lib'
})
})

test('test process release - process.release ~ [email protected] +libUrl32', function (t) {
t.plan(2)

var release = processRelease([], { opts: {} }, 'v3.2.11', {
name: 'io.js',
headersUrl: 'https://iojs.org/download/release/v3.2.11/iojs-v3.2.11-headers.tar.gz',
libUrl: 'https://iojs.org/download/release/v3.2.11/win-x86/iojs.lib' // custom
})

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

t.deepEqual(release, {
version: '3.2.11',
name: 'iojs',
baseUrl: 'https://iojs.org/download/release/v3.2.11/',
tarballUrl: 'https://iojs.org/download/release/v3.2.11/iojs-v3.2.11-headers.tar.gz',
shasumsUrl: 'https://iojs.org/download/release/v3.2.11/SHASUMS256.txt',
versionDir: 'iojs-3.2.11',
libUrl32: 'https://iojs.org/download/release/v3.2.11/win-x86/iojs.lib',
libUrl64: 'https://iojs.org/download/release/v3.2.11/win-x64/iojs.lib',
libPath32: 'win-x86/iojs.lib',
libPath64: 'win-x64/iojs.lib'
})
})

test('test process release - process.release ~ [email protected] +libUrl64', function (t) {
t.plan(2)

var release = processRelease([], { opts: {} }, 'v3.2.101', {
name: 'io.js',
headersUrl: 'https://iojs.org/download/release/v3.2.101/iojs-v3.2.101-headers.tar.gz',
libUrl: 'https://iojs.org/download/release/v3.2.101/win-x64/iojs.lib' // custom
})

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

t.deepEqual(release, {
version: '3.2.101',
name: 'iojs',
baseUrl: 'https://iojs.org/download/release/v3.2.101/',
tarballUrl: 'https://iojs.org/download/release/v3.2.101/iojs-v3.2.101-headers.tar.gz',
shasumsUrl: 'https://iojs.org/download/release/v3.2.101/SHASUMS256.txt',
versionDir: 'iojs-3.2.101',
libUrl32: 'https://iojs.org/download/release/v3.2.101/win-x86/iojs.lib',
libUrl64: 'https://iojs.org/download/release/v3.2.101/win-x64/iojs.lib',
libPath32: 'win-x86/iojs.lib',
libPath64: 'win-x64/iojs.lib'
})
})

test('test process release - process.release ~ [email protected] - borked win-ia32', function (t) {
t.plan(2)

var release = processRelease([], { opts: {} }, 'v3.2.101', {
name: 'io.js',
headersUrl: 'https://iojs.org/download/release/v3.2.101/iojs-v3.2.101-headers.tar.gz',
libUrl: 'https://iojs.org/download/release/v3.2.101/win-ia32/iojs.lib' // custom
})

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

t.deepEqual(release, {
version: '3.2.101',
name: 'iojs',
baseUrl: 'https://iojs.org/download/release/v3.2.101/',
tarballUrl: 'https://iojs.org/download/release/v3.2.101/iojs-v3.2.101-headers.tar.gz',
shasumsUrl: 'https://iojs.org/download/release/v3.2.101/SHASUMS256.txt',
versionDir: 'iojs-3.2.101',
libUrl32: 'https://iojs.org/download/release/v3.2.101/win-x86/iojs.lib',
libUrl64: 'https://iojs.org/download/release/v3.2.101/win-x64/iojs.lib',
libPath32: 'win-x86/iojs.lib',
libPath64: 'win-x64/iojs.lib'
})
})

test('test process release - process.release ~ [email protected] --target=0.10.40', function (t) {
t.plan(2)

Expand All @@ -337,31 +212,6 @@ test('test process release - process.release ~ [email protected] --target=0.10.40', fu
})
})

test('test process release - process.release ~ [email protected] --target=1.8.4', function (t) {
t.plan(2)

var release = processRelease([], { opts: { target: '1.8.4' } }, 'v4.1.23', {
name: 'node',
headersUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz'
})

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

t.deepEqual(release, {
version: '1.8.4',
name: 'iojs',
baseUrl: 'https://iojs.org/download/release/v1.8.4/',
tarballUrl: 'https://iojs.org/download/release/v1.8.4/iojs-v1.8.4.tar.gz',
shasumsUrl: 'https://iojs.org/download/release/v1.8.4/SHASUMS256.txt',
versionDir: 'iojs-1.8.4',
libUrl32: 'https://iojs.org/download/release/v1.8.4/win-x86/iojs.lib',
libUrl64: 'https://iojs.org/download/release/v1.8.4/win-x64/iojs.lib',
libPath32: 'win-x86/iojs.lib',
libPath64: 'win-x64/iojs.lib'
})
})

test('test process release - process.release ~ [email protected] --dist-url=https://foo.bar/baz', function (t) {
t.plan(2)

Expand Down Expand Up @@ -547,91 +397,3 @@ test('test process release - NODEJS_ORG_MIRROR', function (t) {

delete process.env.NODEJS_ORG_MIRROR
})

test('test process release - NVM_NODEJS_ORG_MIRROR', function (t) {
t.plan(2)

process.env.NVM_NODEJS_ORG_MIRROR = 'http://foo.bar'

var release = processRelease([], { opts: {} }, 'v4.1.23', {
name: 'node',
headersUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz'
})

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

t.deepEqual(release, {
version: '4.1.23',
name: 'node',
baseUrl: 'http://foo.bar/v4.1.23/',
tarballUrl: 'http://foo.bar/v4.1.23/node-v4.1.23-headers.tar.gz',
shasumsUrl: 'http://foo.bar/v4.1.23/SHASUMS256.txt',
versionDir: '4.1.23',
libUrl32: 'http://foo.bar/v4.1.23/win-x86/node.lib',
libUrl64: 'http://foo.bar/v4.1.23/win-x64/node.lib',
libPath32: 'win-x86/node.lib',
libPath64: 'win-x64/node.lib'
})

delete process.env.NVM_NODEJS_ORG_MIRROR
})

test('test process release - IOJS_ORG_MIRROR', function (t) {
t.plan(2)

process.env.IOJS_ORG_MIRROR = 'http://foo.bar'

var release = processRelease([], { opts: {} }, 'v3.2.24', {
name: 'io.js',
headersUrl: 'https://iojs.org/download/release/v3.2.24/iojs-v3.2.24-headers.tar.gz'
})

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

t.deepEqual(release, {
version: '3.2.24',
name: 'iojs',
baseUrl: 'http://foo.bar/v3.2.24/',
tarballUrl: 'http://foo.bar/v3.2.24/iojs-v3.2.24-headers.tar.gz',
shasumsUrl: 'http://foo.bar/v3.2.24/SHASUMS256.txt',
versionDir: 'iojs-3.2.24',
libUrl32: 'http://foo.bar/v3.2.24/win-x86/iojs.lib',
libUrl64: 'http://foo.bar/v3.2.24/win-x64/iojs.lib',
libPath32: 'win-x86/iojs.lib',
libPath64: 'win-x64/iojs.lib'
})

delete process.env.IOJS_ORG_MIRROR
})


test('test process release - NVM_IOJS_ORG_MIRROR', function (t) {
t.plan(2)

process.env.NVM_IOJS_ORG_MIRROR = 'http://foo.bar'

var release = processRelease([], { opts: {} }, 'v3.2.24', {
name: 'io.js',
headersUrl: 'https://iojs.org/download/release/v3.2.24/iojs-v3.2.24-headers.tar.gz'
})

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

t.deepEqual(release, {
version: '3.2.24',
name: 'iojs',
baseUrl: 'http://foo.bar/v3.2.24/',
tarballUrl: 'http://foo.bar/v3.2.24/iojs-v3.2.24-headers.tar.gz',
shasumsUrl: 'http://foo.bar/v3.2.24/SHASUMS256.txt',
versionDir: 'iojs-3.2.24',
libUrl32: 'http://foo.bar/v3.2.24/win-x86/iojs.lib',
libUrl64: 'http://foo.bar/v3.2.24/win-x64/iojs.lib',
libPath32: 'win-x86/iojs.lib',
libPath64: 'win-x64/iojs.lib'
})

delete process.env.NVM_IOJS_ORG_MIRROR
})