From: Rust Maintainers Date: Sun, 15 Oct 2017 21:30:35 +0000 (+0100) Subject: d-dont-download-stage0 X-Git-Tag: archive/raspbian/1.20.0+dfsg1-1+rpi1^2~5 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=304104ba05d9f224fc1af15b03ae6954e4ca5128;p=rustc.git d-dont-download-stage0 Gbp-Pq: Name d-dont-download-stage0.patch --- diff --git a/configure b/configure index e3ad7ce85f..d16b68c0ba 100755 --- a/configure +++ b/configure @@ -614,7 +614,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 15fb71de29..fa75586491 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -24,16 +24,18 @@ import tempfile from time import time -def get(url, path, verbose=False): +def get(url, path, verbose=False, 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: - 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: @@ -51,7 +53,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) @@ -185,7 +186,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(), @@ -195,7 +196,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(), @@ -222,7 +223,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(),