Skip to content

Commit 92f85f1

Browse files
committed
wipe bootstrap build before switching to bumped rustc
Technically, wiping bootstrap builds can increase the build time. But in practice, trying to manually resolve post-bump issues and even accidentally removing the entire build directory will result in a much greater loss of time. After all, the bootstrap build process is not a particularly lengthy operation. Signed-off-by: onur-ozkan <work@onurozkan.dev>
1 parent 05965ae commit 92f85f1

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

Diff for: src/bootstrap/bootstrap.py

+17-1
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,12 @@ def download_toolchain(self):
599599
print('Choosing a pool size of', pool_size, 'for the unpacking of the tarballs')
600600
p = Pool(pool_size)
601601
try:
602+
# FIXME: A cheap workaround for https://github.com/rust-lang/rust/issues/125578,
603+
# remove this once the issue is closed.
604+
bootstrap_out = self.bootstrap_out()
605+
if os.path.exists(bootstrap_out):
606+
shutil.rmtree(bootstrap_out)
607+
602608
p.map(unpack_component, tarballs_download_info)
603609
finally:
604610
p.close()
@@ -864,6 +870,16 @@ def get_string(line):
864870
return line[start + 1:end]
865871
return None
866872

873+
def bootstrap_out(self):
874+
"""Return the path of the bootstrap build artifacts
875+
876+
>>> rb = RustBuild()
877+
>>> rb.build_dir = "build"
878+
>>> rb.bootstrap_binary() == os.path.join("build", "bootstrap")
879+
True
880+
"""
881+
return os.path.join(self.build_dir, "bootstrap")
882+
867883
def bootstrap_binary(self):
868884
"""Return the path of the bootstrap binary
869885
@@ -873,7 +889,7 @@ def bootstrap_binary(self):
873889
... "debug", "bootstrap")
874890
True
875891
"""
876-
return os.path.join(self.build_dir, "bootstrap", "debug", "bootstrap")
892+
return os.path.join(self.bootstrap_out(), "debug", "bootstrap")
877893

878894
def build_bootstrap(self):
879895
"""Build bootstrap"""

0 commit comments

Comments
 (0)