Skip to main content

try_pull_toolchain

Function try_pull_toolchain 

Source
pub async fn try_pull_toolchain(
    id: &ToolchainArtifactId,
    dest_dir: &Path,
) -> Result<Option<PulledToolchain>>
Expand description

Try to pull id’s toolchain artifact into dest_dir.

Resolves {repo}:{artifact_tag} (anonymous first, retrying with registry_auth_from_env on an auth error). A missing tag (404 / manifest-unknown) is Ok(None) — the caller builds instead; a real transport error is Err. On a hit the layer is unpacked into dest_dir and relocate_pulled re-homes it from the recorded prefix to dest_dir. A non-relocatable artifact whose local prefix would be LONGER than the recorded one cannot be null-pad patched: dest_dir is cleared and Ok(None) returned (the caller falls back to building).

The embedded manifest is re-homed (absolute built-prefix paths in path_dirs / env rewritten to dest_dir), stamped ToolchainSource::Registry, and written as dest_dir/toolchain.json. The .ready marker is deliberately NOT written — the caller’s finalize owns it.

§Errors

Returns ToolchainError::RegistryError on a transport / unpack failure and propagates relocation / I/O errors.