Skip to main content

Module windows

Module windows 

Source
Expand description

Windows keg provisioning — “our apt” for the HCS sandbox.

The Windows analogue of the macOS crate::source_build / crate::prebuilt paths. The HCS sandbox has no package manager, so this provisions a named tool into a self-contained, relocatable keg with the same KegManifest layout the macOS kegs use, and the same on-disk cache key (<cache>/<tool>-<version>-<arch>/ + a .ready marker).

§Strategy

  1. git → MinGit (ensure_mingit). Git for Windows publishes MinGit, a fully self-contained, relocatable portable zip (no installer, no registry writes, no absolute-path baking) — exactly the Windows equivalent of a relocation-free keg. We resolve the latest release from the git-for-windows/git GitHub releases, fetch the right architecture’s MinGit-<ver>-{64-bit,arm64}.zip, and extract it into the keg.
  2. Everything else → choco fallback. Formulae with no relocatable portable artifact are installed with choco install inside a throwaway HCS compute system and captured into a keg. That path needs a live HCS host, so it is owned by the runtime/builder layer (which has the HCS machinery) — invoked when this module returns ToolchainError::NotImplemented for a non-portable formula — rather than pulled into this leaf crate (which must not depend on the HCS stack).

This module is compiled on all hosts (it is pure HTTP + zip extraction + manifest I/O), so the keg format and MinGit resolver are unit-testable on a macOS build host even though the kegs are only provisioned for Windows containers.

Functions§

ensure_mingit
Provision the git keg from MinGit (a relocatable portable zip).
ensure_windows_keg
Provision (or reuse) a Windows keg for pkg, returning the keg directory.
windows_arch_token
Architecture token used in keg cache keys + MinGit asset names (x86_64/arm64).