Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remap crates fetched via sparse registry as well #1888

Merged
merged 2 commits into from
Oct 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion build/xtask/src/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ impl PackageConfig {
remap_paths.insert(cargo_git, "/git");

// This hash is canonical-ish: Cargo tries hard not to change it
// https://github.com/rust-lang/cargo/blob/master/src/cargo/core/source/source_id.rs#L607-L630
// https://github.com/rust-lang/cargo/blob/5dfdd59/src/cargo/core/source_id.rs#L755-L794
//
// It depends on system architecture, so this won't work on (for example)
// a Raspberry Pi, but the only downside is that panic messages will
Expand All @@ -177,6 +177,15 @@ impl PackageConfig {
.join("src")
.join("github.com-1ecc6299db9ec823");
remap_paths.insert(cargo_registry, "/crates.io");
// If Cargo uses the sparse registry (stabilized since ~1.72) it caches fetched crates
// in a slightly different path. Remap that one as well.
//
// This path has the same canonical-ish properties as above.
let cargo_sparse_registry = cargo_home
.join("registry")
.join("src")
.join("index.crates.io-6f17d22bba15001f");
remap_paths.insert(cargo_sparse_registry, "/crates.io");
}

if let Ok(dir) = std::env::var("CARGO_MANIFEST_DIR") {
Expand Down