Skip to content

Commit

Permalink
Rollup merge of rust-lang#129459 - onur-ozkan:separate-stage0-bins, r…
Browse files Browse the repository at this point in the history
…=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
  • Loading branch information
matthiaskrgr authored Aug 25, 2024
2 parents d17d4d2 + 5f2cedc commit e84f97a
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,9 +542,13 @@ def download_toolchain(self):
bin_root = self.bin_root()

key = self.stage0_compiler.date
if self.rustc().startswith(bin_root) and \
(not os.path.exists(self.rustc()) or
self.program_out_of_date(self.rustc_stamp(), key)):
is_outdated = self.program_out_of_date(self.rustc_stamp(), key)
need_rustc = self.rustc().startswith(bin_root) and (not os.path.exists(self.rustc()) \
or is_outdated)
need_cargo = self.cargo().startswith(bin_root) and (not os.path.exists(self.cargo()) \
or is_outdated)

if need_rustc or need_cargo:
if os.path.exists(bin_root):
# HACK: On Windows, we can't delete rust-analyzer-proc-macro-server while it's
# running. Kill it.
Expand All @@ -565,7 +569,6 @@ def download_toolchain(self):
run_powershell([script])
shutil.rmtree(bin_root)

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

Expand All @@ -577,11 +580,16 @@ def download_toolchain(self):

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

tarballs_to_download = [
("rust-std-{}".format(toolchain_suffix), "rust-std-{}".format(self.build)),
("rustc-{}".format(toolchain_suffix), "rustc"),
("cargo-{}".format(toolchain_suffix), "cargo"),
]
tarballs_to_download = []

if need_rustc:
tarballs_to_download.append(
("rust-std-{}".format(toolchain_suffix), "rust-std-{}".format(self.build))
)
tarballs_to_download.append(("rustc-{}".format(toolchain_suffix), "rustc"))

if need_cargo:
tarballs_to_download.append(("cargo-{}".format(toolchain_suffix), "cargo"))

tarballs_download_info = [
DownloadInfo(
Expand Down

0 comments on commit e84f97a

Please sign in to comment.