node-gyp: update floating patch to match current PR

Special commit for v4.0.0-rc only, not intended to merge to v4.x

See https://github.com/nodejs/node/pull/2700
This commit is contained in:
Rod Vagg committed 2015-09-07 21:01:56 +10:00
1 parent 76ffbfc2eb
commit f83aa34aa0
23 files changed
+319 -828

No files matched your search

+2 -2
View File
@@ -1,4 +1,4 @@
:: Created by npm, please don't edit manually.
:: Created by npm, please don't edit manually.
@ECHO OFF
SETLOCAL
@@ -6,7 +6,7 @@ SETLOCAL
SET "NODE_EXE=%~dp0\node.exe"
IF NOT EXIST "%NODE_EXE%" (
SET "NODE_EXE=node"
)
)
SET "NPM_CLI_JS=%~dp0\node_modules\npm\bin\npm-cli.js"
FOR /F "delims=" %%F IN ('CALL "%NODE_EXE%" "%NPM_CLI_JS%" prefix -g') DO (
+1
View File
@@ -1,2 +1,3 @@
gyp/test
node_modules
test/.node-gyp
+1 -1
View File
@@ -139,7 +139,7 @@ Some additional resources for addons and writing `gyp` files:
* ["Hello World" node addon example](https://github.com/joyent/node/tree/master/test/addons/hello-world)
* [gyp user documentation](https://chromium.googlesource.com/external/gyp/+/master/docs/UserDocumentation.md)
* [gyp input format reference](https://chromium.googlesource.com/external/gyp/+/master/docs/InputFormatReference.md)
* [*"binding.gyp" files out in the wild* wiki page](https://github.com/TooTallNate/node-gyp/wiki/%22binding.gyp%22-files-out-in-the-wild)
* [*"binding.gyp" files out in the wild* wiki page](https://github.com/nodejs/node-gyp/wiki/%22binding.gyp%22-files-out-in-the-wild)
Commands
+1 -1
View File
@@ -125,7 +125,7 @@ function issueMessage () {
errorMessage()
log.error('', [ 'This is a bug in `node-gyp`.'
, 'Try to update node-gyp and file an Issue if it does not help:'
, ' <https://github.com/TooTallNate/node-gyp/issues>'
, ' <https://github.com/nodejs/node-gyp/issues>'
].join('\n'))
}
+2 -3
View File
@@ -145,8 +145,8 @@ function configure (gyp, argv, callback) {
log.verbose('get node dir', 'no --target version specified, falling back to host node version: %s', release.version)
}
// make sure we have a valid version
if (!release.semver) {
// could not parse the version string with semver
return callback(new Error('Invalid version number: ' + release.version))
}
@@ -304,9 +304,8 @@ function configure (gyp, argv, callback) {
var addon_gypi = path.resolve(__dirname, '..', 'addon.gypi')
var common_gypi = path.resolve(nodeDir, 'include/node/common.gypi')
fs.stat(common_gypi, function (err, stat) {
if (err || !stat.isFile()) {
if (err)
common_gypi = path.resolve(nodeDir, 'common.gypi')
}
var output_dir = 'build'
if (win) {
+5 -5
View File
@@ -45,8 +45,8 @@ function install (gyp, argv, callback) {
// Determine which node dev files version we are installing
log.verbose('install', 'input version string %j', release.version)
// parse the version to normalize and ensure it's valid
if (!release.semver) {
// could not parse the version string with semver
return callback(new Error('Invalid version number: ' + release.version))
}
@@ -136,7 +136,7 @@ function install (gyp, argv, callback) {
}
try {
// The "request" constructor can throw sometimes apparently :(
// See: https://github.com/TooTallNate/node-gyp/issues/114
// See: https://github.com/nodejs/node-gyp/issues/114
req = request(requestOpts)
} catch (e) {
cb(e)
@@ -150,7 +150,7 @@ function install (gyp, argv, callback) {
}
function getContentSha(res, callback) {
var shasum = crypto.createHash(release.checksumAlgo)
var shasum = crypto.createHash('sha256')
res.on('data', function (chunk) {
shasum.update(chunk)
}).on('end', function () {
@@ -307,8 +307,8 @@ function install (gyp, argv, callback) {
}
function downloadShasums(done) {
log.verbose('check download content checksum, need to download `' + release.shasumsFile + '`...')
var shasumsPath = path.resolve(devDir, release.shasumsFile)
log.verbose('check download content checksum, need to download `SHASUMS256.txt`...')
var shasumsPath = path.resolve(devDir, 'SHASUMS256.txt')
log.verbose('checksum url', release.shasumsUrl)
var req = download(release.shasumsUrl)
+1 -1
View File
@@ -48,7 +48,7 @@ function Gyp () {
// set the dir where node-gyp dev files get installed
// TODO: make this *more* configurable?
// see: https://github.com/TooTallNate/node-gyp/issues/21
// see: https://github.com/nodejs/node-gyp/issues/21
var homeDir = process.env.HOME || process.env.USERPROFILE
if (!homeDir) {
throw new Error(
+60 -34
View File
@@ -1,38 +1,67 @@
var semver = require('semver')
var url = require('url')
var path = require('path')
, url = require('url')
, path = require('path')
var bitsre = /(x86|x64)/
var bitsreV3 = /(x86|ia32|x64)/ // io.js v3.x.x shipped with "ia32" but should
// have been "x86"
, bitsre = /\/win-(x86|x64)\//
, bitsreV3 = /\/win-(x86|ia32|x64)\// // io.js v3.x.x shipped with "ia32" but should
// have been "x86"
// Captures all the logic required to determine download URLs, local directory and
// file names and whether we need to use SHA-1 or 2. Inputs come from command-line
// switches (--target), `process.version` and `process.release` where it exists.
// file names. Inputs come from command-line switches (--target, --dist-url),
// `process.version` and `process.release` where it exists.
function processRelease (argv, gyp, defaultVersion, defaultRelease) {
var version = argv[0] || gyp.opts.target || defaultVersion
, isDefaultVersion = version === defaultVersion
, versionSemver = semver.parse(version)
, overrideDistUrl = gyp.opts['dist-url'] || gyp.opts.disturl
, isIojs
, name
, distBaseUrl
, baseUrl
, libUrl32
, libUrl64
// parse the version to normalize and ensure it's valid
var versionSemver = semver.parse(version)
if (!versionSemver) {
// not a valid semver string, nothing we can do
return { version: version }
}
// flatten version into String
version = versionSemver.version
var overrideDistUrl = gyp.opts['dist-url'] || gyp.opts.disturl
var iojs = !overrideDistUrl && !defaultRelease && semver.satisfies(version, '>=1.0.0 <4.0.0')
var name = (defaultRelease && defaultRelease.name.replace(/\./g, '')) || (iojs ? 'iojs' : 'node') // io.js -> iojs
var defaultDirUrl = (overrideDistUrl || iojs ? 'https://iojs.org/download/release' : 'https://nodejs.org/dist') + '/v' + version + '/'
var baseUrl
var libUrl32
var libUrl64
// can't use process.release if we're using --target=x.y.z
if (!isDefaultVersion)
defaultRelease = null
if (defaultRelease) {
// v3 onward, has process.release
name = defaultRelease.name.replace(/io\.js/, 'iojs') // remove the '.' for directory naming purposes
isIojs = name === 'iojs'
} else {
// old node or alternative --target=
isIojs = semver.satisfies(version, '>=1.0.0 <4.0.0')
name = isIojs ? 'iojs' : 'node'
}
// check for the nvm.sh standard mirror env variables
if (!overrideDistUrl) {
if (isIojs && process.env.NVM_IOJS_ORG_MIRROR)
overrideDistUrl = process.env.NVM_IOJS_ORG_MIRROR
else if (process.env.NVM_NODEJS_ORG_MIRROR)
overrideDistUrl = process.env.NVM_NODEJS_ORG_MIRROR
}
if (overrideDistUrl)
distBaseUrl = overrideDistUrl.replace(/\/+$/, '')
else
distBaseUrl = isIojs ? 'https://iojs.org/download/release' : 'https://nodejs.org/dist'
distBaseUrl += '/v' + version + '/'
// new style, based on process.release so we have a lot of the data we need
if (defaultRelease && defaultRelease.headersUrl && !overrideDistUrl) {
baseUrl = url.resolve(defaultRelease.headersUrl, './')
libUrl32 = resolveLibUrl(name, defaultRelease.libUrl || baseUrl || defaultDirUrl, 'x86', version)
libUrl64 = resolveLibUrl(name, defaultRelease.libUrl || baseUrl || defaultDirUrl, 'x64', version)
libUrl32 = resolveLibUrl(name, defaultRelease.libUrl || baseUrl || distBaseUrl, 'x86', version)
libUrl64 = resolveLibUrl(name, defaultRelease.libUrl || baseUrl || distBaseUrl, 'x64', version)
return {
version: version,
@@ -40,9 +69,7 @@ function processRelease (argv, gyp, defaultVersion, defaultRelease) {
name: name,
baseUrl: baseUrl,
tarballUrl: defaultRelease.headersUrl,
shasumsFile: 'SHASUMS256.txt',
shasumsUrl: url.resolve(baseUrl, 'SHASUMS256.txt'),
checksumAlgo: 'sha256',
versionDir: (name !== 'node' ? name + '-' : '') + version,
libUrl32: libUrl32,
libUrl64: libUrl64,
@@ -52,25 +79,24 @@ function processRelease (argv, gyp, defaultVersion, defaultRelease) {
}
// older versions without process.release are captured here and we have to make
// a lot of assumptions
// a lot of assumptions, additionally if you --target=x.y.z then we can't use the
// current process.release
// distributions starting with 0.10.0 contain sha256 checksums
var checksumAlgo = semver.gte(version, '0.10.0') ? 'sha256' : 'sha1'
var shasumsFile = (checksumAlgo === 'sha256') ? 'SHASUMS256.txt' : 'SHASUMS.txt'
baseUrl = defaultDirUrl
baseUrl = distBaseUrl
libUrl32 = resolveLibUrl(name, baseUrl, 'x86', version)
libUrl64 = resolveLibUrl(name, baseUrl, 'x64', version)
// 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 + (semver.satisfies(version, '>=3') ? '-headers' : '') + '.tar.gz')
return {
version: version,
semver: versionSemver,
name: name,
baseUrl: baseUrl,
tarballUrl: baseUrl + name + '-v' + version + '.tar.gz',
shasumsFile: shasumsFile,
shasumsUrl: baseUrl + shasumsFile,
checksumAlgo: checksumAlgo,
tarballUrl: tarballUrl,
shasumsUrl: url.resolve(baseUrl, 'SHASUMS256.txt'),
versionDir: (name !== 'node' ? name + '-' : '') + version,
libUrl32: libUrl32,
libUrl64: libUrl64,
@@ -85,19 +111,19 @@ function normalizePath (p) {
function resolveLibUrl (name, defaultUrl, arch, version) {
var base = url.resolve(defaultUrl, './')
var isV3 = semver.satisfies(version, '^3')
var hasLibUrl = bitsre.test(defaultUrl) || (isV3 && bitsreV3.test(defaultUrl))
, isV3 = semver.satisfies(version, '^3')
, hasLibUrl = bitsre.test(defaultUrl) || (isV3 && bitsreV3.test(defaultUrl))
if (!hasLibUrl) {
// let's assume it's a baseUrl then
if (semver.gte(version, '1.0.0'))
return url.resolve(base, 'win-' + arch +'/' + name + '.lib')
// prior to io.js@1.0.0 32-bit node.lib lives in /, 64-bit lives in /x64/
return url.resolve(base, (arch == 'x64' ? 'x64/' : '') + name + '.lib')
return url.resolve(base, (arch === 'x64' ? 'x64/' : '') + name + '.lib')
}
// else we have a proper url to a .lib, just make sure it's the right arch
return defaultUrl.replace(isV3 ? bitsreV3 : bitsre, arch)
return defaultUrl.replace(isV3 ? bitsreV3 : bitsre, '/win-' + arch + '/')
}
module.exports = processRelease
-1
View File
@@ -1 +0,0 @@
node_modules/
-15
View File
@@ -1,15 +0,0 @@
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-36
View File
@@ -1,36 +0,0 @@
# graceful-fs
graceful-fs functions as a drop-in replacement for the fs module,
making various improvements.
The improvements are meant to normalize behavior across different
platforms and environments, and to make filesystem access more
resilient to errors.
## Improvements over [fs module](http://api.nodejs.org/fs.html)
graceful-fs:
* Queues up `open` and `readdir` calls, and retries them once
something closes if there is an EMFILE error from too many file
descriptors.
* fixes `lchmod` for Node versions prior to 0.6.2.
* implements `fs.lutimes` if possible. Otherwise it becomes a noop.
* ignores `EINVAL` and `EPERM` errors in `chown`, `fchown` or
`lchown` if the user isn't root.
* makes `lchmod` and `lchown` become noops, if not available.
* retries reading a file if `read` results in EAGAIN error.
On Windows, it retries renaming a file for up to one second if `EACCESS`
or `EPERM` error occurs, likely because antivirus software has locked
the directory.
## USAGE
```javascript
// use just like fs
var fs = require('graceful-fs')
// now go and do stuff with it...
fs.readFileSync('some-file-or-whatever')
```
-11
View File
@@ -1,11 +0,0 @@
// eeeeeevvvvviiiiiiillllll
// more evil than monkey-patching the native builtin?
// Not sure.
var mod = require("module")
var pre = '(function (exports, require, module, __filename, __dirname) { '
var post = '});'
var src = pre + process.binding('natives').fs + post
var vm = require('vm')
var fn = vm.runInThisContext(src)
fn(exports, require, module, __filename, __dirname)
-158
View File
@@ -1,158 +0,0 @@
// Monkey-patching the fs module.
// It's ugly, but there is simply no other way to do this.
var fs = module.exports = require('./fs.js')
var assert = require('assert')
// fix up some busted stuff, mostly on windows and old nodes
require('./polyfills.js')
var util = require('util')
function noop () {}
var debug = noop
if (util.debuglog)
debug = util.debuglog('gfs')
else if (/\bgfs\b/i.test(process.env.NODE_DEBUG || ''))
debug = function() {
var m = util.format.apply(util, arguments)
m = 'GFS: ' + m.split(/\n/).join('\nGFS: ')
console.error(m)
}
if (/\bgfs\b/i.test(process.env.NODE_DEBUG || '')) {
process.on('exit', function() {
debug('fds', fds)
debug(queue)
assert.equal(queue.length, 0)
})
}
var originalOpen = fs.open
fs.open = open
function open(path, flags, mode, cb) {
if (typeof mode === "function") cb = mode, mode = null
if (typeof cb !== "function") cb = noop
new OpenReq(path, flags, mode, cb)
}
function OpenReq(path, flags, mode, cb) {
this.path = path
this.flags = flags
this.mode = mode
this.cb = cb
Req.call(this)
}
util.inherits(OpenReq, Req)
OpenReq.prototype.process = function() {
originalOpen.call(fs, this.path, this.flags, this.mode, this.done)
}
var fds = {}
OpenReq.prototype.done = function(er, fd) {
debug('open done', er, fd)
if (fd)
fds['fd' + fd] = this.path
Req.prototype.done.call(this, er, fd)
}
var originalReaddir = fs.readdir
fs.readdir = readdir
function readdir(path, cb) {
if (typeof cb !== "function") cb = noop
new ReaddirReq(path, cb)
}
function ReaddirReq(path, cb) {
this.path = path
this.cb = cb
Req.call(this)
}
util.inherits(ReaddirReq, Req)
ReaddirReq.prototype.process = function() {
originalReaddir.call(fs, this.path, this.done)
}
ReaddirReq.prototype.done = function(er, files) {
if (files && files.sort)
files = files.sort()
Req.prototype.done.call(this, er, files)
onclose()
}
var originalClose = fs.close
fs.close = close
function close (fd, cb) {
debug('close', fd)
if (typeof cb !== "function") cb = noop
delete fds['fd' + fd]
originalClose.call(fs, fd, function(er) {
onclose()
cb(er)
})
}
var originalCloseSync = fs.closeSync
fs.closeSync = closeSync
function closeSync (fd) {
try {
return originalCloseSync(fd)
} finally {
onclose()
}
}
// Req class
function Req () {
// start processing
this.done = this.done.bind(this)
this.failures = 0
this.process()
}
Req.prototype.done = function (er, result) {
var tryAgain = false
if (er) {
var code = er.code
var tryAgain = code === "EMFILE" || code === "ENFILE"
if (process.platform === "win32")
tryAgain = tryAgain || code === "OK"
}
if (tryAgain) {
this.failures ++
enqueue(this)
} else {
var cb = this.cb
cb(er, result)
}
}
var queue = []
function enqueue(req) {
queue.push(req)
debug('enqueue %d %s', queue.length, req.constructor.name, req)
}
function onclose() {
var req = queue.shift()
if (req) {
debug('process', req.constructor.name, req)
req.process()
}
}
-72
View File
@@ -1,72 +0,0 @@
{
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me",
"url": "http://blog.izs.me"
},
"name": "graceful-fs",
"description": "A drop-in replacement for fs, making various improvements.",
"version": "3.0.8",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/node-graceful-fs.git"
},
"main": "graceful-fs.js",
"engines": {
"node": ">=0.4.0"
},
"directories": {
"test": "test"
},
"scripts": {
"test": "tap test/*.js"
},
"keywords": [
"fs",
"module",
"reading",
"retry",
"retries",
"queue",
"error",
"errors",
"handling",
"EMFILE",
"EAGAIN",
"EINVAL",
"EPERM",
"EACCESS"
],
"license": "ISC",
"devDependencies": {
"mkdirp": "^0.5.0",
"rimraf": "^2.2.8",
"tap": "^1.2.0"
},
"gitHead": "45c57aa5e323c35a985a525de6f0c9a6ef59e1f8",
"bugs": {
"url": "https://github.com/isaacs/node-graceful-fs/issues"
},
"homepage": "https://github.com/isaacs/node-graceful-fs#readme",
"_id": "graceful-fs@3.0.8",
"_shasum": "ce813e725fa82f7e6147d51c9a5ca68270551c22",
"_from": "graceful-fs@>=3.0.0 <4.0.0",
"_npmVersion": "2.10.1",
"_nodeVersion": "2.0.1",
"_npmUser": {
"name": "isaacs",
"email": "isaacs@npmjs.com"
},
"dist": {
"shasum": "ce813e725fa82f7e6147d51c9a5ca68270551c22",
"tarball": "http://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.8.tgz"
},
"maintainers": [
{
"name": "isaacs",
"email": "i@izs.me"
}
],
"_resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.8.tgz",
"readme": "ERROR: No README data found!"
}
-255
View File
@@ -1,255 +0,0 @@
var fs = require('./fs.js')
var constants = require('constants')
var origCwd = process.cwd
var cwd = null
process.cwd = function() {
if (!cwd)
cwd = origCwd.call(process)
return cwd
}
var chdir = process.chdir
process.chdir = function(d) {
cwd = null
chdir.call(process, d)
}
// (re-)implement some things that are known busted or missing.
// lchmod, broken prior to 0.6.2
// back-port the fix here.
if (constants.hasOwnProperty('O_SYMLINK') &&
process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
fs.lchmod = function (path, mode, callback) {
callback = callback || noop
fs.open( path
, constants.O_WRONLY | constants.O_SYMLINK
, mode
, function (err, fd) {
if (err) {
callback(err)
return
}
// prefer to return the chmod error, if one occurs,
// but still try to close, and report closing errors if they occur.
fs.fchmod(fd, mode, function (err) {
fs.close(fd, function(err2) {
callback(err || err2)
})
})
})
}
fs.lchmodSync = function (path, mode) {
var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode)
// prefer to return the chmod error, if one occurs,
// but still try to close, and report closing errors if they occur.
var err, err2
try {
var ret = fs.fchmodSync(fd, mode)
} catch (er) {
err = er
}
try {
fs.closeSync(fd)
} catch (er) {
err2 = er
}
if (err || err2) throw (err || err2)
return ret
}
}
// lutimes implementation, or no-op
if (!fs.lutimes) {
if (constants.hasOwnProperty("O_SYMLINK")) {
fs.lutimes = function (path, at, mt, cb) {
fs.open(path, constants.O_SYMLINK, function (er, fd) {
cb = cb || noop
if (er) return cb(er)
fs.futimes(fd, at, mt, function (er) {
fs.close(fd, function (er2) {
return cb(er || er2)
})
})
})
}
fs.lutimesSync = function (path, at, mt) {
var fd = fs.openSync(path, constants.O_SYMLINK)
, err
, err2
, ret
try {
var ret = fs.futimesSync(fd, at, mt)
} catch (er) {
err = er
}
try {
fs.closeSync(fd)
} catch (er) {
err2 = er
}
if (err || err2) throw (err || err2)
return ret
}
} else if (fs.utimensat && constants.hasOwnProperty("AT_SYMLINK_NOFOLLOW")) {
// maybe utimensat will be bound soonish?
fs.lutimes = function (path, at, mt, cb) {
fs.utimensat(path, at, mt, constants.AT_SYMLINK_NOFOLLOW, cb)
}
fs.lutimesSync = function (path, at, mt) {
return fs.utimensatSync(path, at, mt, constants.AT_SYMLINK_NOFOLLOW)
}
} else {
fs.lutimes = function (_a, _b, _c, cb) { process.nextTick(cb) }
fs.lutimesSync = function () {}
}
}
// https://github.com/isaacs/node-graceful-fs/issues/4
// Chown should not fail on einval or eperm if non-root.
// It should not fail on enosys ever, as this just indicates
// that a fs doesn't support the intended operation.
fs.chown = chownFix(fs.chown)
fs.fchown = chownFix(fs.fchown)
fs.lchown = chownFix(fs.lchown)
fs.chmod = chownFix(fs.chmod)
fs.fchmod = chownFix(fs.fchmod)
fs.lchmod = chownFix(fs.lchmod)
fs.chownSync = chownFixSync(fs.chownSync)
fs.fchownSync = chownFixSync(fs.fchownSync)
fs.lchownSync = chownFixSync(fs.lchownSync)
fs.chmodSync = chownFix(fs.chmodSync)
fs.fchmodSync = chownFix(fs.fchmodSync)
fs.lchmodSync = chownFix(fs.lchmodSync)
function chownFix (orig) {
if (!orig) return orig
return function (target, uid, gid, cb) {
return orig.call(fs, target, uid, gid, function (er, res) {
if (chownErOk(er)) er = null
cb(er, res)
})
}
}
function chownFixSync (orig) {
if (!orig) return orig
return function (target, uid, gid) {
try {
return orig.call(fs, target, uid, gid)
} catch (er) {
if (!chownErOk(er)) throw er
}
}
}
// ENOSYS means that the fs doesn't support the op. Just ignore
// that, because it doesn't matter.
//
// if there's no getuid, or if getuid() is something other
// than 0, and the error is EINVAL or EPERM, then just ignore
// it.
//
// This specific case is a silent failure in cp, install, tar,
// and most other unix tools that manage permissions.
//
// When running as root, or if other types of errors are
// encountered, then it's strict.
function chownErOk (er) {
if (!er)
return true
if (er.code === "ENOSYS")
return true
var nonroot = !process.getuid || process.getuid() !== 0
if (nonroot) {
if (er.code === "EINVAL" || er.code === "EPERM")
return true
}
return false
}
// if lchmod/lchown do not exist, then make them no-ops
if (!fs.lchmod) {
fs.lchmod = function (path, mode, cb) {
process.nextTick(cb)
}
fs.lchmodSync = function () {}
}
if (!fs.lchown) {
fs.lchown = function (path, uid, gid, cb) {
process.nextTick(cb)
}
fs.lchownSync = function () {}
}
// on Windows, A/V software can lock the directory, causing this
// to fail with an EACCES or EPERM if the directory contains newly
// created files. Try again on failure, for up to 1 second.
if (process.platform === "win32") {
var rename_ = fs.rename
fs.rename = function rename (from, to, cb) {
var start = Date.now()
rename_(from, to, function CB (er) {
if (er
&& (er.code === "EACCES" || er.code === "EPERM")
&& Date.now() - start < 1000) {
return rename_(from, to, CB)
}
if(cb) cb(er)
})
}
}
// if read() returns EAGAIN, then just try it again.
var read = fs.read
fs.read = function (fd, buffer, offset, length, position, callback_) {
var callback
if (callback_ && typeof callback_ === 'function') {
var eagCounter = 0
callback = function (er, _, __) {
if (er && er.code === 'EAGAIN' && eagCounter < 10) {
eagCounter ++
return read.call(fs, fd, buffer, offset, length, position, callback)
}
callback_.apply(this, arguments)
}
}
return read.call(fs, fd, buffer, offset, length, position, callback)
}
var readSync = fs.readSync
fs.readSync = function (fd, buffer, offset, length, position) {
var eagCounter = 0
while (true) {
try {
return readSync.call(fs, fd, buffer, offset, length, position)
} catch (er) {
if (er.code === 'EAGAIN' && eagCounter < 10) {
eagCounter ++
continue
}
throw er
}
}
}
@@ -1,69 +0,0 @@
var test = require('tap').test
var fs = require('../')
test('open lots of stuff', function (t) {
// Get around EBADF from libuv by making sure that stderr is opened
// Otherwise Darwin will refuse to give us a FD for stderr!
process.stderr.write('')
// How many parallel open()'s to do
var n = 1024
var opens = 0
var fds = []
var going = true
var closing = false
var doneCalled = 0
for (var i = 0; i < n; i++) {
go()
}
function go() {
opens++
fs.open(__filename, 'r', function (er, fd) {
if (er) throw er
fds.push(fd)
if (going) go()
})
}
// should hit ulimit pretty fast
setTimeout(function () {
going = false
t.equal(opens - fds.length, n)
done()
}, 100)
function done () {
if (closing) return
doneCalled++
if (fds.length === 0) {
console.error('done called %d times', doneCalled)
// First because of the timeout
// Then to close the fd's opened afterwards
// Then this time, to complete.
// Might take multiple passes, depending on CPU speed
// and ulimit, but at least 3 in every case.
t.ok(doneCalled >= 2)
return t.end()
}
closing = true
setTimeout(function () {
// console.error('do closing again')
closing = false
done()
}, 100)
// console.error('closing time')
var closes = fds.slice(0)
fds.length = 0
closes.forEach(function (fd) {
fs.close(fd, function (er) {
if (er) throw er
})
})
}
})
-39
View File
@@ -1,39 +0,0 @@
var test = require('tap').test
var fs = require('../graceful-fs.js')
test('graceful fs is monkeypatched fs', function (t) {
t.equal(fs, require('../fs.js'))
t.end()
})
test('open an existing file works', function (t) {
var fd = fs.openSync(__filename, 'r')
fs.closeSync(fd)
fs.open(__filename, 'r', function (er, fd) {
if (er) throw er
fs.close(fd, function (er) {
if (er) throw er
t.pass('works')
t.end()
})
})
})
test('open a non-existing file throws', function (t) {
var er
try {
var fd = fs.openSync('this file does not exist', 'r')
} catch (x) {
er = x
}
t.ok(er, 'should throw')
t.notOk(fd, 'should not get an fd')
t.equal(er.code, 'ENOENT')
fs.open('neither does this file', 'r', function (er, fd) {
t.ok(er, 'should throw')
t.notOk(fd, 'should not get an fd')
t.equal(er.code, 'ENOENT')
t.end()
})
})
@@ -1,20 +0,0 @@
var test = require("tap").test
var fs = require("../fs.js")
var readdir = fs.readdir
fs.readdir = function(path, cb) {
process.nextTick(function() {
cb(null, ["b", "z", "a"])
})
}
var g = require("../")
test("readdir reorder", function (t) {
g.readdir("whatevers", function (er, files) {
if (er)
throw er
t.same(files, [ "a", "b", "z" ])
t.end()
})
})
@@ -1,47 +0,0 @@
var fs = require('../');
var rimraf = require('rimraf');
var mkdirp = require('mkdirp');
var test = require('tap').test;
var p = require('path').resolve(__dirname, 'files');
process.chdir(__dirname)
// Make sure to reserve the stderr fd
process.stderr.write('');
var num = 4097;
var paths = new Array(num);
test('make files', function (t) {
rimraf.sync(p);
mkdirp.sync(p);
for (var i = 0; i < num; ++i) {
paths[i] = 'files/file-' + i;
fs.writeFileSync(paths[i], 'content');
}
t.end();
})
test('read files', function (t) {
// now read them
var done = 0;
for (var i = 0; i < num; ++i) {
fs.readFile(paths[i], function(err, data) {
if (err)
throw err;
++done;
if (done === num) {
t.pass('success');
t.end()
}
});
}
});
test('cleanup', function (t) {
rimraf.sync(p);
t.end();
});
+8 -8
View File
@@ -20,7 +20,7 @@
},
"repository": {
"type": "git",
"url": "git://github.com/TooTallNate/node-gyp.git"
"url": "git://github.com/nodejs/node-gyp.git"
},
"preferGlobal": true,
"bin": {
@@ -30,7 +30,7 @@
"dependencies": {
"fstream": "^1.0.0",
"glob": "3 || 4",
"graceful-fs": "3",
"graceful-fs": "^4.1.2",
"minimatch": "1",
"mkdirp": "^0.5.0",
"nopt": "2 || 3",
@@ -52,15 +52,15 @@
"scripts": {
"test": "tape test/test-*"
},
"gitHead": "d8c81a46a2e9c5bda0bfa90c437e5be806311cec",
"readme": "node-gyp\n=========\n### Node.js native addon build tool\n\n`node-gyp` is a cross-platform command-line tool written in Node.js for compiling\nnative addon modules for Node.js. It bundles the [gyp](https://code.google.com/p/gyp/)\nproject used by the Chromium team and takes away the pain of dealing with the\nvarious differences in build platforms. It is the replacement to the `node-waf`\nprogram which is removed for node `v0.8`. If you have a native addon for node that\nstill has a `wscript` file, then you should definitely add a `binding.gyp` file\nto support the latest versions of node.\n\nMultiple target versions of node are supported (i.e. `0.8`, `0.9`, `0.10`, ..., `1.0`,\netc.), regardless of what version of node is actually installed on your system\n(`node-gyp` downloads the necessary development files for the target version).\n\n#### Features:\n\n * Easy to use, consistent interface\n * Same commands to build your module on every platform\n * Supports multiple target versions of Node\n\n\nInstallation\n------------\n\nYou can install with `npm`:\n\n``` bash\n$ npm install -g node-gyp\n```\n\nYou will also need to install:\n\n * On Unix:\n * `python` (`v2.7` recommended, `v3.x.x` is __*not*__ supported)\n * `make`\n * A proper C/C++ compiler toolchain, like [GCC](https://gcc.gnu.org)\n * On Mac OS X:\n * `python` (`v2.7` recommended, `v3.x.x` is __*not*__ supported) (already installed on Mac OS X)\n * [Xcode](https://developer.apple.com/xcode/downloads/)\n * You also need to install the `Command Line Tools` via Xcode. You can find this under the menu `Xcode -> Preferences -> Downloads`\n * This step will install `gcc` and the related toolchain containing `make`\n * On Windows:\n * [Python][windows-python] ([`v2.7.3`][windows-python-v2.7.3] recommended, `v3.x.x` is __*not*__ supported)\n * Make sure that you have a PYTHON environment variable, and it is set to drive:\\path\\to\\python.exe not to a folder\n * Windows XP/Vista/7:\n * Microsoft Visual Studio C++ 2013 ([Express][msvc2013] version works well)\n * If the install fails, try uninstalling any C++ 2010 x64&x86 Redistributable that you have installed first\n * If you get errors that the 64-bit compilers are not installed you may also need the [compiler update for the Windows SDK 7.1]\n * Windows 7/8:\n * Microsoft Visual Studio C++ 2013 for Windows Desktop ([Express][msvc2013] version works well)\n * All Windows Versions\n * For 64-bit builds of node and native modules you will _**also**_ need the [Windows 7 64-bit SDK][win7sdk]\n * You may need to run one of the following commands if your build complains about WindowsSDKDir not being set, and you are sure you have already installed the SDK:\n\n```\ncall \"C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\bin\\Setenv.cmd\" /Release /x86\ncall \"C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\bin\\Setenv.cmd\" /Release /x64\n```\n\nIf you have multiple Python versions installed, you can identify which Python\nversion `node-gyp` uses by setting the '--python' variable:\n\n``` bash\n$ node-gyp --python /path/to/python2.7\n```\n\nIf `node-gyp` is called by way of `npm` *and* you have multiple versions of\nPython installed, then you can set `npm`'s 'python' config key to the appropriate\nvalue:\n\n``` bash\n$ npm config set python /path/to/executable/python2.7\n```\n\nNote that OS X is just a flavour of Unix and so needs `python`, `make`, and C/C++.\nAn easy way to obtain these is to install XCode from Apple,\nand then use it to install the command line tools (under Preferences -> Downloads).\n\nHow to Use\n----------\n\nTo compile your native addon, first go to its root directory:\n\n``` bash\n$ cd my_node_addon\n```\n\nThe next step is to generate the appropriate project build files for the current\nplatform. Use `configure` for that:\n\n``` bash\n$ node-gyp configure\n```\n\n__Note__: The `configure` step looks for the `binding.gyp` file in the current\ndirectory to process. See below for instructions on creating the `binding.gyp` file.\n\nNow you will have either a `Makefile` (on Unix platforms) or a `vcxproj` file\n(on Windows) in the `build/` directory. Next invoke the `build` command:\n\n``` bash\n$ node-gyp build\n```\n\nNow you have your compiled `.node` bindings file! The compiled bindings end up\nin `build/Debug/` or `build/Release/`, depending on the build mode. At this point\nyou can require the `.node` file with Node and run your tests!\n\n__Note:__ To create a _Debug_ build of the bindings file, pass the `--debug` (or\n`-d`) switch when running either the `configure`, `build` or `rebuild` command.\n\n\nThe \"binding.gyp\" file\n----------------------\n\nPreviously when node had `node-waf` you had to write a `wscript` file. The\nreplacement for that is the `binding.gyp` file, which describes the configuration\nto build your module in a JSON-like format. This file gets placed in the root of\nyLine truncated
"gitHead": "5aaec1144ca4482b3d99e2818cf6cafe34f266f5",
"readme": "node-gyp\n=========\n### Node.js native addon build tool\n\n`node-gyp` is a cross-platform command-line tool written in Node.js for compiling\nnative addon modules for Node.js. It bundles the [gyp](https://code.google.com/p/gyp/)\nproject used by the Chromium team and takes away the pain of dealing with the\nvarious differences in build platforms. It is the replacement to the `node-waf`\nprogram which is removed for node `v0.8`. If you have a native addon for node that\nstill has a `wscript` file, then you should definitely add a `binding.gyp` file\nto support the latest versions of node.\n\nMultiple target versions of node are supported (i.e. `0.8`, `0.9`, `0.10`, ..., `1.0`,\netc.), regardless of what version of node is actually installed on your system\n(`node-gyp` downloads the necessary development files for the target version).\n\n#### Features:\n\n * Easy to use, consistent interface\n * Same commands to build your module on every platform\n * Supports multiple target versions of Node\n\n\nInstallation\n------------\n\nYou can install with `npm`:\n\n``` bash\n$ npm install -g node-gyp\n```\n\nYou will also need to install:\n\n * On Unix:\n * `python` (`v2.7` recommended, `v3.x.x` is __*not*__ supported)\n * `make`\n * A proper C/C++ compiler toolchain, like [GCC](https://gcc.gnu.org)\n * On Mac OS X:\n * `python` (`v2.7` recommended, `v3.x.x` is __*not*__ supported) (already installed on Mac OS X)\n * [Xcode](https://developer.apple.com/xcode/downloads/)\n * You also need to install the `Command Line Tools` via Xcode. You can find this under the menu `Xcode -> Preferences -> Downloads`\n * This step will install `gcc` and the related toolchain containing `make`\n * On Windows:\n * [Python][windows-python] ([`v2.7.3`][windows-python-v2.7.3] recommended, `v3.x.x` is __*not*__ supported)\n * Make sure that you have a PYTHON environment variable, and it is set to drive:\\path\\to\\python.exe not to a folder\n * Windows XP/Vista/7:\n * Microsoft Visual Studio C++ 2013 ([Express][msvc2013] version works well)\n * If the install fails, try uninstalling any C++ 2010 x64&x86 Redistributable that you have installed first\n * If you get errors that the 64-bit compilers are not installed you may also need the [compiler update for the Windows SDK 7.1]\n * Windows 7/8:\n * Microsoft Visual Studio C++ 2013 for Windows Desktop ([Express][msvc2013] version works well)\n * All Windows Versions\n * For 64-bit builds of node and native modules you will _**also**_ need the [Windows 7 64-bit SDK][win7sdk]\n * You may need to run one of the following commands if your build complains about WindowsSDKDir not being set, and you are sure you have already installed the SDK:\n\n```\ncall \"C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\bin\\Setenv.cmd\" /Release /x86\ncall \"C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\bin\\Setenv.cmd\" /Release /x64\n```\n\nIf you have multiple Python versions installed, you can identify which Python\nversion `node-gyp` uses by setting the '--python' variable:\n\n``` bash\n$ node-gyp --python /path/to/python2.7\n```\n\nIf `node-gyp` is called by way of `npm` *and* you have multiple versions of\nPython installed, then you can set `npm`'s 'python' config key to the appropriate\nvalue:\n\n``` bash\n$ npm config set python /path/to/executable/python2.7\n```\n\nNote that OS X is just a flavour of Unix and so needs `python`, `make`, and C/C++.\nAn easy way to obtain these is to install XCode from Apple,\nand then use it to install the command line tools (under Preferences -> Downloads).\n\nHow to Use\n----------\n\nTo compile your native addon, first go to its root directory:\n\n``` bash\n$ cd my_node_addon\n```\n\nThe next step is to generate the appropriate project build files for the current\nplatform. Use `configure` for that:\n\n``` bash\n$ node-gyp configure\n```\n\n__Note__: The `configure` step looks for the `binding.gyp` file in the current\ndirectory to process. See below for instructions on creating the `binding.gyp` file.\n\nNow you will have either a `Makefile` (on Unix platforms) or a `vcxproj` file\n(on Windows) in the `build/` directory. Next invoke the `build` command:\n\n``` bash\n$ node-gyp build\n```\n\nNow you have your compiled `.node` bindings file! The compiled bindings end up\nin `build/Debug/` or `build/Release/`, depending on the build mode. At this point\nyou can require the `.node` file with Node and run your tests!\n\n__Note:__ To create a _Debug_ build of the bindings file, pass the `--debug` (or\n`-d`) switch when running either the `configure`, `build` or `rebuild` command.\n\n\nThe \"binding.gyp\" file\n----------------------\n\nPreviously when node had `node-waf` you had to write a `wscript` file. The\nreplacement for that is the `binding.gyp` file, which describes the configuration\nto build your module in a JSON-like format. This file gets placed in the root of\nyLine truncated
"readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/TooTallNate/node-gyp/issues"
"url": "https://github.com/nodejs/node-gyp/issues"
},
"homepage": "https://github.com/TooTallNate/node-gyp",
"homepage": "https://github.com/nodejs/node-gyp",
"_id": "node-gyp@2.0.2",
"_shasum": "2953c3b64cc714946c7ef915e1dbd1bef2e32643",
"_shasum": "7ab3feebc675f6162b5a68c2df339b9ca33bf5cb",
"_from": "nodejs/node-gyp#process.release",
"_resolved": "git://github.com/nodejs/node-gyp.git#d8c81a46a2e9c5bda0bfa90c437e5be806311cec"
"_resolved": "git://github.com/nodejs/node-gyp.git#5aaec1144ca4482b3d99e2818cf6cafe34f266f5"
}
+75 -18
View File
@@ -5,25 +5,28 @@
test_node_versions="0.8.28 0.10.40 0.12.7"
test_iojs_versions="1.8.4 2.4.0 3.3.0"
__dirname="$(CDPATH= cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
dot_node_gyp=${__dirname}/.node-gyp/
# borrows from https://github.com/rvagg/dnt/
# Simple setup function for a container:
# setup_container(image id, base image, commands to run to set up)
setup_container() {
local ID=$1
local BASE=$2
local RUN=$3
local container_id="$1"
local base_container="$2"
local run_cmd="$3"
# Does this image exist? If yes, ignore
docker inspect "$ID" &> /dev/null
docker inspect "$container_id" &> /dev/null
if [[ $? -eq 0 ]]; then
echo "Found existing container [$ID]"
echo "Found existing container [$container_id]"
else
# No such image, so make it
echo "Did not find container [$ID], creating..."
docker run -i $BASE /bin/bash -c "$RUN"
echo "Did not find container [$container_id], creating..."
docker run -i $base_container /bin/bash -c "$run_cmd"
sleep 2
docker commit $(docker ps -l -q) $ID
docker commit $(docker ps -l -q) $container_id
fi
}
@@ -31,16 +34,22 @@ setup_container() {
# so it'll be invoked by npm when a compile is needed
# run_tests(version, test-commands)
run_tests() {
local VERSION=$1
local RUN=$2
local version="$1"
local run_cmd="$2"
RUN="rsync -aAXx --delete --exclude .git --exclude build /node-gyp-src/ /usr/lib/node_modules/npm/node_modules/node-gyp/;
/bin/su -s /bin/bash node-gyp -c 'cd && ${RUN}'"
run_cmd="rsync -aAXx --delete --exclude .git --exclude build /node-gyp-src/ /usr/lib/node_modules/npm/node_modules/node-gyp/;
/bin/su -s /bin/bash node-gyp -c 'cd && ${run_cmd}'"
docker run --rm -v ~/.npm/:/dnt/.npm/ -v $(pwd):/node-gyp-src/:ro -i node-gyp-test/${VERSION} /bin/bash -c "$RUN"
rm -rf $dot_node_gyp
docker run \
--rm -i \
-v ~/.npm/:/node-gyp/.npm/ \
-v ${dot_node_gyp}:/node-gyp/.node-gyp/ \
-v $(pwd):/node-gyp-src/:ro \
node-gyp-test/${version} /bin/bash -c "${run_cmd}"
}
# A base image with build tools and a user account
setup_container "node-gyp-test/base" "ubuntu:14.04" "
apt-get update &&
@@ -74,13 +83,61 @@ for v in $test_iojs_versions; do
"
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 &&
cd node-bignum && npm install --loglevel=info && npm test
cd node-buffertools && npm install --loglevel=info && npm test && cd
"
done
# 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"
local expected_dir="$2"
local expected_ver="$3"
run_tests $run_with_ver "cd node-buffertools && npm install --loglevel=info --target=${expected_ver}"
local node_ver=$(cat "${dot_node_gyp}${expected_dir}/node_version.h" | grep '#define NODE_\w*_VERSION [0-9]*$')
node_ver=$(echo $node_ver | sed 's/#define NODE_[A-Z]*_VERSION //g' | sed 's/ /./g')
if [ "X$(echo $node_ver)" != "X${expected_ver}" ]; then
echo "Did not download v${expected_ver} using --target, instead got: $(echo $node_ver)"
exit 1
fi
echo "Verified correct download of [v${node_ver}]"
}
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.2.0/include/node" "3.2.0"
# TODO: test --dist-url by starting up a localhost server and serving up tarballs
# testing --dist-url, using simple-proxy.js to make localhost work as a distribution
# 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\"
"
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\"
"
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\"
"
rm -rf $dot_node_gyp
+24
View File
@@ -0,0 +1,24 @@
var http = require('http')
, https = require('https')
, server = http.createServer(handler)
, port = +process.argv[2]
, prefix = process.argv[3]
, upstream = process.argv[4]
, calls = 0
server.listen(port)
function handler (req, res) {
if (req.url.indexOf(prefix) != 0)
throw new Error('request url [' + req.url + '] does not start with [' + prefix + ']')
var upstreamUrl = upstream + req.url.substring(prefix.length)
console.log(req.url + ' -> ' + upstreamUrl)
https.get(upstreamUrl, function (ures) {
ures.on('end', function () {
if (++calls == 2)
server.close()
})
ures.pipe(res)
})
}
+139 -32
View File
@@ -14,9 +14,7 @@ test('test process release - process.version = 0.8.20', function (t) {
name: 'node',
baseUrl: 'https://nodejs.org/dist/v0.8.20/',
tarballUrl: 'https://nodejs.org/dist/v0.8.20/node-v0.8.20.tar.gz',
shasumsFile: 'SHASUMS.txt',
shasumsUrl: 'https://nodejs.org/dist/v0.8.20/SHASUMS.txt',
checksumAlgo: 'sha1',
shasumsUrl: 'https://nodejs.org/dist/v0.8.20/SHASUMS256.txt',
versionDir: '0.8.20',
libUrl32: 'https://nodejs.org/dist/v0.8.20/node.lib',
libUrl64: 'https://nodejs.org/dist/v0.8.20/x64/node.lib',
@@ -38,9 +36,7 @@ test('test process release - process.version = 0.10.21', function (t) {
name: 'node',
baseUrl: 'https://nodejs.org/dist/v0.10.21/',
tarballUrl: 'https://nodejs.org/dist/v0.10.21/node-v0.10.21.tar.gz',
shasumsFile: 'SHASUMS256.txt',
shasumsUrl: 'https://nodejs.org/dist/v0.10.21/SHASUMS256.txt',
checksumAlgo: 'sha256',
versionDir: '0.10.21',
libUrl32: 'https://nodejs.org/dist/v0.10.21/node.lib',
libUrl64: 'https://nodejs.org/dist/v0.10.21/x64/node.lib',
@@ -62,9 +58,7 @@ test('test process release - process.version = 0.12.22', function (t) {
name: 'node',
baseUrl: 'https://nodejs.org/dist/v0.12.22/',
tarballUrl: 'https://nodejs.org/dist/v0.12.22/node-v0.12.22.tar.gz',
shasumsFile: 'SHASUMS256.txt',
shasumsUrl: 'https://nodejs.org/dist/v0.12.22/SHASUMS256.txt',
checksumAlgo: 'sha256',
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',
@@ -89,9 +83,7 @@ test('test process release - process.release ~ node@4.1.23', function (t) {
name: 'node',
baseUrl: 'https://nodejs.org/dist/v4.1.23/',
tarballUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz',
shasumsFile: 'SHASUMS256.txt',
shasumsUrl: 'https://nodejs.org/dist/v4.1.23/SHASUMS256.txt',
checksumAlgo: 'sha256',
versionDir: '4.1.23',
libUrl32: 'https://nodejs.org/dist/v4.1.23/win-x86/node.lib',
libUrl64: 'https://nodejs.org/dist/v4.1.23/win-x64/node.lib',
@@ -116,9 +108,7 @@ test('test process release - process.release ~ node@4.1.23 / corp build', functi
name: 'node',
baseUrl: 'https://some.custom.location/',
tarballUrl: 'https://some.custom.location/node-v4.1.23-headers.tar.gz',
shasumsFile: 'SHASUMS256.txt',
shasumsUrl: 'https://some.custom.location/SHASUMS256.txt',
checksumAlgo: 'sha256',
versionDir: '4.1.23',
libUrl32: 'https://some.custom.location/win-x86/node.lib',
libUrl64: 'https://some.custom.location/win-x64/node.lib',
@@ -140,9 +130,7 @@ test('test process release - process.version = 1.8.4', function (t) {
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',
shasumsFile: 'SHASUMS256.txt',
shasumsUrl: 'https://iojs.org/download/release/v1.8.4/SHASUMS256.txt',
checksumAlgo: 'sha256',
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',
@@ -167,9 +155,7 @@ test('test process release - process.release ~ iojs@3.2.24', function (t) {
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',
shasumsFile: 'SHASUMS256.txt',
shasumsUrl: 'https://iojs.org/download/release/v3.2.24/SHASUMS256.txt',
checksumAlgo: 'sha256',
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',
@@ -184,7 +170,7 @@ test('test process release - process.release ~ iojs@3.2.11 +libUrl32', function
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/libdir-x86/iojs.lib' // custom
libUrl: 'https://iojs.org/download/release/v3.2.11/win-x86/iojs.lib' // custom
})
t.equal(release.semver.version, '3.2.11')
@@ -195,14 +181,12 @@ test('test process release - process.release ~ iojs@3.2.11 +libUrl32', function
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',
shasumsFile: 'SHASUMS256.txt',
shasumsUrl: 'https://iojs.org/download/release/v3.2.11/SHASUMS256.txt',
checksumAlgo: 'sha256',
versionDir: 'iojs-3.2.11',
libUrl32: 'https://iojs.org/download/release/v3.2.11/libdir-x86/iojs.lib',
libUrl64: 'https://iojs.org/download/release/v3.2.11/libdir-x64/iojs.lib',
libPath32: 'libdir-x86/iojs.lib',
libPath64: 'libdir-x64/iojs.lib'
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'
})
})
@@ -212,7 +196,7 @@ test('test process release - process.release ~ iojs@3.2.101 +libUrl64', function
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/libdir-x64/iojs.lib' // custom
libUrl: 'https://iojs.org/download/release/v3.2.101/win-x64/iojs.lib' // custom
})
t.equal(release.semver.version, '3.2.101')
@@ -223,18 +207,16 @@ test('test process release - process.release ~ iojs@3.2.101 +libUrl64', function
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',
shasumsFile: 'SHASUMS256.txt',
shasumsUrl: 'https://iojs.org/download/release/v3.2.101/SHASUMS256.txt',
checksumAlgo: 'sha256',
versionDir: 'iojs-3.2.101',
libUrl32: 'https://iojs.org/download/release/v3.2.101/libdir-x86/iojs.lib',
libUrl64: 'https://iojs.org/download/release/v3.2.101/libdir-x64/iojs.lib',
libPath32: 'libdir-x86/iojs.lib',
libPath64: 'libdir-x64/iojs.lib'
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 ~ iojs@3.3.0 - borked libdir', function (t) {
test('test process release - process.release ~ iojs@3.3.0 - borked win-ia32', function (t) {
t.plan(2)
var release = processRelease([], { opts: {} }, 'v3.2.101', {
@@ -251,9 +233,7 @@ test('test process release - process.release ~ iojs@3.3.0 - borked libdir', func
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',
shasumsFile: 'SHASUMS256.txt',
shasumsUrl: 'https://iojs.org/download/release/v3.2.101/SHASUMS256.txt',
checksumAlgo: 'sha256',
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',
@@ -261,3 +241,130 @@ test('test process release - process.release ~ iojs@3.3.0 - borked libdir', func
libPath64: 'win-x64/iojs.lib'
})
})
test('test process release - process.release ~ node@4.1.23 --target=0.10.40', function (t) {
t.plan(2)
var release = processRelease([], { opts: { target: '0.10.40' } }, '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, '0.10.40')
delete release.semver
t.deepEqual(release, {
version: '0.10.40',
name: 'node',
baseUrl: 'https://nodejs.org/dist/v0.10.40/',
tarballUrl: 'https://nodejs.org/dist/v0.10.40/node-v0.10.40.tar.gz',
shasumsUrl: 'https://nodejs.org/dist/v0.10.40/SHASUMS256.txt',
versionDir: '0.10.40',
libUrl32: 'https://nodejs.org/dist/v0.10.40/node.lib',
libUrl64: 'https://nodejs.org/dist/v0.10.40/x64/node.lib',
libPath32: 'node.lib',
libPath64: 'x64/node.lib'
})
})
test('test process release - process.release ~ node@4.1.23 --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 ~ node@4.1.23 --dist-url=https://foo.bar/baz', function (t) {
t.plan(2)
var release = processRelease([], { opts: { 'dist-url': 'https://foo.bar/baz' } }, '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: 'https://foo.bar/baz/v4.1.23/',
tarballUrl: 'https://foo.bar/baz/v4.1.23/node-v4.1.23-headers.tar.gz',
shasumsUrl: 'https://foo.bar/baz/v4.1.23/SHASUMS256.txt',
versionDir: '4.1.23',
libUrl32: 'https://foo.bar/baz/v4.1.23/win-x86/node.lib',
libUrl64: 'https://foo.bar/baz/v4.1.23/win-x64/node.lib',
libPath32: 'win-x86/node.lib',
libPath64: 'win-x64/node.lib'
})
})
test('test process release - process.release ~ frankenstein@4.1.23', function (t) {
t.plan(2)
var release = processRelease([], { opts: {} }, 'v4.1.23', {
name: 'frankenstein',
headersUrl: 'https://frankensteinjs.org/dist/v4.1.23/frankenstein-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: 'frankenstein',
baseUrl: 'https://frankensteinjs.org/dist/v4.1.23/',
tarballUrl: 'https://frankensteinjs.org/dist/v4.1.23/frankenstein-v4.1.23-headers.tar.gz',
shasumsUrl: 'https://frankensteinjs.org/dist/v4.1.23/SHASUMS256.txt',
versionDir: 'frankenstein-4.1.23',
libUrl32: 'https://frankensteinjs.org/dist/v4.1.23/win-x86/frankenstein.lib',
libUrl64: 'https://frankensteinjs.org/dist/v4.1.23/win-x64/frankenstein.lib',
libPath32: 'win-x86/frankenstein.lib',
libPath64: 'win-x64/frankenstein.lib'
})
})
test('test process release - process.release ~ frankenstein@4.1.23 --dist-url=http://foo.bar/baz/', function (t) {
t.plan(2)
var release = processRelease([], { opts: { 'dist-url': 'http://foo.bar/baz/' } }, 'v4.1.23', {
name: 'frankenstein',
headersUrl: 'https://frankensteinjs.org/dist/v4.1.23/frankenstein-v4.1.23.tar.gz'
})
t.equal(release.semver.version, '4.1.23')
delete release.semver
t.deepEqual(release, {
version: '4.1.23',
name: 'frankenstein',
baseUrl: 'http://foo.bar/baz/v4.1.23/',
tarballUrl: 'http://foo.bar/baz/v4.1.23/frankenstein-v4.1.23-headers.tar.gz',
shasumsUrl: 'http://foo.bar/baz/v4.1.23/SHASUMS256.txt',
versionDir: 'frankenstein-4.1.23',
libUrl32: 'http://foo.bar/baz/v4.1.23/win-x86/frankenstein.lib',
libUrl64: 'http://foo.bar/baz/v4.1.23/win-x64/frankenstein.lib',
libPath32: 'win-x86/frankenstein.lib',
libPath64: 'win-x64/frankenstein.lib'
})
})