Skip to content

Commit 75dfd5e

Browse files
committed
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`.
1 parent acdcdfb commit 75dfd5e

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
@@ -945,6 +945,7 @@ impl<'a> Builder<'a> {
945945
}
946946

947947
pub(crate) fn download_component(&self, url: &str, dest_path: &Path, help_on_error: &str) {
948+
self.verbose(&format!("download {url}"));
948949
// Use a temporary file in case we crash while downloading, to avoid a corrupt download in cache/.
949950
let tempfile = self.tempdir().join(dest_path.file_name().unwrap());
950951
// 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
@@ -1560,7 +1560,7 @@ fn download_ci_rustc(builder: &Builder<'_>, commit: &str) {
15601560
builder.fix_bin_or_dylib(&bin_root.join("bin").join("rustc"));
15611561
builder.fix_bin_or_dylib(&bin_root.join("bin").join("rustdoc"));
15621562
let lib_dir = bin_root.join("lib");
1563-
for lib in t!(fs::read_dir(lib_dir)) {
1563+
for lib in t!(fs::read_dir(&lib_dir), lib_dir.display().to_string()) {
15641564
let lib = t!(lib);
15651565
if lib.path().extension() == Some(OsStr::new("so")) {
15661566
builder.fix_bin_or_dylib(&lib.path());
@@ -1636,6 +1636,7 @@ fn download_component(
16361636
}
16371637
Some(sha256)
16381638
} else if tarball.exists() {
1639+
builder.unpack(&tarball, &bin_root, prefix);
16391640
return;
16401641
} else {
16411642
None

0 commit comments

Comments
 (0)