Rollup merge of #125911 - onur-ozkan:wipe-broken-cache, r=albertlarsan68

delete 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.

Workaround for #125578
This commit is contained in:
Matthias Krüger 2024-06-05 18:21:11 +02:00 committed by GitHub
commit ebc66fd04d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -599,6 +599,12 @@ class RustBuild(object):
print('Choosing a pool size of', pool_size, 'for the unpacking of the tarballs') print('Choosing a pool size of', pool_size, 'for the unpacking of the tarballs')
p = Pool(pool_size) p = Pool(pool_size)
try: try:
# FIXME: A cheap workaround for https://github.com/rust-lang/rust/issues/125578,
# remove this once the issue is closed.
bootstrap_out = self.bootstrap_out()
if os.path.exists(bootstrap_out):
shutil.rmtree(bootstrap_out)
p.map(unpack_component, tarballs_download_info) p.map(unpack_component, tarballs_download_info)
finally: finally:
p.close() p.close()
@ -864,6 +870,16 @@ class RustBuild(object):
return line[start + 1:end] return line[start + 1:end]
return None return None
def bootstrap_out(self):
"""Return the path of the bootstrap build artifacts
>>> rb = RustBuild()
>>> rb.build_dir = "build"
>>> rb.bootstrap_binary() == os.path.join("build", "bootstrap")
True
"""
return os.path.join(self.build_dir, "bootstrap")
def bootstrap_binary(self): def bootstrap_binary(self):
"""Return the path of the bootstrap binary """Return the path of the bootstrap binary
@ -873,7 +889,7 @@ class RustBuild(object):
... "debug", "bootstrap") ... "debug", "bootstrap")
True True
""" """
return os.path.join(self.build_dir, "bootstrap", "debug", "bootstrap") return os.path.join(self.bootstrap_out(), "debug", "bootstrap")
def build_bootstrap(self): def build_bootstrap(self):
"""Build bootstrap""" """Build bootstrap"""