Skip to content

Commit 98fc12d

Browse files
committed
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. Signed-off-by: onur-ozkan <work@onurozkan.dev>
1 parent a32d4a0 commit 98fc12d

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/bootstrap/bootstrap.py

+11-6
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ 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 \
536+
if (self.rustc().startswith(bin_root) or self.cargo().startswith(bin_root)) and \
537537
(not os.path.exists(self.rustc()) or
538538
self.program_out_of_date(self.rustc_stamp(), key)):
539539
if os.path.exists(bin_root):
@@ -568,11 +568,16 @@ def download_toolchain(self):
568568

569569
toolchain_suffix = "{}-{}{}".format(rustc_channel, self.build, tarball_suffix)
570570

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-
]
571+
tarballs_to_download = []
572+
573+
if self.rustc().startswith(bin_root):
574+
tarballs_to_download.append(
575+
("rust-std-{}".format(toolchain_suffix), "rust-std-{}".format(self.build))
576+
)
577+
tarballs_to_download.append(("rustc-{}".format(toolchain_suffix), "rustc"))
578+
579+
if self.cargo().startswith(bin_root):
580+
tarballs_to_download.append(("cargo-{}".format(toolchain_suffix), "cargo"))
576581

577582
tarballs_download_info = [
578583
DownloadInfo(

0 commit comments

Comments
 (0)