diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 33de8fd0107..49f00bf46f1 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -31,6 +31,14 @@ def get(url, path, verbose=False): try: download(sha_path, sha_url, verbose) + if os.path.exists(path): + try: + verify(path, sha_path, verbose) + print("using already-download file " + path) + return + except Exception as e: + print("failed verification for already-download file " + path) + os.unlink(path) download(temp_path, url, verbose) verify(temp_path, sha_path, verbose) print("moving {} to {}".format(temp_path, path)) diff --git a/src/etc/get-stage0.py b/src/etc/get-stage0.py index 28e3363189a..127251cc802 100644 --- a/src/etc/get-stage0.py +++ b/src/etc/get-stage0.py @@ -31,8 +31,6 @@ def main(triple): filename = 'rustc-{}-{}.tar.gz'.format(channel, triple) url = 'https://static.rust-lang.org/dist/{}/{}'.format(date, filename) dst = dl_dir + '/' + filename - if os.path.exists(dst): - os.unlink(dst) bootstrap.get(url, dst) stage0_dst = triple + '/stage0'