Skip to content

Commit

Permalink
dist-indexer: fix libuv version generation (#6)
Browse files Browse the repository at this point in the history
* dist-indexer: fix libuv version generation

Beginning in nodejs/node@537a4ba,
`deps/uv/include/uv-version.h` moved to `deps/uv/include/uv/version.h`, so add
that as a possible path where libuv's version might be stored.

Refs: nodejs/node#21466
  • Loading branch information
maclover7 authored and rvagg committed Aug 2, 2018
1 parent b1ba460 commit 9ba1f31
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions dist-indexer.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const fs = require('fs')
`${githubContentUrl}/deps/uv/include/uv-version.h`
, `${githubContentUrl}/deps/uv/src/version.c`
, `${githubContentUrl}/deps/uv/include/uv.h`
, `${githubContentUrl}/deps/uv/include/uv/version.h`
]
, sslVersionUrl = [
`${githubContentUrl}/deps/openssl/openssl/include/openssl/opensslv.h`
Expand Down Expand Up @@ -161,7 +162,6 @@ function fetchV8Version (gitref, callback) {
})
}


function fetchUvVersion (gitref, callback) {
var version = cacheGet(gitref, 'uv')
if (version || (/\/v0\.([01234]\.\d+|5\.0)$/).test(gitref))
Expand Down Expand Up @@ -210,8 +210,25 @@ function fetchUvVersion (gitref, callback) {
.map(function (m) { return m[1] })
.join('.')

cachePut(gitref, 'uv', version)
callback(null, version)
if (version) {
cachePut(gitref, 'uv', version)
return callback(null, version)
}

fetch(uvVersionUrl[3], gitref, function (err, rawData) {
if (err)
return callback(err)

version = rawData.split('\n').map(function (line) {
return line.match(/^#define UV_VERSION_(?:MAJOR|MINOR|PATCH)\s+(\d+)$/)
})
.filter(Boolean)
.map(function (m) { return m[1] })
.join('.')

cachePut(gitref, 'uv', version)
callback(null, version)
})
})
})
})
Expand Down

0 comments on commit 9ba1f31

Please sign in to comment.