Skip to content

Commit 9ba1f31

Browse files
maclover7rvagg
authored andcommitted
dist-indexer: fix libuv version generation (#6)
* 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
1 parent b1ba460 commit 9ba1f31

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

dist-indexer.js

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const fs = require('fs')
2727
`${githubContentUrl}/deps/uv/include/uv-version.h`
2828
, `${githubContentUrl}/deps/uv/src/version.c`
2929
, `${githubContentUrl}/deps/uv/include/uv.h`
30+
, `${githubContentUrl}/deps/uv/include/uv/version.h`
3031
]
3132
, sslVersionUrl = [
3233
`${githubContentUrl}/deps/openssl/openssl/include/openssl/opensslv.h`
@@ -161,7 +162,6 @@ function fetchV8Version (gitref, callback) {
161162
})
162163
}
163164

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

213-
cachePut(gitref, 'uv', version)
214-
callback(null, version)
213+
if (version) {
214+
cachePut(gitref, 'uv', version)
215+
return callback(null, version)
216+
}
217+
218+
fetch(uvVersionUrl[3], gitref, function (err, rawData) {
219+
if (err)
220+
return callback(err)
221+
222+
version = rawData.split('\n').map(function (line) {
223+
return line.match(/^#define UV_VERSION_(?:MAJOR|MINOR|PATCH)\s+(\d+)$/)
224+
})
225+
.filter(Boolean)
226+
.map(function (m) { return m[1] })
227+
.join('.')
228+
229+
cachePut(gitref, 'uv', version)
230+
callback(null, version)
231+
})
215232
})
216233
})
217234
})

0 commit comments

Comments
 (0)