Skip to content

Commit b613b0c

Browse files
Correctly reinstall rustfmt on channel change
1 parent ecde10f commit b613b0c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/bootstrap/bootstrap.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ def support_xz():
397397

398398
if self.rustfmt() and self.rustfmt().startswith(self.bin_root()) and (
399399
not os.path.exists(self.rustfmt())
400-
or self.program_out_of_date(self.rustfmt_stamp())
400+
or self.program_out_of_date(self.rustfmt_stamp(), self.rustfmt_channel)
401401
):
402402
if rustfmt_channel:
403403
tarball_suffix = '.tar.xz' if support_xz() else '.tar.gz'
@@ -407,7 +407,7 @@ def support_xz():
407407
self.fix_executable("{}/bin/rustfmt".format(self.bin_root()))
408408
self.fix_executable("{}/bin/cargo-fmt".format(self.bin_root()))
409409
with output(self.rustfmt_stamp()) as rustfmt_stamp:
410-
rustfmt_stamp.write(self.date)
410+
rustfmt_stamp.write(self.date + self.rustfmt_channel)
411411

412412
def _download_stage0_helper(self, filename, pattern, tarball_suffix, date=None):
413413
if date is None:
@@ -521,12 +521,12 @@ def rustfmt_stamp(self):
521521
"""
522522
return os.path.join(self.bin_root(), '.rustfmt-stamp')
523523

524-
def program_out_of_date(self, stamp_path):
524+
def program_out_of_date(self, stamp_path, extra=""):
525525
"""Check if the given program stamp is out of date"""
526526
if not os.path.exists(stamp_path) or self.clean:
527527
return True
528528
with open(stamp_path, 'r') as stamp:
529-
return self.date != stamp.read()
529+
return (self.date + extra) != stamp.read()
530530

531531
def bin_root(self):
532532
"""Return the binary root directory

0 commit comments

Comments
 (0)