From 2bd93956390bf7231afc7b664540d721f8fedfbe Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Mon, 12 Jun 2017 20:45:56 +1000 Subject: [PATCH] support v8-canary builds --- decode-ref.js | 27 ++++++++++++++++----------- dist-indexer.js | 24 ++++++++++++++---------- package.json | 4 ++-- transform-filename.js | 10 +++++++++- 4 files changed, 41 insertions(+), 24 deletions(-) diff --git a/decode-ref.js b/decode-ref.js index de41994..44071a3 100644 --- a/decode-ref.js +++ b/decode-ref.js @@ -1,10 +1,14 @@ const assert = require('assert') - , dirre = /^(v\d+\.\d+\.\d+(?:-rc\.\d+)?)(?:-(?:(?:next-)?nightly|test)\d{8}(\w+))?$/ // get version or commit from dir name + , dirre = /^(v\d+\.\d+\.\d+(?:-rc\.\d+)?)(?:-((?:next-)?nightly|test|v8-canary)\d{8}(\w+))?$/ // get version or commit from dir name function decodeRef (dir) { var m = dir.match(dirre) - return m && (m[2] || m[1]) + if (!m) + return null + if (!m[2]) + return `node/${m[1]}` + return `${m[2] == 'v8-canary' ? 'v8-canary' : 'node'}/${m[3]}` } @@ -13,15 +17,16 @@ module.exports = decodeRef if (module === require.main) { var tests = [ - { dir: 'v1.0.0' , ref: 'v1.0.0' } - , { dir: 'v10.11.12' , ref: 'v10.11.12' } - , { dir: 'v2.3.2-nightly20150625dcbb9e1da6' , ref: 'dcbb9e1da6' } - , { dir: 'v2.3.1-next-nightly201506308f6f4280c6' , ref: '8f6f4280c6' } - , { dir: 'v3.0.0-rc.1' , ref: 'v3.0.0-rc.1' } - , { dir: 'v33.22.1-rc.111' , ref: 'v33.22.1-rc.111' } - , { dir: 'v0.6.1' , ref: 'v0.6.1' } - , { dir: 'v0.5.1' , ref: 'v0.5.1' } - , { dir: 'v6.0.0-test20151107093b0e865c' , ref: '093b0e865c' } + { dir: 'v1.0.0' , ref: 'node/v1.0.0' } + , { dir: 'v10.11.12' , ref: 'node/v10.11.12' } + , { dir: 'v2.3.2-nightly20150625dcbb9e1da6' , ref: 'node/dcbb9e1da6' } + , { dir: 'v2.3.1-next-nightly201506308f6f4280c6' , ref: 'node/8f6f4280c6' } + , { dir: 'v3.0.0-rc.1' , ref: 'node/v3.0.0-rc.1' } + , { dir: 'v33.22.1-rc.111' , ref: 'node/v33.22.1-rc.111' } + , { dir: 'v0.6.1' , ref: 'node/v0.6.1' } + , { dir: 'v0.5.1' , ref: 'node/v0.5.1' } + , { dir: 'v6.0.0-test20151107093b0e865c' , ref: 'node/093b0e865c' } + , { dir: 'v9.0.0-v8-canary20170609cd40078f1f' , ref: 'v8-canary/cd40078f1f' } ] tests.forEach(function (test) { diff --git a/dist-indexer.js b/dist-indexer.js index 0916e05..442a6f5 100755 --- a/dist-indexer.js +++ b/dist-indexer.js @@ -81,12 +81,16 @@ function cachePut (gitref, prop, value) { function fetch (url, gitref, callback) { - let repo = (/^v0\.\d\./).test(gitref) - ? 'node-v0.x-archive' - : 'node' - url = url.replace('{gitref}', gitref) + let refparts = gitref.split('/') + let repo = refparts[0] == 'v8-canary' + ? 'node-v8' + : (/^v0\.\d\./).test(refparts[1]) + ? 'node-v0.x-archive' + : 'node' + + url = url.replace('{gitref}', refparts[1]) .replace('{repo}', repo) - + `?rev=${gitref}` + + `?rev=${refparts[1]}` hyperquest.get(url, githubOptions).pipe(bl(function (err, data) { if (err) return callback(err) @@ -98,7 +102,7 @@ function fetch (url, gitref, callback) { function fetchNpmVersion (gitref, callback) { var version = cacheGet(gitref, 'npm') - if (version || (/^v0\.([012345]\.\d+|6\.[0-2])$/).test(gitref)) + if (version || (/\/v0\.([012345]\.\d+|6\.[0-2])$/).test(gitref)) return setImmediate(callback.bind(null, null, version)) fetch(npmPkgJsonUrl, gitref, function (err, rawData) { @@ -160,7 +164,7 @@ function fetchV8Version (gitref, callback) { function fetchUvVersion (gitref, callback) { var version = cacheGet(gitref, 'uv') - if (version || (/^v0\.([01234]\.\d+|5\.0)$/).test(gitref)) + if (version || (/\/v0\.([01234]\.\d+|5\.0)$/).test(gitref)) return setImmediate(callback.bind(null, null, version)) fetch(uvVersionUrl[0], gitref, function (err, rawData) { @@ -216,7 +220,7 @@ function fetchUvVersion (gitref, callback) { function fetchSslVersion (gitref, callback) { var version = cacheGet(gitref, 'ssl') - if (version || (/^v0\.([01234]\.\d+|5\.[0-4])$/).test(gitref)) + if (version || (/\/v0\.([01234]\.\d+|5\.[0-4])$/).test(gitref)) return setImmediate(callback.bind(null, null, version)) fetch(sslVersionUrl[0], gitref, function (err, rawData) { @@ -249,7 +253,7 @@ function fetchSslVersion (gitref, callback) { function fetchZlibVersion (gitref, callback) { var version = cacheGet(gitref, 'zlib') - if (version || (/^v0\.([01234]\.\d+|5\.[0-7])$/).test(gitref)) + if (version || (/\/v0\.([01234]\.\d+|5\.[0-7])$/).test(gitref)) return setImmediate(callback.bind(null, null, version)) fetch(zlibVersionUrl, gitref, function (err, rawData) { @@ -267,7 +271,7 @@ function fetchZlibVersion (gitref, callback) { function fetchModVersion (gitref, callback) { var version = cacheGet(gitref, 'mod') - if (version || (/^v0\.1\.\d+$/).test(gitref)) + if (version || (/\/v0\.1\.\d+$/).test(gitref)) return setImmediate(callback.bind(null, null, version)) fetch(modVersionUrl[0], gitref, function (err, rawData) { diff --git a/package.json b/package.json index 3c9b342..a288547 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,8 @@ }, "dependencies": { "after": "~0.8.2", - "bl": "~1.1.2", - "hyperquest": "~1.0.1", + "bl": "~1.2.1", + "hyperquest": "~2.1.2", "map-async": "~0.1.1", "minimist": "~1.2.0", "semver": "~5.3.0" diff --git a/transform-filename.js b/transform-filename.js index 9e42ded..eb4992d 100644 --- a/transform-filename.js +++ b/transform-filename.js @@ -28,7 +28,7 @@ const assert = require('assert') function transformFilename (file) { - file = file && file.replace(/^(?:\.\/)?(?:iojs|node)-v\d+\.\d+\.\d+-?((rc\.\d+|(next-)?nightly\d{8}[^-\.]+)-?)?\.?/, '') + file = file && file.replace(/^(?:\.\/)?(?:iojs|node)-v\d+\.\d+\.\d+-?((rc\.\d+|(?:(next-)?nightly|test|v8-canary)\d{8}[^-\.]+)-?)?\.?/, '') .replace(/\.tar\.gz$/, '') return types[file] } @@ -125,6 +125,14 @@ if (module === require.main) { , { file: 'node-v0.11.9.tar.gz', type: 'src' } , { file: 'node.exe', type: 'win-x86-exe' } , { file: 'x64/node.exe', type: 'win-x64-exe' } + , { file: 'node-v9.0.0-v8-canary20170609cd40078f1f-darwin-x64.tar.gz', type: 'osx-x64-tar' } + , { file: 'node-v9.0.0-v8-canary20170609cd40078f1f-darwin-x64.tar.xz' } + , { file: 'node-v9.0.0-v8-canary20170609cd40078f1f-headers.tar.gz', type: 'headers' } + , { file: 'node-v9.0.0-v8-canary20170609cd40078f1f-headers.tar.xz' } + , { file: 'node-v9.0.0-test20170609cd40078f1f-darwin-x64.tar.gz', type: 'osx-x64-tar' } + , { file: 'node-v9.0.0-test20170609cd40078f1f-darwin-x64.tar.xz' } + , { file: 'node-v9.0.0-test20170609cd40078f1f-headers.tar.gz', type: 'headers' } + , { file: 'node-v9.0.0-test20170609cd40078f1f-headers.tar.xz' } ] tests.forEach(function (test) {