Skip to content

Commit 6e2a901

Browse files
committed
Rollup merge of rust-lang#38468 - xen0n:tarball-wrangling, r=alexcrichton
rustbuild: Eliminate duplication of dist tarballs Fixes rust-lang#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
2 parents cade120 + 8e38b2d commit 6e2a901

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

src/bootstrap/dist.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,14 @@ pub fn analysis(build: &Build, compiler: &Compiler, target: &str) {
346346
}
347347

348348
/// Creates the `rust-src` installer component and the plain source tarball
349-
pub fn rust_src(build: &Build) {
349+
pub fn rust_src(build: &Build, host: &str) {
350350
println!("Dist src");
351+
352+
if host != build.config.build {
353+
println!("\tskipping, not a build host");
354+
return
355+
}
356+
351357
let plain_name = format!("rustc-{}-src", package_vers(build));
352358
let name = format!("rust-src-{}", package_vers(build));
353359
let image = tmpdir(build).join(format!("{}-image", name));

src/bootstrap/step.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ pub fn build_rules(build: &Build) -> Rules {
496496
rules.dist("dist-src", "src")
497497
.default(true)
498498
.host(true)
499-
.run(move |_| dist::rust_src(build));
499+
.run(move |s| dist::rust_src(build, s.target));
500500
rules.dist("dist-docs", "src/doc")
501501
.default(true)
502502
.dep(|s| s.name("default:doc"))
@@ -820,7 +820,16 @@ invalid rule dependency graph detected, was a rule added and maybe typo'd?
820820
let hosts = if self.build.flags.host.len() > 0 {
821821
&self.build.flags.host
822822
} else {
823-
&self.build.config.host
823+
if kind == Kind::Dist {
824+
// For 'dist' steps we only distribute artifacts built from
825+
// the build platform, so only consider that in the hosts
826+
// array.
827+
// NOTE: This relies on the fact that the build triple is
828+
// always placed first, as done in `config.rs`.
829+
&self.build.config.host[..1]
830+
} else {
831+
&self.build.config.host
832+
}
824833
};
825834
let targets = if self.build.flags.target.len() > 0 {
826835
&self.build.flags.target

0 commit comments

Comments
 (0)