Skip to main content

resolve_windows_packages

Function resolve_windows_packages 

Source
pub async fn resolve_windows_packages(
    linux_pkgs: &[String],
    source_distro: &str,
) -> Result<Vec<ResolvedWindowsPackage>>
Expand description

Resolve a batch of Linux package names to ResolvedWindowsPackages.

For each package, resolution order is:

  1. Relocatable artifact โ€” GET {discover}/{pkg}?discover=true. A forge-release source yields ResolvedWindowsPackage::DirectRelease; a portable/archive source yields ResolvedWindowsPackage::RelocatableArchive. This is preferred so the produced image needs no Chocolatey.
  2. Chocolatey fallback โ€” the existing shard map. A real choco name yields ResolvedWindowsPackage::ChocoFallback; the __skip__ sentinel yields ResolvedWindowsPackage::Skip.
  3. Unresolved โ€” neither source knows the package: surfaced as Err(BuildError::ChocoResolutionFailed) by the caller (the translator decides whether an unresolved package is fatal). Here it is simply omitted from the result vector so callers can detect the gap by name.

All shards needed by the batch are fetched once via resolve_chocolatey_packages and reused. Discovery is a per-package GET; failures (offline, 404) degrade silently to the choco fallback.

ยงErrors

Returns Err(BuildError::CacheError) if the platform cache directory cannot be determined (the only unrecoverable setup failure). Per-package discovery/network failures degrade to the Chocolatey fallback and never abort the batch.