Skip to content

Commit 7a2c35c

Browse files
authored
Rollup merge of rust-lang#41608 - cuviper:distcheck-rust-src, r=alexcrichton
Add a distcheck for rust-src completeness This is for the last commit of rust-lang#41546. For some reason, @bors only saw the first two commits, and wouldn't approve the last even when explicitly directed so. r? @alexcrichton
2 parents c7a403e + c5cd4cb commit 7a2c35c

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
@@ -577,6 +577,7 @@ pub fn distcheck(build: &Build) {
577577
return
578578
}
579579

580+
println!("Distcheck");
580581
let dir = build.out.join("tmp").join("distcheck");
581582
let _ = fs::remove_dir_all(&dir);
582583
t!(fs::create_dir_all(&dir));
@@ -594,6 +595,26 @@ pub fn distcheck(build: &Build) {
594595
build.run(Command::new(build_helper::make(&build.config.build))
595596
.arg("check")
596597
.current_dir(&dir));
598+
599+
// Now make sure that rust-src has all of libstd's dependencies
600+
println!("Distcheck rust-src");
601+
let dir = build.out.join("tmp").join("distcheck-src");
602+
let _ = fs::remove_dir_all(&dir);
603+
t!(fs::create_dir_all(&dir));
604+
605+
let mut cmd = Command::new("tar");
606+
cmd.arg("-xzf")
607+
.arg(dist::rust_src_installer(build))
608+
.arg("--strip-components=1")
609+
.current_dir(&dir);
610+
build.run(&mut cmd);
611+
612+
let toml = dir.join("rust-src/lib/rustlib/src/rust/src/libstd/Cargo.toml");
613+
build.run(Command::new(&build.cargo)
614+
.arg("generate-lockfile")
615+
.arg("--manifest-path")
616+
.arg(&toml)
617+
.current_dir(&dir));
597618
}
598619

599620
/// Test the build system itself

src/bootstrap/dist.rs

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

318+
/// The path to the complete rustc-src tarball
318319
pub fn rust_src_location(build: &Build) -> PathBuf {
319320
let plain_name = format!("rustc-{}-src", build.rust_package_vers());
320321
distdir(build).join(&format!("{}.tar.gz", plain_name))
321322
}
322323

324+
/// The path to the rust-src component installer
325+
pub fn rust_src_installer(build: &Build) -> PathBuf {
326+
let name = pkgname(build, "rust-src");
327+
distdir(build).join(&format!("{}.tar.gz", name))
328+
}
329+
323330
/// Creates a tarball of save-analysis metadata, if available.
324331
pub fn analysis(build: &Build, compiler: &Compiler, target: &str) {
325332
assert!(build.config.extended);

0 commit comments

Comments
 (0)