fix: fix mingw version satisfaction check

This commit is contained in:
Amin Yahyaabadi 2024-09-22 22:31:43 -07:00
parent ed3b715dd5
commit 59c68f43d8
No known key found for this signature in database
GPG Key ID: F52AF77F636088F0
10 changed files with 16 additions and 26 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
import { join } from "path"
import { info, warning } from "ci-log"
import { pathExists } from "path-exists"
import { join } from "path/posix"
import { dirname } from "./gcc.ts"
export async function addGccLoggingMatcher() {

View File

@ -104,12 +104,6 @@ export async function getMinGWPackageInfo(
ia32: "i386",
} as Record<string, string | undefined>
// extract the base version by coercing the version
const versionCoerce = semverCoerce(version)
if (versionCoerce === null) {
throw new Error(`Invalid MinGW version requested '${version}'`)
}
const runtime = extractMinGWRuntime(version)
const threadModel = extractMinGWThreadModel(version)
const exceptionModel = extractMingwExceptionModel(version)
@ -122,15 +116,11 @@ export async function getMinGWPackageInfo(
mingwArchMap[arch] ?? arch,
],
filterName: (assetName) => {
const assetRuntime = extractMinGWRuntime(assetName)
const assetThreadModel = extractMinGWThreadModel(assetName)
const assetExceptionModel = extractMingwExceptionModel(assetName)
return (runtime === undefined || runtime === assetRuntime)
&& (threadModel === undefined || threadModel === assetThreadModel)
&& (assetExceptionModel === undefined || assetExceptionModel === exceptionModel)
return (runtime === undefined || runtime === extractMinGWRuntime(assetName))
&& (threadModel === undefined || threadModel === extractMinGWThreadModel(assetName))
&& (exceptionModel === undefined || exceptionModel === extractMingwExceptionModel(assetName))
},
versionSatisfies: (assetVersion, _version) => {
versionSatisfies: (assetVersion, versionRange) => {
// extract the base version by coercing the version
const assetCoerce = semverCoerce(assetVersion)
if (assetCoerce === null) {
@ -139,7 +129,7 @@ export async function getMinGWPackageInfo(
// if the asset version is satisfied by the version
// and the runtime and thread model match or not specified
return semverSatisfies(assetCoerce, `^${versionCoerce}`)
return semverSatisfies(assetCoerce, versionRange)
&& (runtime === undefined || runtime === extractMinGWRuntime(assetVersion))
&& (threadModel === undefined || threadModel === extractMinGWThreadModel(assetVersion))
},