From 0a2034dca46f72d24d94c04b47c48d30149693bd Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Mon, 14 Dec 2020 15:53:07 +0100 Subject: bootstrap: add the dist.compression-formats option The option allows to add or remove compression formats used while producing dist tarballs. --- src/bootstrap/tarball.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/bootstrap/tarball.rs') diff --git a/src/bootstrap/tarball.rs b/src/bootstrap/tarball.rs index 5d73a655427..a918677f2e5 100644 --- a/src/bootstrap/tarball.rs +++ b/src/bootstrap/tarball.rs @@ -288,11 +288,25 @@ impl<'a> Tarball<'a> { build_cli(&self, &mut cmd); cmd.arg("--work-dir").arg(&self.temp_dir); + if let Some(formats) = &self.builder.config.dist_compression_formats { + assert!(!formats.is_empty(), "dist.compression-formats can't be empty"); + cmd.arg("--compression-formats").arg(formats.join(",")); + } self.builder.run(&mut cmd); if self.delete_temp_dir { t!(std::fs::remove_dir_all(&self.temp_dir)); } - crate::dist::distdir(self.builder).join(format!("{}.tar.gz", package_name)) + // Use either the first compression format defined, or "gz" as the default. + let ext = self + .builder + .config + .dist_compression_formats + .as_ref() + .and_then(|formats| formats.get(0)) + .map(|s| s.as_str()) + .unwrap_or("gz"); + + crate::dist::distdir(self.builder).join(format!("{}.tar.{}", package_name, ext)) } } -- cgit 1.4.1-3-g733a5