Skip to content

Commit

Permalink
dist-indexer: use opensslv.h for version lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg committed Mar 9, 2016
1 parent bf29061 commit 4030c77
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions setup/www/tools/dist-indexer/dist-indexer.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ const fs = require('fs')
, `${githubContentUrl}/deps/uv/src/version.c`
, `${githubContentUrl}/deps/uv/include/uv.h`
]
, sslVersionUrl = `${githubContentUrl}/deps/openssl/openssl/Makefile`
, sslVersionUrl = [
`${githubContentUrl}/deps/openssl/openssl/include/openssl/opensslv.h`
, `${githubContentUrl}/deps/openssl/openssl/Makefile`
]
, zlibVersionUrl = `${githubContentUrl}/deps/zlib/zlib.h`
, modVersionUrl = [
`${githubContentUrl}/src/node_version.h`
Expand Down Expand Up @@ -71,8 +74,9 @@ function cacheGet (gitref, prop) {


function cachePut (gitref, prop, value) {
if (prop && (value || value === false))
if (prop && (value || value === false)) {
(versionCache[gitref] || (versionCache[gitref] = {}))[prop] = value
}
}


Expand Down Expand Up @@ -215,15 +219,30 @@ function fetchSslVersion (gitref, callback) {
if (version || (/^v0\.([01234]\.\d+|5\.[0-4])$/).test(gitref))
return setImmediate(callback.bind(null, null, version))

fetch(sslVersionUrl, gitref, function (err, rawData) {
fetch(sslVersionUrl[0], gitref, function (err, rawData) {
if (err)
return callback(err)

var m = rawData.match(/^VERSION=(.+)$/m)
var m = rawData.match(/^#\s*define OPENSSL_VERSION_TEXT\s+"OpenSSL ([^\s]+)/m)
version = m && m[1]
cachePut(gitref, 'ssl', version)

callback(null, version)
if (version) {
version = version.replace(/-fips$/, '')
cachePut(gitref, 'ssl', version)

return callback(null, version)
}

fetch(sslVersionUrl[1], gitref, function (err, rawData) {
if (err)
return callback(err)

var m = rawData.match(/^VERSION=(.+)$/m)
version = m && m[1]
cachePut(gitref, 'ssl', version)

callback(null, version)
})
})
}

Expand Down

0 comments on commit 4030c77

Please sign in to comment.