From db5b83dae223e86a6c585013cb9edaa851535204 Mon Sep 17 00:00:00 2001 From: Rust Maintainers Date: Sun, 15 Oct 2017 20:31:03 +0100 Subject: [PATCH] d-dont-download-stage0 Gbp-Pq: Name d-dont-download-stage0.patch --- configure | 1 - src/bootstrap/bootstrap.py | 17 +++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/configure b/configure index 084f5bfded..b22c832f9a 100755 --- a/configure +++ b/configure @@ -612,7 +612,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 cee2d941b9..646f37ab10 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -24,15 +24,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: @@ -50,7 +52,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) @@ -180,7 +181,7 @@ class RustBuild(object): rustc_channel, self.build) url = self._download_url + "/dist/" + self.stage0_date() tarball = os.path.join(rustc_cache, filename) - if not os.path.exists(tarball): + if True: get("{}/{}".format(url, filename), tarball, verbose=self.verbose) unpack(tarball, self.bin_root(), @@ -190,7 +191,7 @@ class RustBuild(object): filename = "rustc-{}-{}.tar.gz".format(rustc_channel, self.build) url = self._download_url + "/dist/" + self.stage0_date() tarball = os.path.join(rustc_cache, filename) - if not os.path.exists(tarball): + if True: get("{}/{}".format(url, filename), tarball, verbose=self.verbose) unpack(tarball, self.bin_root(), @@ -217,7 +218,7 @@ class RustBuild(object): filename = "cargo-{}-{}.tar.gz".format(cargo_channel, self.build) url = self._download_url + "/dist/" + self.stage0_date() tarball = os.path.join(rustc_cache, filename) - if not os.path.exists(tarball): + if True: get("{}/{}".format(url, filename), tarball, verbose=self.verbose) unpack(tarball, self.bin_root(), -- 2.30.2