From: Rust Maintainers Date: Tue, 25 Jul 2017 21:19:47 +0000 (+0100) Subject: d-dont-download-stage0 X-Git-Tag: archive/raspbian/1.19.0+dfsg3-4+rpi1~1^2~4 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=21bdbe63da05311517a88e4adddf8ed523aaa94c;p=rustc.git d-dont-download-stage0 Gbp-Pq: Name d-dont-download-stage0.patch --- diff --git a/configure b/configure index c683eed09f..fd56ef4ca7 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 3ba03b9f21..d47f09d1bc 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) @@ -173,8 +174,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) @@ -182,8 +182,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") @@ -204,8 +203,7 @@ class RustBuild(object): filename = "cargo-{}-{}.tar.gz".format('0.18.0', 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="cargo", verbose=self.verbose) self.fix_executable(self.bin_root() + "/bin/cargo") with open(self.cargo_stamp(), 'w') as f: