Ease consumption (#125)

Don't take `maint-` -prefixed versions into account unless they're asked for it
specifically
At the same time, while fetching versions, make sure we identify them better so that
25 does not end up pulling maint-25 instead of OTP-25.0, as it should
This commit is contained in:
Paulo F. Oliveira
2022-08-01 13:23:47 +01:00
committed by GitHub
parent caa49b0658
commit 69fb25ba7e
2 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -6191,12 +6191,12 @@ async function maybeInstallRebar3(rebar3Spec) {
async function getOTPVersion(otpSpec0, osVersion) {
const otpVersions = await getOTPVersions(osVersion)
const otpSpec = otpSpec0.match(/^(OTP-)?([^ ]+)/)
const otpSpec = otpSpec0.match(/^(OTP-|maint-)?([^ ]+)/)
let otpVersion
if (otpSpec[1] && !isStrictVersion()) {
throw new Error(
`Requested Erlang/OTP version (${otpSpec0}) ` +
"should not contain 'OTP-'",
"should not contain 'OTP-, or maint-'",
)
}
if (otpSpec) {
@@ -6310,7 +6310,7 @@ async function getOTPVersions(osVersion) {
.trim()
.split('\n')
.forEach((line) => {
const otpMatch = line.match(/^(OTP-)?([^ ]+)/)
const otpMatch = line.match(/^(OTP-|maint-)?([^ ]+)/)
const otpVersion = otpMatch[2]
otpVersions.set(otpVersion, otpMatch[0]) // we keep the original for later reference
})
+3 -3
View File
@@ -139,12 +139,12 @@ async function maybeInstallRebar3(rebar3Spec) {
async function getOTPVersion(otpSpec0, osVersion) {
const otpVersions = await getOTPVersions(osVersion)
const otpSpec = otpSpec0.match(/^(OTP-)?([^ ]+)/)
const otpSpec = otpSpec0.match(/^(OTP-|maint-)?([^ ]+)/)
let otpVersion
if (otpSpec[1] && !isStrictVersion()) {
throw new Error(
`Requested Erlang/OTP version (${otpSpec0}) ` +
"should not contain 'OTP-'",
"should not contain 'OTP-, or maint-'",
)
}
if (otpSpec) {
@@ -258,7 +258,7 @@ async function getOTPVersions(osVersion) {
.trim()
.split('\n')
.forEach((line) => {
const otpMatch = line.match(/^(OTP-)?([^ ]+)/)
const otpMatch = line.match(/^(OTP-|maint-)?([^ ]+)/)
const otpVersion = otpMatch[2]
otpVersions.set(otpVersion, otpMatch[0]) // we keep the original for later reference
})