From 46d74eac236c7b58c848a471d81f9d5c59362513 Mon Sep 17 00:00:00 2001 From: Wang Xuerui Date: Mon, 19 Dec 2016 15:30:14 +0800 Subject: [PATCH 1/2] rustbuild: only plan from build triple for dist We only want to package each host/target once for `dist`. The obvious solution takes the form of step dependency, which is implemented at least for the `dist-rustc` step. Unfortunately since the steps are created from `hosts x targets` during planning and *not* de-duplicated afterwards, the problem still persists. We therefore move the check inside `plan()` instead, to avoid creating the duplicate steps in the first place. --- src/bootstrap/step.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/step.rs b/src/bootstrap/step.rs index 35eb98e4723f2..def06ee698353 100644 --- a/src/bootstrap/step.rs +++ b/src/bootstrap/step.rs @@ -822,7 +822,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 From 8e38b2de42dda1752400524b69f76051586d469b Mon Sep 17 00:00:00 2001 From: Wang Xuerui Date: Mon, 19 Dec 2016 16:39:19 +0800 Subject: [PATCH 2/2] rustbuild: package src only once for build triple --- src/bootstrap/dist.rs | 8 +++++++- src/bootstrap/step.rs | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index be51a6753fb62..6e3174ed2f6d0 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 def06ee698353..719fb82a56dce 100644 --- a/src/bootstrap/step.rs +++ b/src/bootstrap/step.rs @@ -499,7 +499,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"))