about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-02-25 12:19:55 +0000
committerbors <bors@rust-lang.org>2024-02-25 12:19:55 +0000
commit26cd5d862e22c013ecb3396b177d3af80e95c836 (patch)
tree333da31f36a6b37e7f35afdd99f00f8181cb9e8a /src/bootstrap
parent43fdd4916d19f4004e23d422b5547637ad67ab21 (diff)
parenta13ec8d00396ac6f5a3f285f8fcd95a2ab6c8824 (diff)
downloadrust-26cd5d862e22c013ecb3396b177d3af80e95c836.tar.gz
rust-26cd5d862e22c013ecb3396b177d3af80e95c836.zip
Auto merge of #118724 - onur-ozkan:refactor-x-install, r=Mark-Simulacrum
speed up `x install` by skipping archiving and compression

Performing archiving and compression on `x install` is nothing more than a waste of time and resources. Additionally, for systems like gentoo(which uses `x install`) this should be highly beneficial.

[benchmark report](https://github.com/rust-lang/rust/pull/118724#issuecomment-1848964908)

Resolves #109308

r? Mark-Simulacrum (I think you want to review this, feel free to change it if otherwise.)
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/src/utils/change_tracker.rs5
-rw-r--r--src/bootstrap/src/utils/tarball.rs19
2 files changed, 22 insertions, 2 deletions
diff --git a/src/bootstrap/src/utils/change_tracker.rs b/src/bootstrap/src/utils/change_tracker.rs
index b813d82ca6f..9a50ad4437e 100644
--- a/src/bootstrap/src/utils/change_tracker.rs
+++ b/src/bootstrap/src/utils/change_tracker.rs
@@ -131,4 +131,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
         severity: ChangeSeverity::Warning,
         summary: "The \"codegen\"/\"llvm\" profile has been removed and replaced with \"compiler\", use it instead for the same behavior.",
     },
+    ChangeInfo {
+        change_id: 118724,
+        severity: ChangeSeverity::Info,
+        summary: "`x install` now skips providing tarball sources (under 'build/dist' path) to speed up the installation process.",
+    },
 ];
diff --git a/src/bootstrap/src/utils/tarball.rs b/src/bootstrap/src/utils/tarball.rs
index 573d923ed8f..a14dfd1ca12 100644
--- a/src/bootstrap/src/utils/tarball.rs
+++ b/src/bootstrap/src/utils/tarball.rs
@@ -3,8 +3,8 @@ use std::{
     process::Command,
 };
 
-use crate::core::build_steps::dist::distdir;
 use crate::core::builder::Builder;
+use crate::core::{build_steps::dist::distdir, builder::Kind};
 use crate::utils::channel;
 use crate::utils::helpers::t;
 
@@ -325,7 +325,22 @@ impl<'a> Tarball<'a> {
             assert!(!formats.is_empty(), "dist.compression-formats can't be empty");
             cmd.arg("--compression-formats").arg(formats.join(","));
         }
-        cmd.args(["--compression-profile", &self.builder.config.dist_compression_profile]);
+
+        // For `x install` tarball files aren't needed, so we can speed up the process by not producing them.
+        let compression_profile = if self.builder.kind == Kind::Install {
+            self.builder.verbose("Forcing dist.compression-profile = 'no-op' for `x install`.");
+            // "no-op" indicates that the rust-installer won't produce compressed tarball sources.
+            "no-op"
+        } else {
+            assert!(
+                self.builder.config.dist_compression_profile != "no-op",
+                "dist.compression-profile = 'no-op' can only be used for `x install`"
+            );
+
+            &self.builder.config.dist_compression_profile
+        };
+
+        cmd.args(&["--compression-profile", compression_profile]);
         self.builder.run(&mut cmd);
 
         // Ensure there are no symbolic links in the tarball. In particular,