From bda3a2dd9d5a4dc3718835b00403b6d1a3d4a7bb Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Fri, 26 Jun 2015 22:17:02 +1000 Subject: [PATCH 1/2] node-gyp: make aware of nightly, next-nightly & rc A temporary fix only, node-gyp needs to be made more intelligent upstream about figuring out where to find the download file by inspecting the binary. Floating patch on npm. --- deps/npm/node_modules/node-gyp/lib/install.js | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/deps/npm/node_modules/node-gyp/lib/install.js b/deps/npm/node_modules/node-gyp/lib/install.js index 0407feba0e8bdb..d828d529ac157d 100644 --- a/deps/npm/node_modules/node-gyp/lib/install.js +++ b/deps/npm/node_modules/node-gyp/lib/install.js @@ -39,8 +39,8 @@ function install (gyp, argv, callback) { } } - var distUrl = gyp.opts['dist-url'] || gyp.opts.disturl || 'https://iojs.org/dist' - + var defaultUrl = getDefaultIojsUrl(process.version) + var distUrl = gyp.opts['dist-url'] || gyp.opts.disturl || defaultUrl // Determine which node dev files version we are installing var versionStr = argv[0] || gyp.opts.target || process.version @@ -455,3 +455,26 @@ function install (gyp, argv, callback) { } } + + +// pick out 'nightly', 'next-nightly' or 'rc' from the version string if it's there +// adjust URL accordingly +function getDefaultIojsUrl(version) { + var versionMatch = version.match(/^v\d+\.\d+\.\d+-(?:(?:(nightly|next-nightly)\d{8}[0-9a-f]{10})|(?:(rc)\d+))$/) + var distType = versionMatch ? versionMatch[1] || versionMatch[2] : 'release' + var defaultUrl = `https://iojs.org/download/${distType}` + return defaultUrl +} + + +if (require.main === module) { + var assert = require('assert') + console.log('test v2.3.4 -> https://iojs.org/download/release') + assert(getDefaultIojsUrl('v2.3.4', 'https://iojs.org/download/release')) + console.log('test v2.3.4-nightly12345678aaaaaaaaaa -> https://iojs.org/download/nightly') + assert(getDefaultIojsUrl('v2.3.4-nightly12345678aaaaaaaaaa', 'https://iojs.org/download/nightly')) + console.log('test v2.3.4-next-nightly12345678aaaaaaaaaa -> https://iojs.org/download/release/next-nightly') + assert(getDefaultIojsUrl('v2.3.4-next-nightly12345678aaaaaaaaaa', 'https://iojs.org/download/next-nightly')) + console.log('test v2.3.4-rc100 -> https://iojs.org/download/rc') + assert(getDefaultIojsUrl('v2.3.4-rc100', 'https://iojs.org/download/rc')) +} From 14221edd41c758f350acb52ab7fb2b3e8cf95b14 Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Fri, 26 Jun 2015 22:19:30 +1000 Subject: [PATCH 2/2] node-gyp: download header tarball for compile Temporary fix only, node-gyp needs to be aware of whether it can even download this file for the current runtime so that information needs to come from the process itself. Floating patch on npm. --- deps/npm/node_modules/node-gyp/addon.gypi | 1 + deps/npm/node_modules/node-gyp/lib/install.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/deps/npm/node_modules/node-gyp/addon.gypi b/deps/npm/node_modules/node-gyp/addon.gypi index 09ee70d9c22a64..1872c48c7fa279 100644 --- a/deps/npm/node_modules/node-gyp/addon.gypi +++ b/deps/npm/node_modules/node-gyp/addon.gypi @@ -5,6 +5,7 @@ 'product_prefix': '', 'include_dirs': [ + '<(node_root_dir)/include/node', '<(node_root_dir)/src', '<(node_root_dir)/deps/uv/include', '<(node_root_dir)/deps/v8/include' diff --git a/deps/npm/node_modules/node-gyp/lib/install.js b/deps/npm/node_modules/node-gyp/lib/install.js index d828d529ac157d..cecd7fd4af4e54 100644 --- a/deps/npm/node_modules/node-gyp/lib/install.js +++ b/deps/npm/node_modules/node-gyp/lib/install.js @@ -185,7 +185,7 @@ function install (gyp, argv, callback) { // now download the node tarball var tarPath = gyp.opts['tarball'] - var tarballUrl = tarPath ? tarPath : distUrl + '/v' + version + '/iojs-v' + version + '.tar.gz' + var tarballUrl = tarPath ? tarPath : distUrl + '/v' + version + '/iojs-v' + version + '-headers.tar.gz' , badDownload = false , extractCount = 0 , gunzip = zlib.createGunzip()