Skip to content

Commit c5cd4cb

Browse files
committed
Add a distcheck for rust-src completeness
1 parent b9bdb17 commit c5cd4cb

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

src/bootstrap/check.rs

+21
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,7 @@ pub fn distcheck(build: &Build) {
663663
return
664664
}
665665

666+
println!("Distcheck");
666667
let dir = build.out.join("tmp").join("distcheck");
667668
let _ = fs::remove_dir_all(&dir);
668669
t!(fs::create_dir_all(&dir));
@@ -680,6 +681,26 @@ pub fn distcheck(build: &Build) {
680681
build.run(Command::new(build_helper::make(&build.config.build))
681682
.arg("check")
682683
.current_dir(&dir));
684+
685+
// Now make sure that rust-src has all of libstd's dependencies
686+
println!("Distcheck rust-src");
687+
let dir = build.out.join("tmp").join("distcheck-src");
688+
let _ = fs::remove_dir_all(&dir);
689+
t!(fs::create_dir_all(&dir));
690+
691+
let mut cmd = Command::new("tar");
692+
cmd.arg("-xzf")
693+
.arg(dist::rust_src_installer(build))
694+
.arg("--strip-components=1")
695+
.current_dir(&dir);
696+
build.run(&mut cmd);
697+
698+
let toml = dir.join("rust-src/lib/rustlib/src/rust/src/libstd/Cargo.toml");
699+
build.run(Command::new(&build.cargo)
700+
.arg("generate-lockfile")
701+
.arg("--manifest-path")
702+
.arg(&toml)
703+
.current_dir(&dir));
683704
}
684705

685706
/// Test the build system itself

src/bootstrap/dist.rs

+7
Original file line numberDiff line numberDiff line change
@@ -310,11 +310,18 @@ pub fn std(build: &Build, compiler: &Compiler, target: &str) {
310310
t!(fs::remove_dir_all(&image));
311311
}
312312

313+
/// The path to the complete rustc-src tarball
313314
pub fn rust_src_location(build: &Build) -> PathBuf {
314315
let plain_name = format!("rustc-{}-src", build.rust_package_vers());
315316
distdir(build).join(&format!("{}.tar.gz", plain_name))
316317
}
317318

319+
/// The path to the rust-src component installer
320+
pub fn rust_src_installer(build: &Build) -> PathBuf {
321+
let name = pkgname(build, "rust-src");
322+
distdir(build).join(&format!("{}.tar.gz", name))
323+
}
324+
318325
/// Creates a tarball of save-analysis metadata, if available.
319326
pub fn analysis(build: &Build, compiler: &Compiler, target: &str) {
320327
assert!(build.config.extended);

0 commit comments

Comments
 (0)