fix: error on unmatched apt package version by default

This commit is contained in:
Amin Yahyaabadi 2025-02-23 14:55:57 -08:00
parent 0c09b5d740
commit 40c2ffd2be
5 changed files with 13 additions and 8 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

View File

@ -87,11 +87,16 @@ async function getAptArg(apt: string, pack: AptPackage) {
return `${name}-${version}`
case AptPackageType.NameEqualsVersion:
return `${name}=${version}`
case AptPackageType.Name:
if (version !== undefined && version !== "" && fallBackToLatest) {
warning(`Could not find package '${name}' with version '${version}'. Installing the latest version.`)
case AptPackageType.Name: {
if (version === undefined) {
return name
}
return name
if (fallBackToLatest) {
warning(`Could not find package '${name}' with version '${version}'. Installing the latest version.`)
return name
}
throw new Error(`Could not find package '${name}' with version '${version}'`)
}
default:
throw new Error(`Could not find package '${name}' ${version ?? "with unspecified version"}`)
}