Skip to content
Closed
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion src/bin/sccache-dist/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,12 @@ impl OverlayBuilder {
entry.clone()
} else {
trace!("Creating toolchain directory for {}", tc.archive_id);
fs::create_dir(&toolchain_dir)?;
// The directory can persist on disk from a previous server
// process (or a toolchain evicted from the in-memory map
// without its directory). Treat it as already-prepared.
if !toolchain_dir.exists() {
fs::create_dir(&toolchain_dir)?;
Comment on lines +196 to +197
}

let mut tccache = tccache.lock().unwrap();
let toolchain_rdr = match tccache.get(tc) {
Expand Down
12 changes: 10 additions & 2 deletions src/compiler/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2285,10 +2285,18 @@ impl pkg::ToolchainPackager for RustToolchainPackager {
let sysroot_executable = bins_path.join("rustc").with_extension(EXE_EXTENSION);
package_builder.add_executable_and_deps(sysroot_executable)?;

package_builder.add_dir_contents(&bins_path)?;
// Package the Rust standard library subtree instead of the entire
// sysroot lib directory. Distros like Void Linux report `/usr` as the
// sysroot, so packaging `$sysroot/lib` would drag in the whole system
// library tree (several GiB) rather than just the Rust stdlib.
if BINS_DIR != LIBS_DIR {
let libs_path = sysroot.join(LIBS_DIR);
package_builder.add_dir_contents(&libs_path)?;
let rustlib_path = libs_path.join("rustlib");
if rustlib_path.is_dir() {
package_builder.add_dir_contents(&rustlib_path)?;
} else {
package_builder.add_dir_contents(&libs_path)?;
Comment on lines +2294 to +2298
}
}

package_builder.into_compressed_tar(f)
Expand Down