Expand description
Windows toolchain 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 toolchain with the
same ToolchainManifest layout the macOS toolchains use, and the same on-disk cache
key (<cache>/<tool>-<version>-<arch>/ + a .ready marker).
§Strategy
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 toolchain. We resolve the latest release from thegit-for-windows/gitGitHub releases, fetch the right architecture’sMinGit-<ver>-{64-bit,arm64}.zip, and extract it into the toolchain.- Everything else → Chocolatey. The package is resolved through the
ZLayer package index (
/choco/:name→.nupkgURL + version), the.nupkgis downloaded (digest-verified when the index/lockfile carries one) and itstools/chocolateyInstall.ps1is parsed into anInstallPlanbycrate::recipe_choco:- Portable zip / web-file packages — plans made only of
InstallStep::StageResource/InstallStep::PrefixInstall/InstallStep::BinInstall— execute leaf-side: each resource is fetched (sha256-verified from the ps1’s embedded checksums; an empty checksum — the weak-checksum casecrate::recipe_chocodocuments — downloads unverified with a loud warning) and extracted/staged into the toolchain prefix. This is fetch + unzip, no arbitrary code — the same trust class as MinGit. - exe/msi installer packages (any other plan shape) run
choco installinside a Windows container through the registeredcrate::executor::ContainerBuildExecutorwith the network allowed loudly (grepNET-FALLBACK). When no executor is registered this fails withToolchainError::ExecutorUnavailable— never a host subprocess, and never a wrong binary.
- Portable zip / web-file packages — plans made only of
This module is compiled on all hosts (it is pure HTTP + zip extraction +
manifest I/O; the executor call is platform-tagged data, not cfg’d code),
so the toolchain format, the MinGit resolver, and the choco chain are
unit-testable on a macOS build host even though the toolchains are only
provisioned for Windows containers.
Functions§
- ensure_
mingit - Provision the
gittoolchain from MinGit (a relocatable portable zip). - ensure_
windows_ toolchain - Provision (or reuse) a Windows toolchain for
pkg, returning the toolchain directory. - windows_
arch_ token - Architecture token used in toolchain cache keys + MinGit asset names
(
x86_64/arm64).