1
1
const linker = require ( './linker.js' ) ;
2
2
3
3
/// Translate old style version numbers to semver.
4
- /// Old style: 0.3.6-3fc68da5/Release-Emscripten/clang
4
+ /// Old style: 0.4.1-nightly.2016.09.09+commit.79867f49.Emscripten.clang
5
+ /// 0.3.6-3fc68da5/Release-Emscripten/clang
5
6
/// 0.3.5-371690f0/Release-Emscripten/clang/Interpreter
6
7
/// 0.3.5-0/Release-Emscripten/clang/Interpreter
7
8
/// 0.2.0-e7098958/.-Emscripten/clang/int linked to libethereum-1.1.1-bbb80ab0/.-Emscripten/clang/int
8
9
/// 0.1.3-0/.-/clang/int linked to libethereum-0.9.92-0/.-/clang/int
9
10
/// 0.1.2-5c3bfd4b*/.-/clang/int
10
11
/// 0.1.1-6ff4cd6b/RelWithDebInfo-Emscripten/clang/int
11
12
/// New style: 0.4.5+commit.b318366e.Emscripten.clang
13
+ /// 0.8.1-nightly.2021.1.7+commit.d11cf15d.js
12
14
function versionToSemver ( version ) {
15
+ // This parses the old style with a commit hash. It ignores the details past the commit hash.
13
16
// FIXME: parse more detail, but this is a good start
14
17
const parsed = version . match ( / ^ ( [ 0 - 9 ] + \. [ 0 - 9 ] + \. [ 0 - 9 ] + ) - ( [ 0 - 9 a - f ] { 8 } ) [ / * ] .* $ / ) ;
15
18
if ( parsed ) {
@@ -21,6 +24,11 @@ function versionToSemver (version) {
21
24
if ( version . indexOf ( '0.3.5-0' ) !== - 1 ) {
22
25
return '0.3.5' ;
23
26
}
27
+ // This parses the obsolete nightly style where the date can have leading zeroes.
28
+ var nightly_parsed = version . match ( / ^ ( [ 0 - 9 ] + \. [ 0 - 9 ] + \. [ 0 - 9 ] + ) - n i g h t l y \. ( [ 0 - 9 ] + ) \. 0 ( [ 1 - 9 ] ) \. 0 ( [ 1 - 9 ] ) ( .* ) $ / ) ;
29
+ if ( nightly_parsed ) {
30
+ return parsed [ 1 ] + '-nightly.' + parsed [ 2 ] + '.' + parsed [ 3 ] + '.' + parsed [ 4 ] + parsed [ 5 ] ;
31
+ }
24
32
// assume it is already semver compatible
25
33
return version ;
26
34
}
0 commit comments