Skip to content

Commit 30ef37b

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 <[email protected]>
1 parent 05965ae commit 30ef37b

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/bootstrap/bootstrap.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,10 @@ 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 line once the issue is closed.
604+
shutil.rmtree(self.bootstrap_out())
605+
602606
p.map(unpack_component, tarballs_download_info)
603607
finally:
604608
p.close()
@@ -864,6 +868,16 @@ def get_string(line):
864868
return line[start + 1:end]
865869
return None
866870

871+
def bootstrap_out(self):
872+
"""Return the path of the bootstrap build artifacts
873+
874+
>>> rb = RustBuild()
875+
>>> rb.build_dir = "build"
876+
>>> rb.bootstrap_binary() == os.path.join("build", "bootstrap")
877+
True
878+
"""
879+
return os.path.join(self.build_dir, "bootstrap")
880+
867881
def bootstrap_binary(self):
868882
"""Return the path of the bootstrap binary
869883
@@ -873,7 +887,7 @@ def bootstrap_binary(self):
873887
... "debug", "bootstrap")
874888
True
875889
"""
876-
return os.path.join(self.build_dir, "bootstrap", "debug", "bootstrap")
890+
return os.path.join(self.bootstrap_out(), "debug", "bootstrap")
877891

878892
def build_bootstrap(self):
879893
"""Build bootstrap"""

0 commit comments

Comments
 (0)