except tarfile.CompressionError:
return False
-def get(url, path, verbose=False, do_verify=True):
+def get(url, path, verbose=False, do_verify=True, use_local_hash_if_present=True):
suffix = '.sha256'
sha_url = url + suffix
with tempfile.NamedTemporaryFile(delete=False) as temp_file:
temp_path = temp_file.name
- with tempfile.NamedTemporaryFile(suffix=suffix, delete=False) as sha_file:
- sha_path = sha_file.name
+ sha_path = path + suffix
try:
if do_verify:
- download(sha_path, sha_url, False, verbose)
+ if use_local_hash_if_present and os.path.exists(sha_path):
+ print("using already-download file " + sha_path)
+ else:
+ download(sha_path, sha_url, False, verbose)
if os.path.exists(path):
if verify(path, sha_path, False):
if verbose:
print("moving {} to {}".format(temp_path, path))
shutil.move(temp_path, path)
finally:
- delete_if_present(sha_path, verbose)
delete_if_present(temp_path, verbose)
else:
url = "https://ci-artifacts.rust-lang.org/rustc-builds/{}".format(self.rustc_commit)
tarball = os.path.join(rustc_cache, filename)
- if not os.path.exists(tarball):
+ if True:
get("{}/{}".format(url, filename), tarball, verbose=self.verbose, do_verify=stage0)
unpack(tarball, tarball_suffix, self.bin_root(stage0), match=pattern, verbose=self.verbose)