about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2016-12-20 11:16:42 -0800
committerAlex Crichton <alex@alexcrichton.com>2016-12-20 12:59:08 -0800
commit6e2a90193035643b046924dcf2ab90aab7dec2d9 (patch)
treeb848a2483eef093df1a857d18e51ff4fd5a41c0b
parentcade120da3bea3e26019b0a8c94d26ec7e136261 (diff)
parent8e38b2de42dda1752400524b69f76051586d469b (diff)
downloadrust-6e2a90193035643b046924dcf2ab90aab7dec2d9.tar.gz
rust-6e2a90193035643b046924dcf2ab90aab7dec2d9.zip
Rollup merge of #38468 - xen0n:tarball-wrangling, r=alexcrichton
rustbuild: Eliminate duplication of dist tarballs

Fixes #38365 by not constructing the duplicate steps in the first place, as suggested. The source package step is lacking the check as in other steps, so it is added as well.

Tested locally with the `alexcrichton/rust-slave-linux-cross:2016-11-11` container (with the build slave init replaced with no-op, of course).

r? @alexcrichton
-rw-r--r--src/bootstrap/dist.rs8
-rw-r--r--src/bootstrap/step.rs13
2 files changed, 18 insertions, 3 deletions
diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs
index be51a6753fb..6e3174ed2f6 100644
--- a/src/bootstrap/dist.rs
+++ b/src/bootstrap/dist.rs
@@ -346,8 +346,14 @@ pub fn analysis(build: &Build, compiler: &Compiler, target: &str) {
 }
 
 /// Creates the `rust-src` installer component and the plain source tarball
-pub fn rust_src(build: &Build) {
+pub fn rust_src(build: &Build, host: &str) {
     println!("Dist src");
+
+    if host != build.config.build {
+        println!("\tskipping, not a build host");
+        return
+    }
+
     let plain_name = format!("rustc-{}-src", package_vers(build));
     let name = format!("rust-src-{}", package_vers(build));
     let image = tmpdir(build).join(format!("{}-image", name));
diff --git a/src/bootstrap/step.rs b/src/bootstrap/step.rs
index 7583d395175..5b3ce2ea5bc 100644
--- a/src/bootstrap/step.rs
+++ b/src/bootstrap/step.rs
@@ -496,7 +496,7 @@ pub fn build_rules(build: &Build) -> Rules {
     rules.dist("dist-src", "src")
          .default(true)
          .host(true)
-         .run(move |_| dist::rust_src(build));
+         .run(move |s| dist::rust_src(build, s.target));
     rules.dist("dist-docs", "src/doc")
          .default(true)
          .dep(|s| s.name("default:doc"))
@@ -820,7 +820,16 @@ invalid rule dependency graph detected, was a rule added and maybe typo'd?
             let hosts = if self.build.flags.host.len() > 0 {
                 &self.build.flags.host
             } else {
-                &self.build.config.host
+                if kind == Kind::Dist {
+                    // For 'dist' steps we only distribute artifacts built from
+                    // the build platform, so only consider that in the hosts
+                    // array.
+                    // NOTE: This relies on the fact that the build triple is
+                    // always placed first, as done in `config.rs`.
+                    &self.build.config.host[..1]
+                } else {
+                    &self.build.config.host
+                }
             };
             let targets = if self.build.flags.target.len() > 0 {
                 &self.build.flags.target