Skip to content

Commit

Permalink
Rollup merge of rust-lang#38468 - xen0n:tarball-wrangling, r=alexcric…
Browse files Browse the repository at this point in the history
…hton

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
  • Loading branch information
alexcrichton committed Dec 20, 2016
2 parents cade120 + 8e38b2d commit 6e2a901
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
13 changes: 11 additions & 2 deletions src/bootstrap/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6e2a901

Please sign in to comment.