Skip to content

Commit 6c6791a

Browse files
authored
Rollup merge of rust-lang#98798 - jyn514:download-rustc-cached, r=Mark-Simulacrum
Fix caching bug in `download-rustc = true` When moving this to rustbuild, I introduced a bug: if you had the file already downloaded, but deleted the sysroot for whatever reason, rustbuil would fail to unpack the cached tarball. This only affects people if they have a cached tarball, which is probably why we haven't seen an issue yet - wiping `build/cache` would work around the issue, or just not deleting `build/$TARGET/stage2`. Fixes the following error: ``` thread 'main' panicked at 'fs::read_dir(&lib_dir) failed with No such file or directory (os error 2) ("/home/jnelson/rust-lang/rust2/build/x86_64-unknown-linux-gnu/ci-rustc/lib")', config.rs:1563:20 ``` r? ``@Mark-Simulacrum``
2 parents 5dcd28c + 75dfd5e commit 6c6791a

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/bootstrap/builder.rs

+1
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,7 @@ impl<'a> Builder<'a> {
949949
}
950950

951951
pub(crate) fn download_component(&self, url: &str, dest_path: &Path, help_on_error: &str) {
952+
self.verbose(&format!("download {url}"));
952953
// Use a temporary file in case we crash while downloading, to avoid a corrupt download in cache/.
953954
let tempfile = self.tempdir().join(dest_path.file_name().unwrap());
954955
// While bootstrap itself only supports http and https downloads, downstream forks might

src/bootstrap/config.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1558,7 +1558,7 @@ fn download_ci_rustc(builder: &Builder<'_>, commit: &str) {
15581558
builder.fix_bin_or_dylib(&bin_root.join("bin").join("rustc"));
15591559
builder.fix_bin_or_dylib(&bin_root.join("bin").join("rustdoc"));
15601560
let lib_dir = bin_root.join("lib");
1561-
for lib in t!(fs::read_dir(lib_dir)) {
1561+
for lib in t!(fs::read_dir(&lib_dir), lib_dir.display().to_string()) {
15621562
let lib = t!(lib);
15631563
if lib.path().extension() == Some(OsStr::new("so")) {
15641564
builder.fix_bin_or_dylib(&lib.path());
@@ -1634,6 +1634,7 @@ fn download_component(
16341634
}
16351635
Some(sha256)
16361636
} else if tarball.exists() {
1637+
builder.unpack(&tarball, &bin_root, prefix);
16371638
return;
16381639
} else {
16391640
None

0 commit comments

Comments
 (0)