Build the rustc-src tarball before the rust-src component
This commit is contained in:
parent
2b4c911581
commit
7248f67f1b
1 changed files with 33 additions and 27 deletions
|
@ -369,13 +369,11 @@ pub fn rust_src(build: &Build) {
|
||||||
|
|
||||||
println!("Dist src");
|
println!("Dist src");
|
||||||
|
|
||||||
let name = pkgname(build, "rust-src");
|
// Make sure that the root folder of tarball has the correct name
|
||||||
let image = tmpdir(build).join(format!("{}-image", name));
|
let plain_name = format!("rustc-{}-src", build.rust_package_vers());
|
||||||
let _ = fs::remove_dir_all(&image);
|
let plain_dst_src = tmpdir(build).join(&plain_name);
|
||||||
|
let _ = fs::remove_dir_all(&plain_dst_src);
|
||||||
let dst = image.join("lib/rustlib/src");
|
t!(fs::create_dir_all(&plain_dst_src));
|
||||||
let dst_src = dst.join("rust");
|
|
||||||
t!(fs::create_dir_all(&dst_src));
|
|
||||||
|
|
||||||
// This is the set of root paths which will become part of the source package
|
// This is the set of root paths which will become part of the source package
|
||||||
let src_files = [
|
let src_files = [
|
||||||
|
@ -424,13 +422,13 @@ pub fn rust_src(build: &Build) {
|
||||||
|
|
||||||
// Copy the directories using our filter
|
// Copy the directories using our filter
|
||||||
for item in &src_dirs {
|
for item in &src_dirs {
|
||||||
let dst = &dst_src.join(item);
|
let dst = &plain_dst_src.join(item);
|
||||||
t!(fs::create_dir(dst));
|
t!(fs::create_dir(dst));
|
||||||
cp_filtered(&build.src.join(item), dst, &filter_fn);
|
cp_filtered(&build.src.join(item), dst, &filter_fn);
|
||||||
}
|
}
|
||||||
// Copy the files normally
|
// Copy the files normally
|
||||||
for item in &src_files {
|
for item in &src_files {
|
||||||
copy(&build.src.join(item), &dst_src.join(item));
|
copy(&build.src.join(item), &plain_dst_src.join(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're building from git sources, we need to vendor a complete distribution.
|
// If we're building from git sources, we need to vendor a complete distribution.
|
||||||
|
@ -455,10 +453,35 @@ pub fn rust_src(build: &Build) {
|
||||||
// Vendor all Cargo dependencies
|
// Vendor all Cargo dependencies
|
||||||
let mut cmd = Command::new(&build.cargo);
|
let mut cmd = Command::new(&build.cargo);
|
||||||
cmd.arg("vendor")
|
cmd.arg("vendor")
|
||||||
.current_dir(&dst_src.join("src"));
|
.current_dir(&plain_dst_src.join("src"));
|
||||||
build.run(&mut cmd);
|
build.run(&mut cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create the version file
|
||||||
|
write_file(&plain_dst_src.join("version"), build.rust_version().as_bytes());
|
||||||
|
|
||||||
|
// Create plain source tarball
|
||||||
|
let tarball = rust_src_location(build);
|
||||||
|
if let Some(dir) = tarball.parent() {
|
||||||
|
t!(fs::create_dir_all(dir));
|
||||||
|
}
|
||||||
|
let mut cmd = Command::new("tar");
|
||||||
|
cmd.arg("-czf").arg(sanitize_sh(&tarball))
|
||||||
|
.arg(&plain_name)
|
||||||
|
.current_dir(tmpdir(build));
|
||||||
|
build.run(&mut cmd);
|
||||||
|
|
||||||
|
|
||||||
|
let name = pkgname(build, "rust-src");
|
||||||
|
let image = tmpdir(build).join(format!("{}-image", name));
|
||||||
|
let _ = fs::remove_dir_all(&image);
|
||||||
|
|
||||||
|
let dst = image.join("lib/rustlib/src");
|
||||||
|
let dst_src = dst.join("rust");
|
||||||
|
t!(fs::create_dir_all(&dst_src));
|
||||||
|
|
||||||
|
cp_r(&plain_dst_src, &dst_src);
|
||||||
|
|
||||||
// Create source tarball in rust-installer format
|
// Create source tarball in rust-installer format
|
||||||
let mut cmd = Command::new(SH_CMD);
|
let mut cmd = Command::new(SH_CMD);
|
||||||
cmd.arg(sanitize_sh(&build.src.join("src/rust-installer/gen-installer.sh")))
|
cmd.arg(sanitize_sh(&build.src.join("src/rust-installer/gen-installer.sh")))
|
||||||
|
@ -473,23 +496,6 @@ pub fn rust_src(build: &Build) {
|
||||||
.arg("--legacy-manifest-dirs=rustlib,cargo");
|
.arg("--legacy-manifest-dirs=rustlib,cargo");
|
||||||
build.run(&mut cmd);
|
build.run(&mut cmd);
|
||||||
|
|
||||||
// Rename directory, so that root folder of tarball has the correct name
|
|
||||||
let plain_name = format!("rustc-{}-src", build.rust_package_vers());
|
|
||||||
let plain_dst_src = tmpdir(build).join(&plain_name);
|
|
||||||
let _ = fs::remove_dir_all(&plain_dst_src);
|
|
||||||
t!(fs::create_dir_all(&plain_dst_src));
|
|
||||||
cp_r(&dst_src, &plain_dst_src);
|
|
||||||
|
|
||||||
// Create the version file
|
|
||||||
write_file(&plain_dst_src.join("version"), build.rust_version().as_bytes());
|
|
||||||
|
|
||||||
// Create plain source tarball
|
|
||||||
let mut cmd = Command::new("tar");
|
|
||||||
cmd.arg("-czf").arg(sanitize_sh(&rust_src_location(build)))
|
|
||||||
.arg(&plain_name)
|
|
||||||
.current_dir(tmpdir(build));
|
|
||||||
build.run(&mut cmd);
|
|
||||||
|
|
||||||
t!(fs::remove_dir_all(&image));
|
t!(fs::remove_dir_all(&image));
|
||||||
t!(fs::remove_dir_all(&plain_dst_src));
|
t!(fs::remove_dir_all(&plain_dst_src));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue