From 98e3be6a83a58dce0e47f6eef3c0c667e3115edf Mon Sep 17 00:00:00 2001 From: Rust Maintainers Date: Mon, 17 Jul 2017 12:41:59 +0100 Subject: [PATCH] d-dont-download-stage0 Gbp-Pq: Name d-dont-download-stage0.patch --- configure | 1 - src/bootstrap/bootstrap.py | 20 +++++++++----------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/configure b/configure index 35b376d5f2..f34e8de4c2 100755 --- a/configure +++ b/configure @@ -611,7 +611,6 @@ if [ -n "$CFG_ENABLE_DEBUG_JEMALLOC" ]; then putvar CFG_ENABLE_DEBUG_JEMALLOC; f step_msg "looking for build programs" -probe_need CFG_CURL curl if [ -z "$CFG_PYTHON_PROVIDED" ]; then probe_need CFG_PYTHON python2.7 python2 python fi diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 01f4661cef..92b1f33d9b 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -23,15 +23,17 @@ import tempfile from time import time -def get(url, path, verbose=False): +def get(url, path, verbose=False, use_local_hash_if_present=True): sha_url = url + ".sha256" with tempfile.NamedTemporaryFile(delete=False) as temp_file: temp_path = temp_file.name - with tempfile.NamedTemporaryFile(suffix=".sha256", delete=False) as sha_file: - sha_path = sha_file.name + sha_path = path + ".sha256" try: - 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: @@ -48,7 +50,6 @@ def get(url, path, verbose=False): 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) @@ -175,8 +176,7 @@ class RustBuild(object): filename = "rust-std-{}-{}.tar.gz".format(channel, self.build) url = "https://static.rust-lang.org/dist/" + self.stage0_rustc_date() tarball = os.path.join(rustc_cache, filename) - if not os.path.exists(tarball): - get("{}/{}".format(url, filename), tarball, verbose=self.verbose) + get("{}/{}".format(url, filename), tarball, verbose=self.verbose) unpack(tarball, self.bin_root(), match="rust-std-" + self.build, verbose=self.verbose) @@ -184,8 +184,7 @@ class RustBuild(object): filename = "rustc-{}-{}.tar.gz".format(channel, self.build) url = "https://static.rust-lang.org/dist/" + self.stage0_rustc_date() tarball = os.path.join(rustc_cache, filename) - if not os.path.exists(tarball): - get("{}/{}".format(url, filename), tarball, verbose=self.verbose) + get("{}/{}".format(url, filename), tarball, verbose=self.verbose) unpack(tarball, self.bin_root(), match="rustc", verbose=self.verbose) self.fix_executable(self.bin_root() + "/bin/rustc") self.fix_executable(self.bin_root() + "/bin/rustdoc") @@ -198,8 +197,7 @@ class RustBuild(object): filename = "cargo-nightly-{}.tar.gz".format(self.build) url = "https://s3.amazonaws.com/rust-lang-ci/cargo-builds/" + self.stage0_cargo_rev() tarball = os.path.join(cargo_cache, filename) - if not os.path.exists(tarball): - get("{}/{}".format(url, filename), tarball, verbose=self.verbose) + get("{}/{}".format(url, filename), tarball, verbose=self.verbose) unpack(tarball, self.bin_root(), match="cargo", verbose=self.verbose) self.fix_executable(self.bin_root() + "/bin/cargo") with open(self.cargo_stamp(), 'w') as f: -- 2.30.2