@@ -9268,20 +9268,30 @@ async function maybeInstallRebar3(rebar3Spec) {
92689268}
92699269
92709270async function getOTPVersion ( otpSpec0 , osVersion ) {
9271- const otpVersions = await getOTPVersions ( osVersion )
9271+ const [ otpVersions , originListing , hexMirrors ] = await getOTPVersions (
9272+ osVersion ,
9273+ )
92729274 let spec = otpSpec0 . replace ( / ^ O T P - / , '' )
92739275 const versions = otpVersions
92749276 const otpVersion = getVersionFromSpec ( spec , versions )
9277+
92759278 if ( otpVersion === null ) {
92769279 throw new Error (
9277- `Requested Erlang/OTP version (${ otpSpec0 } ) not found in version list ` +
9278- "(should you be using option 'version-type': 'strict'?)" ,
9280+ requestedVersionFor ( 'Erlang/OTP' , otpSpec0 , originListing , hexMirrors ) ,
92799281 )
92809282 }
92819283
92829284 return otpVersion // from the reference, for download
92839285}
92849286
9287+ function requestedVersionFor ( tool , version , originListing , mirrors ) {
9288+ return (
9289+ `Requested ${ tool } version (${ version } ) not found in version list, ` +
9290+ `at ${ originListing } ${ mirrors ? `, with mirrors ${ mirrors } ` : '' } ; ` +
9291+ "should you be using option 'version-type': 'strict'?"
9292+ )
9293+ }
9294+
92859295async function getElixirVersion ( exSpec0 , otpVersion0 ) {
92869296 const otpVersion = otpVersion0 . match ( / ^ ( [ ^ - ] + - ) ? ( .+ ) $ / ) [ 2 ]
92879297 let otpVersionMajor = otpVersion . match ( / ^ ( [ ^ . ] + ) .* $ / ) [ 1 ]
@@ -9292,15 +9302,15 @@ async function getElixirVersion(exSpec0, otpVersion0) {
92929302 otpVersionMajor = userSuppliedOtp
92939303 }
92949304
9295- const [ otpVersionsForElixirMap , elixirVersions ] = await getElixirVersions ( )
9305+ const [ otpVersionsForElixirMap , elixirVersions , originListing , hexMirrors ] =
9306+ await getElixirVersions ( )
92969307 const spec = exSpec0 . replace ( / - o t p - .* $ / , '' )
92979308 const versions = elixirVersions
92989309 const elixirVersionFromSpec = getVersionFromSpec ( spec , versions )
92999310
93009311 if ( elixirVersionFromSpec === null ) {
93019312 throw new Error (
9302- `Requested Elixir version (${ exSpec0 } ) not found in version list ` +
9303- "(should you be using option 'version-type': 'strict'?)" ,
9313+ requestedVersionFor ( 'Elixir' , exSpec0 , originListing , hexMirrors ) ,
93049314 )
93059315 }
93069316
@@ -9331,30 +9341,26 @@ async function getElixirVersion(exSpec0, otpVersion0) {
93319341}
93329342
93339343async function getGleamVersion ( gleamSpec0 ) {
9334- const gleamVersions = await getGleamVersions ( )
9344+ const [ gleamVersions , originListing ] = await getGleamVersions ( )
93359345 const spec = gleamSpec0
93369346 const versions = gleamVersions
93379347 const gleamVersion = getVersionFromSpec ( spec , versions )
9348+
93389349 if ( gleamVersion === null ) {
9339- throw new Error (
9340- `Requested Gleam version (${ gleamSpec0 } ) not found in version list ` +
9341- "(should you be using option 'version-type': 'strict'?)" ,
9342- )
9350+ throw new Error ( requestedVersionFor ( 'Gleam' , gleamSpec0 , originListing ) )
93439351 }
93449352
93459353 return maybePrependWithV ( gleamVersion )
93469354}
93479355
93489356async function getRebar3Version ( r3Spec ) {
9349- const rebar3Versions = await getRebar3Versions ( )
9357+ const [ rebar3Versions , originListing ] = await getRebar3Versions ( )
93509358 const spec = r3Spec
93519359 const versions = rebar3Versions
93529360 const rebar3Version = getVersionFromSpec ( spec , versions )
9361+
93539362 if ( rebar3Version === null ) {
9354- throw new Error (
9355- `Requested rebar3 version (${ r3Spec } ) not found in version list ` +
9356- "(should you be using option 'version-type': 'strict'?)" ,
9357- )
9363+ throw new Error ( requestedVersionFor ( 'rebar3' , r3Spec , originListing ) )
93589364 }
93599365
93609366 return rebar3Version
@@ -9363,10 +9369,12 @@ async function getRebar3Version(r3Spec) {
93639369async function getOTPVersions ( osVersion ) {
93649370 let otpVersionsListings
93659371 let originListing
9372+ let hexMirrors = null
93669373 if ( process . platform === 'linux' ) {
93679374 originListing = `/builds/otp/${ getRunnerOSArchitecture ( ) } /${ osVersion } /builds.txt`
9375+ hexMirrors = hexMirrorsInput ( )
93689376 otpVersionsListings = await doWithMirrors ( {
9369- hexMirrors : hexMirrorsInput ( ) ,
9377+ hexMirrors,
93709378 actionTitle : `fetch ${ originListing } ` ,
93719379 action : async ( hexMirror ) => {
93729380 return get ( `${ hexMirror } ${ originListing } ` , [ ] )
@@ -9378,7 +9386,10 @@ async function getOTPVersions(osVersion) {
93789386 otpVersionsListings = await get ( originListing , [ 1 , 2 , 3 ] )
93799387 }
93809388
9381- debugLog ( `OTP versions listings from ${ originListing } ` , otpVersionsListings )
9389+ debugLog (
9390+ `OTP versions listings from ${ originListing } , mirrors ${ hexMirrors } ` ,
9391+ otpVersionsListings ,
9392+ )
93829393
93839394 const otpVersions = { }
93849395 if ( process . platform === 'linux' ) {
@@ -9412,15 +9423,19 @@ async function getOTPVersions(osVersion) {
94129423 } )
94139424 }
94149425
9415- debugLog ( `OTP versions from ${ originListing } ` , JSON . stringify ( otpVersions ) )
9426+ debugLog (
9427+ `OTP versions from ${ originListing } , mirrors ${ hexMirrors } ` ,
9428+ JSON . stringify ( otpVersions ) ,
9429+ )
94169430
9417- return otpVersions
9431+ return [ otpVersions , originListing , hexMirrors ]
94189432}
94199433
94209434async function getElixirVersions ( ) {
94219435 const originListing = '/builds/elixir/builds.txt'
9436+ const hexMirrors = hexMirrorsInput ( )
94229437 const elixirVersionsListings = await doWithMirrors ( {
9423- hexMirrors : hexMirrorsInput ( ) ,
9438+ hexMirrors,
94249439 actionTitle : `fetch ${ originListing } ` ,
94259440 action : async ( hexMirror ) => {
94269441 return get ( `${ hexMirror } ${ originListing } ` , [ ] )
@@ -9446,14 +9461,13 @@ async function getElixirVersions() {
94469461 elixirVersions [ elixirVersion ] = elixirVersion
94479462 } )
94489463
9449- return [ otpVersionsForElixirMap , elixirVersions ]
9464+ return [ otpVersionsForElixirMap , elixirVersions , originListing , hexMirrors ]
94509465}
94519466
94529467async function getGleamVersions ( ) {
9453- const resultJSONs = await get (
9454- 'https://api.github.com/repos/gleam-lang/gleam/releases?per_page=100' ,
9455- [ 1 , 2 , 3 ] ,
9456- )
9468+ const originListing =
9469+ 'https://api.github.com/repos/gleam-lang/gleam/releases?per_page=100'
9470+ const resultJSONs = await get ( originListing , [ 1 , 2 , 3 ] )
94579471 const gleamVersionsListing = { }
94589472 resultJSONs . forEach ( ( resultJSON ) => {
94599473 resultJSON
@@ -9465,14 +9479,13 @@ async function getGleamVersions() {
94659479 } )
94669480 } )
94679481
9468- return gleamVersionsListing
9482+ return [ gleamVersionsListing , originListing ]
94699483}
94709484
94719485async function getRebar3Versions ( ) {
9472- const resultJSONs = await get (
9473- 'https://api.github.com/repos/erlang/rebar3/releases?per_page=100' ,
9474- [ 1 , 2 , 3 ] ,
9475- )
9486+ const originListing =
9487+ 'https://api.github.com/repos/erlang/rebar3/releases?per_page=100'
9488+ const resultJSONs = await get ( originListing , [ 1 , 2 , 3 ] )
94769489 const rebar3VersionsListing = { }
94779490 resultJSONs . forEach ( ( resultJSON ) => {
94789491 resultJSON
@@ -9482,7 +9495,7 @@ async function getRebar3Versions() {
94829495 } )
94839496 } )
94849497
9485- return rebar3VersionsListing
9498+ return [ rebar3VersionsListing , originListing ]
94869499}
94879500
94889501function isStrictVersion ( ) {
0 commit comments