Skip to content

Commit e369688

Browse files
committed
Touch up OpenSSL discovery script
1 parent 49fc43b commit e369688

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed
Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,17 +120,26 @@ const releasePairs = R.toPairs({
120120

121121
const distributionPairs = [...debugPairs, ...releasePairs];
122122

123+
const getDistributionConfigURLFromHash = itemHash =>
124+
`https://bintray.com/conan-community/conan/download_file?file_path=conan%2FOpenSSL%2F1.1.0i%2Fstable%2Fpackage%2F${itemHash}%2Fconaninfo.txt`
125+
126+
const getDistributionDownloadURLFromHash = itemHash =>
127+
`https://dl.bintray.com/conan-community/conan/conan/OpenSSL/1.1.0i/stable/package/${itemHash}/conan_package.tgz`
128+
129+
const getDistributionsRootURL = () =>
130+
'https://bintray.com/package/files/conan-community/conan/OpenSSL%3Aconan?order=asc&sort=name&basePath=conan%2FOpenSSL%2F1.1.0i%2Fstable%2Fpackage&tab=files'
131+
123132
const detectDistributionPairFromConfig = (itemHash, body) => R.reduce(
124133
(acc, [releaseName, predicate]) => R.cond([
125-
[predicate, R.always([releaseName, itemHash])],
134+
[predicate, R.always([releaseName, getDistributionDownloadURLFromHash(itemHash)])],
126135
[R.T, R.always(acc)]
127136
])(body),
128137
undefined,
129138
distributionPairs
130139
);
131140

132141
const getDistributionConfig = (itemHash) =>
133-
request.get(`https://bintray.com/conan-community/conan/download_file?file_path=conan%2FOpenSSL%2F1.1.0i%2Fstable%2Fpackage%2F${itemHash}%2Fconaninfo.txt`)
142+
request.get(getDistributionConfigURLFromHash(itemHash))
134143
.then((body) => detectDistributionPairFromConfig(itemHash, body));
135144

136145
const discoverDistributions = (treeHtml) => {
@@ -151,9 +160,10 @@ const discoverDistributions = (treeHtml) => {
151160
);
152161
}
153162

154-
request('https://bintray.com/package/files/conan-community/conan/OpenSSL%3Aconan?order=asc&sort=name&basePath=conan%2FOpenSSL%2F1.1.0i%2Fstable%2Fpackage&tab=files')
163+
const outputPath = path.resolve('..', 'vendor', 'openssl_distributions.json');
164+
request(getDistributionsRootURL())
155165
.then(discoverDistributions)
156166
.then(R.filter(R.identity))
157167
.then(R.sortBy(R.prop(0)))
158168
.then(R.fromPairs)
159-
.then(distributions => fse.writeFile('openssl_distributions.json', JSON.stringify(distributions, null, 2)));
169+
.then(distributions => fse.writeFile(outputPath, JSON.stringify(distributions, null, 2)));

0 commit comments

Comments
 (0)