Expand description
Microsoft’s installer manifest, and the few packages in it an MSVC sysroot is made of.
Design: spec/cross-compile/13-distribution.md section 13.4, which is the Microsoft half of
crate::Wall.
§What this is for
The Windows SDK and the MSVC universal CRT are not ours to redistribute, so no release of this
compiler will ever pin an artifact for an MSVC target the way it pins one for mingw-w64. What
Microsoft does publish is an installer manifest that names every file the Visual Studio
installer would download, and a licence that lets a person who accepts it download those files.
That is the mechanism cargo-xwin uses and section 13.4 says we copy it. This module is the
reading half of that: given the two documents, which packages does a compiler need and which
files are those packages made of.
It fetches nothing and it writes nothing. Everything here is a function of text the caller was handed, which is the same rule the rest of this crate is held to.
§The chain, and the one link in it that is not a hash
There are three documents. The channel manifest, at a fixed aka.ms address, which names the
installer manifest. The installer manifest, which names every package and gives a sha256 for
every file in every one of them. And the files.
Every file is verified against the installer manifest, so the interesting question is what
verifies the installer manifest. The channel gives a sha256 for it, and as of this writing that
hash is wrong: aka.ms/vs/17/release/channel says the manifest for 17.14.37710.0 is 30443537
bytes long and hashes to 6e470016..., and the file served at the URL it names in the same
breath is 17954732 bytes and hashes to f0a50ea1..., from two different Microsoft regions on
two different days. Microsoft replaced the file and did not update the record.
So the record is not a pin, it is a note, and treating it as a pin means a command that never
works. Channel carries what the channel said and leaves the decision to the caller, which is
the honest arrangement: what actually protects the install is the per file hash a level down,
and what the channel adds is only a check that the CDN served the index the channel described.
A caller that reports both hashes gives a person auditing the download the one thing that
matters, which is exactly which bytes they got.
§What is chosen, and why it is so little
A C compiler needs headers and import libraries and nothing else. No linker, no assembler, no debugger, no redistributables, no spectre mitigated variants, no store or onecore flavours of the desktop libraries, and no tools of any kind, because the tool is this compiler. That comes to the CRT headers, one CRT library package per architecture, and six of the Windows SDK’s installers, out of a manifest with nineteen thousand packages in it.
The newest version of each is taken rather than a pinned one. A pinned version would be a promise about a file on somebody else’s server, which section 13.8 already declines to make for the sysroots we do publish, and Microsoft retires old versions from the manifest.
Structs§
- Channel
- What the channel manifest says, which is the entry point and nothing else.
- Payload
- One file Microsoft publishes, as the manifest describes it.
- Selection
- Which files an MSVC sysroot for a set of architectures is made of.
- Wanted
- One file to download, and which package of Microsoft’s it came out of.