diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2017-03-15 07:13:59 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2017-03-15 07:13:59 -0700 |
| commit | 5de04060ba0b402fde8e35ba826c3dd3691c2d8f (patch) | |
| tree | fcfbe98bacd6c22a436d52a8904c3d4d6e88a460 | |
| parent | 6f10e2f63de720468e2b4bfcb275e4b90b1f9870 (diff) | |
| download | rust-5de04060ba0b402fde8e35ba826c3dd3691c2d8f.tar.gz rust-5de04060ba0b402fde8e35ba826c3dd3691c2d8f.zip | |
rustbuild: Retry downloads of OpenSSL source
We need this to compile Cargo and we download it at build time, but as like all other network requests it has a chance of failing. This commit moves the source of the tarball to a mirror (S3 seems semi-more-reliable most of the time) and also wraps the download in a retry loop. cc #40474
| -rw-r--r-- | src/bootstrap/native.rs | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index 6cc1ca8d02e..dea1a607255 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -222,9 +222,24 @@ pub fn openssl(build: &Build, target: &str) { let tarball = out.join(&name); if !tarball.exists() { let tmp = tarball.with_extension("tmp"); - build.run(Command::new("curl") - .arg("-o").arg(&tmp) - .arg(format!("https://www.openssl.org/source/{}", name))); + // originally from https://www.openssl.org/source/... + let url = format!("https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/{}", + name); + let mut ok = false; + for _ in 0..3 { + let status = Command::new("curl") + .arg("-o").arg(&tmp) + .arg(&url) + .status() + .expect("failed to spawn curl"); + if status.success() { + ok = true; + break + } + } + if !ok { + panic!("failed to download openssl source") + } let mut shasum = if target.contains("apple") { let mut cmd = Command::new("shasum"); cmd.arg("-a").arg("256"); |
