diff --git a/src/tools/rust-installer/src/generator.rs b/src/tools/rust-installer/src/generator.rs index b101e67d8df7f..1586760468726 100644 --- a/src/tools/rust-installer/src/generator.rs +++ b/src/tools/rust-installer/src/generator.rs @@ -61,6 +61,9 @@ actor! { /// The formats used to compress the tarball #[arg(value_name = "FORMAT", default_value_t)] compression_formats: CompressionFormats, + + /// Indicate whether to leave the prepared directories without generating tarballs + prepare_only: bool, } } @@ -105,17 +108,19 @@ impl Generator { .output_script(path_to_str(&output_script)?.into()); scripter.run()?; - // Make the tarballs - create_dir_all(&self.output_dir)?; - let output = Path::new(&self.output_dir).join(&self.package_name); - let mut tarballer = Tarballer::default(); - tarballer - .work_dir(self.work_dir) - .input(self.package_name) - .output(path_to_str(&output)?.into()) - .compression_profile(self.compression_profile) - .compression_formats(self.compression_formats); - tarballer.run()?; + if !self.prepare_only { + // Make the tarballs + create_dir_all(&self.output_dir)?; + let output = Path::new(&self.output_dir).join(&self.package_name); + let mut tarballer = Tarballer::default(); + tarballer + .work_dir(self.work_dir) + .input(self.package_name) + .output(path_to_str(&output)?.into()) + .compression_profile(self.compression_profile) + .compression_formats(self.compression_formats); + tarballer.run()?; + } Ok(()) }