ReviewOS

also looking at this

pantry-pm/pantry

fix(installer): resolve versions against live sources when one is unreachable

#255
Merged glennmichael123 wants to merge fix/242-version-source-fallback into main
6 files +400 -44
packages/action/src/system-packages.tsmodified+12-2
Changes to packages/action/src/system-packages.ts
@@ -13,6 +13,8 @@ export async function installResolvedSystemPackages(
1313 platform?: installer.Platform
1414 nativeInstall: (specs: string[]) => Promise<number>
1515 onRetry?: (message: string) => void
16 /** Diagnostics that change which version is installed; `quiet` does not suppress these. */
17 onWarn?: (message: string) => void
1618 },
1719): Promise<Map<string, string>> {
1820 const versions = new Map<string, string>()
@@ -20,12 +22,19 @@ export async function installResolvedSystemPackages(
2022 for (const { domain, version } of requests) {
2123 if (installer.isSupported(domain, options.platform)) {
2224 const installed = await installer.installPackage(domain, version, {
23 installDir: options.installDir, platform: options.platform, quiet: true, onRetry: options.onRetry,
25 installDir: options.installDir,
26 platform: options.platform,
27 quiet: true,
28 onRetry: options.onRetry,
29 onWarn: options.onWarn,
2430 })
2531 versions.set(domain, installed.version)
2632 continue
2733 }
28 const resolved = await installer.resolvePackageVersion(domain, version, options.platform)
34 const resolved = await installer.resolvePackageVersion(domain, version, options.platform, {
35 onRetry: options.onRetry,
36 onWarn: options.onWarn,
37 })
2938 const previous = native.get(domain)
3039 if (previous && previous !== resolved)
3140 throw new Error(`Conflicting required versions for ${domain}: ${previous} and ${resolved}`)
@@ -51,6 +60,7 @@ export async function installResolvedSystemPackage(
5160 platform?: installer.Platform
5261 nativeInstall: (spec: string) => Promise<number>
5362 onRetry?: (message: string) => void
63 onWarn?: (message: string) => void
5464 },
5565): Promise<string> {
5666 const versions = await installResolvedSystemPackages([{ domain, version }], {