Skip to content

Commit 31d20ef

Browse files
authored
Unrolled build for rust-lang#129459
Rollup merge of rust-lang#129459 - onur-ozkan:separate-stage0-bins, r=Kobzol handle stage0 `cargo` and `rustc` separately This change allows setting either `build.cargo` or `build.rustc` without requiring both to be set simultaneously, which was not possible previously. To try it, set `build.rustc` without setting `build.cargo`, and try to bootstrap on clean build. Blocker for rust-lang#129152
2 parents 1a94d83 + 5f2cedc commit 31d20ef

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

Diff for: src/bootstrap/bootstrap.py

+17-9
Original file line numberDiff line numberDiff line change
@@ -533,9 +533,13 @@ def download_toolchain(self):
533533
bin_root = self.bin_root()
534534

535535
key = self.stage0_compiler.date
536-
if self.rustc().startswith(bin_root) and \
537-
(not os.path.exists(self.rustc()) or
538-
self.program_out_of_date(self.rustc_stamp(), key)):
536+
is_outdated = self.program_out_of_date(self.rustc_stamp(), key)
537+
need_rustc = self.rustc().startswith(bin_root) and (not os.path.exists(self.rustc()) \
538+
or is_outdated)
539+
need_cargo = self.cargo().startswith(bin_root) and (not os.path.exists(self.cargo()) \
540+
or is_outdated)
541+
542+
if need_rustc or need_cargo:
539543
if os.path.exists(bin_root):
540544
# HACK: On Windows, we can't delete rust-analyzer-proc-macro-server while it's
541545
# running. Kill it.
@@ -556,7 +560,6 @@ def download_toolchain(self):
556560
run_powershell([script])
557561
shutil.rmtree(bin_root)
558562

559-
key = self.stage0_compiler.date
560563
cache_dst = (self.get_toml('bootstrap-cache-path', 'build') or
561564
os.path.join(self.build_dir, "cache"))
562565

@@ -568,11 +571,16 @@ def download_toolchain(self):
568571

569572
toolchain_suffix = "{}-{}{}".format(rustc_channel, self.build, tarball_suffix)
570573

571-
tarballs_to_download = [
572-
("rust-std-{}".format(toolchain_suffix), "rust-std-{}".format(self.build)),
573-
("rustc-{}".format(toolchain_suffix), "rustc"),
574-
("cargo-{}".format(toolchain_suffix), "cargo"),
575-
]
574+
tarballs_to_download = []
575+
576+
if need_rustc:
577+
tarballs_to_download.append(
578+
("rust-std-{}".format(toolchain_suffix), "rust-std-{}".format(self.build))
579+
)
580+
tarballs_to_download.append(("rustc-{}".format(toolchain_suffix), "rustc"))
581+
582+
if need_cargo:
583+
tarballs_to_download.append(("cargo-{}".format(toolchain_suffix), "cargo"))
576584

577585
tarballs_download_info = [
578586
DownloadInfo(

0 commit comments

Comments
 (0)