builder.out.join("tmp/dist")
}
-fn rust_installer(builder: &Builder<'_>) -> Command {
- builder.tool_cmd(Tool::RustInstaller)
-}
-
fn missing_tool(tool_name: &str, skip: bool) {
if skip {
println!("Unable to build {}, skipping dist", tool_name)
/// Creates the plain source tarball
fn run(self, builder: &Builder<'_>) -> PathBuf {
- // Make sure that the root folder of tarball has the correct name
- let plain_name = format!("{}-src", pkgname(builder, "rustc"));
- let plain_dst_src = tmpdir(builder).join(&plain_name);
- let _ = fs::remove_dir_all(&plain_dst_src);
- t!(fs::create_dir_all(&plain_dst_src));
+ let tarball = Tarball::new(builder, "rustc", "src");
+ let plain_dst_src = tarball.image_dir();
// This is the set of root paths which will become part of the source package
let src_files = [
builder.run(&mut cmd);
}
- // Create plain source tarball
- let plain_name = format!("rustc-{}-src", builder.rust_package_vers());
- let mut tarball = distdir(builder).join(&format!("{}.tar.gz", plain_name));
- tarball.set_extension(""); // strip .gz
- tarball.set_extension(""); // strip .tar
- if let Some(dir) = tarball.parent() {
- builder.create_dir(&dir);
- }
- builder.info("running installer");
- let mut cmd = rust_installer(builder);
- cmd.arg("tarball")
- .arg("--input")
- .arg(&plain_name)
- .arg("--output")
- .arg(&tarball)
- .arg("--work-dir=.")
- .current_dir(tmpdir(builder));
-
- builder.info("Create plain source tarball");
- let _time = timeit(builder);
- builder.run(&mut cmd);
- distdir(builder).join(&format!("{}.tar.gz", plain_name))
+ tarball.bare()
}
}
let analysis_installer = builder.ensure(Analysis { compiler, target });
let docs_installer = builder.ensure(Docs { host: target });
- let std_installer =
- builder.ensure(Std { compiler: builder.compiler(stage, target), target });
+ let std_installer = builder.ensure(Std { compiler, target });
let etc = builder.src.join("src/etc/installer");
+ // Avoid producing tarballs during a dry run.
+ if builder.config.dry_run {
+ return;
+ }
+
// When rust-std package split from rustc, we needed to ensure that during
// upgrades rustc was upgraded before rust-std. To avoid rustc clobbering
// the std files during uninstall. To do this ensure that rustc comes
}
fn run(self, builder: &Builder<'_>) -> Self::Output {
- let name = pkgname(builder, "reproducible-artifacts");
- let tmp = tmpdir(builder);
-
- // Prepare the image.
- let image = tmp.join("reproducible-artifacts-image");
- let _ = fs::remove_dir_all(&image);
+ let path = builder.config.rust_profile_use.as_ref()?;
- if let Some(path) = &builder.config.rust_profile_use {
- builder.install(std::path::Path::new(path), &image, 0o644);
- } else {
- return None;
- }
-
- // Prepare the overlay.
- let overlay = tmp.join("reproducible-artifacts-overlay");
- let _ = fs::remove_dir_all(&overlay);
- builder.create_dir(&overlay);
- builder.create(&overlay.join("version"), &builder.rust_version());
- for file in &["COPYRIGHT", "LICENSE-APACHE", "LICENSE-MIT", "README.md"] {
- builder.install(&builder.src.join(file), &overlay, 0o644);
- }
-
- // Create the final tarball.
- let mut cmd = rust_installer(builder);
- cmd.arg("generate")
- .arg("--product-name=Rust")
- .arg("--rel-manifest-dir=rustlib")
- .arg("--success-message=reproducible-artifacts installed.")
- .arg("--image-dir")
- .arg(&image)
- .arg("--work-dir")
- .arg(&tmpdir(builder))
- .arg("--output-dir")
- .arg(&distdir(builder))
- .arg("--non-installed-overlay")
- .arg(&overlay)
- .arg(format!("--package-name={}-{}", name, self.target.triple))
- .arg("--legacy-manifest-dirs=rustlib,cargo")
- .arg("--component-name=reproducible-artifacts");
-
- builder.run(&mut cmd);
- Some(distdir(builder).join(format!("{}-{}.tar.gz", name, self.target.triple)))
+ let tarball = Tarball::new(builder, "reproducible-artifacts", &self.target.triple);
+ tarball.add_file(path, ".", 0o644);
+ Some(tarball.generate())
}
}