Skip to content

Commit b2b4a56

Browse files
committed
Don't overwrite rustfmt and cargo artifacts for download_stage1
1 parent 5d276af commit b2b4a56

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/bootstrap/bootstrap.py

+14-8
Original file line numberDiff line numberDiff line change
@@ -397,20 +397,21 @@ def download_stage0(self):
397397
self.program_out_of_date(self.rustc_stamp(), self.date + str(self.stage1_commit))):
398398
if os.path.exists(self.bin_root()):
399399
shutil.rmtree(self.bin_root())
400+
download_stage1 = self.stage1_commit is not None
400401
tarball_suffix = '.tar.xz' if support_xz() else '.tar.gz'
401402
filename = "rust-std-{}-{}{}".format(
402403
rustc_channel, self.build, tarball_suffix)
403404
pattern = "rust-std-{}".format(self.build)
404-
self._download_stage0_helper(filename, pattern, tarball_suffix)
405+
self._download_stage0_helper(filename, pattern, tarball_suffix, download_stage1)
405406
filename = "rustc-{}-{}{}".format(rustc_channel, self.build,
406407
tarball_suffix)
407-
self._download_stage0_helper(filename, "rustc", tarball_suffix)
408+
self._download_stage0_helper(filename, "rustc", tarball_suffix, download_stage1)
408409
filename = "cargo-{}-{}{}".format(rustc_channel, self.build,
409410
tarball_suffix)
410411
self._download_stage0_helper(filename, "cargo", tarball_suffix)
411412
if self.stage1_commit is not None:
412413
filename = "rustc-dev-{}-{}{}".format(rustc_channel, self.build, tarball_suffix)
413-
self._download_stage0_helper(filename, "rustc-dev", tarball_suffix)
414+
self._download_stage0_helper(filename, "rustc-dev", tarball_suffix, download_stage1)
414415

415416
self.fix_bin_or_dylib("{}/bin/rustc".format(self.bin_root()))
416417
self.fix_bin_or_dylib("{}/bin/rustdoc".format(self.bin_root()))
@@ -430,7 +431,7 @@ def download_stage0(self):
430431
tarball_suffix = '.tar.xz' if support_xz() else '.tar.gz'
431432
[channel, date] = rustfmt_channel.split('-', 1)
432433
filename = "rustfmt-{}-{}{}".format(channel, self.build, tarball_suffix)
433-
self._download_stage0_helper(filename, "rustfmt-preview", tarball_suffix, date)
434+
self._download_stage0_helper(filename, "rustfmt-preview", tarball_suffix, date=date)
434435
self.fix_bin_or_dylib("{}/bin/rustfmt".format(self.bin_root()))
435436
self.fix_bin_or_dylib("{}/bin/cargo-fmt".format(self.bin_root()))
436437
with output(self.rustfmt_stamp()) as rustfmt_stamp:
@@ -468,21 +469,26 @@ def downloading_llvm(self):
468469
return opt == "true" \
469470
or (opt == "if-available" and self.build == "x86_64-unknown-linux-gnu")
470471

471-
def _download_stage0_helper(self, filename, pattern, tarball_suffix, date=None):
472+
def _download_stage0_helper(
473+
self, filename, pattern, tarball_suffix, download_stage1=False, date=None
474+
):
472475
if date is None:
473-
date = self.stage1_commit or self.date
476+
if download_stage1:
477+
date = self.stage1_commit
478+
else:
479+
date = self.date
474480
cache_dst = os.path.join(self.build_dir, "cache")
475481
rustc_cache = os.path.join(cache_dst, date)
476482
if not os.path.exists(rustc_cache):
477483
os.makedirs(rustc_cache)
478484

479-
if self.stage1_commit is not None:
485+
if download_stage1:
480486
url = "https://ci-artifacts.rust-lang.org/rustc-builds/{}".format(self.stage1_commit)
481487
else:
482488
url = "{}/dist/{}".format(self._download_url, date)
483489
tarball = os.path.join(rustc_cache, filename)
484490
if not os.path.exists(tarball):
485-
do_verify = self.stage1_commit is None
491+
do_verify = not download_stage1
486492
get("{}/{}".format(url, filename), tarball, verbose=self.verbose, do_verify=do_verify)
487493
unpack(tarball, tarball_suffix, self.bin_root(), match=pattern, verbose=self.verbose)
488494

0 commit comments

Comments
 (0)