about summary refs log tree commit diff
path: root/src/bootstrap/tarball.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-12-31 00:23:13 +0000
committerbors <bors@rust-lang.org>2020-12-31 00:23:13 +0000
commitf0073a59cffebcf4f31e2bfa690a18f4f1dfd608 (patch)
treec4cb00158f45bda84f3baa0eece0df4c04086ac5 /src/bootstrap/tarball.rs
parent9775ffef2a4c3a36cadb58b72ea60cefb92c86ae (diff)
parent5526d902508178293b98b4d8b7b39802107dc395 (diff)
downloadrust-f0073a59cffebcf4f31e2bfa690a18f4f1dfd608.tar.gz
rust-f0073a59cffebcf4f31e2bfa690a18f4f1dfd608.zip
Auto merge of #80435 - pietroalbini:compression-formats, r=Mark-Simulacrum
Only produce .xz tarballs on CI

This PR adds a `./configure` option to choose which tarball compression formats to produce, and changes our CI configuration to only produce `.xz` tarballs. The release process will then recompress everything into `.gz` when producing a release.

This will drastically reduce our storage costs for CI artifacts, as we'd stop storing the same data twice. **Stable, beta and nightly releases will not be affected by this at all.**

Before landing this we'll need to increase the VM size of our release process, to recompress everything in a reasonable amount of time.
r? `@Mark-Simulacrum`
Diffstat (limited to 'src/bootstrap/tarball.rs')
-rw-r--r--src/bootstrap/tarball.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/bootstrap/tarball.rs b/src/bootstrap/tarball.rs
index 0255f79b659..137370fe6cb 100644
--- a/src/bootstrap/tarball.rs
+++ b/src/bootstrap/tarball.rs
@@ -294,11 +294,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))
     }
 }