summaryrefslogtreecommitdiffstats
path: root/src/tools/rust-installer/src/generator.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/rust-installer/src/generator.rs')
-rw-r--r--src/tools/rust-installer/src/generator.rs58
1 files changed, 20 insertions, 38 deletions
diff --git a/src/tools/rust-installer/src/generator.rs b/src/tools/rust-installer/src/generator.rs
index ddd105259..b101e67d8 100644
--- a/src/tools/rust-installer/src/generator.rs
+++ b/src/tools/rust-installer/src/generator.rs
@@ -11,55 +11,55 @@ actor! {
#[derive(Debug)]
pub struct Generator {
/// The name of the product, for display
- #[clap(value_name = "NAME")]
+ #[arg(value_name = "NAME")]
product_name: String = "Product",
/// The name of the component, distinct from other installed components
- #[clap(value_name = "NAME")]
+ #[arg(value_name = "NAME")]
component_name: String = "component",
/// The name of the package, tarball
- #[clap(value_name = "NAME")]
+ #[arg(value_name = "NAME")]
package_name: String = "package",
/// The directory under lib/ where the manifest lives
- #[clap(value_name = "DIR")]
+ #[arg(value_name = "DIR")]
rel_manifest_dir: String = "packagelib",
/// The string to print after successful installation
- #[clap(value_name = "MESSAGE")]
+ #[arg(value_name = "MESSAGE")]
success_message: String = "Installed.",
/// Places to look for legacy manifests to uninstall
- #[clap(value_name = "DIRS")]
+ #[arg(value_name = "DIRS")]
legacy_manifest_dirs: String = "",
/// Directory containing files that should not be installed
- #[clap(value_name = "DIR")]
+ #[arg(value_name = "DIR")]
non_installed_overlay: String = "",
/// Path prefixes of directories that should be installed/uninstalled in bulk
- #[clap(value_name = "DIRS")]
+ #[arg(value_name = "DIRS")]
bulk_dirs: String = "",
/// The directory containing the installation medium
- #[clap(value_name = "DIR")]
+ #[arg(value_name = "DIR")]
image_dir: String = "./install_image",
/// The directory to do temporary work
- #[clap(value_name = "DIR")]
+ #[arg(value_name = "DIR")]
work_dir: String = "./workdir",
/// The location to put the final image and tarball
- #[clap(value_name = "DIR")]
+ #[arg(value_name = "DIR")]
output_dir: String = "./dist",
/// The profile used to compress the tarball.
- #[clap(value_name = "FORMAT", default_value_t)]
+ #[arg(value_name = "FORMAT", default_value_t)]
compression_profile: CompressionProfile,
/// The formats used to compress the tarball
- #[clap(value_name = "FORMAT", default_value_t)]
+ #[arg(value_name = "FORMAT", default_value_t)]
compression_formats: CompressionFormats,
}
}
@@ -86,12 +86,8 @@ impl Generator {
// Write the installer version (only used by combine-installers.sh)
let version = package_dir.join("rust-installer-version");
- writeln!(
- create_new_file(version)?,
- "{}",
- crate::RUST_INSTALLER_VERSION
- )
- .context("failed to write new installer version")?;
+ writeln!(create_new_file(version)?, "{}", crate::RUST_INSTALLER_VERSION)
+ .context("failed to write new installer version")?;
// Copy the overlay
if !self.non_installed_overlay.is_empty() {
@@ -118,7 +114,7 @@ impl Generator {
.input(self.package_name)
.output(path_to_str(&output)?.into())
.compression_profile(self.compression_profile)
- .compression_formats(self.compression_formats.clone());
+ .compression_formats(self.compression_formats);
tarballer.run()?;
Ok(())
@@ -128,33 +124,19 @@ impl Generator {
/// Copies the `src` directory recursively to `dst`, writing `manifest.in` too.
fn copy_and_manifest(src: &Path, dst: &Path, bulk_dirs: &str) -> Result<()> {
let mut manifest = create_new_file(dst.join("manifest.in"))?;
- let bulk_dirs: Vec<_> = bulk_dirs
- .split(',')
- .filter(|s| !s.is_empty())
- .map(Path::new)
- .collect();
+ let bulk_dirs: Vec<_> = bulk_dirs.split(',').filter(|s| !s.is_empty()).map(Path::new).collect();
let mut paths = BTreeSet::new();
copy_with_callback(src, dst, |path, file_type| {
// We need paths to be compatible with both Unix and Windows.
- if path
- .components()
- .filter_map(|c| c.as_os_str().to_str())
- .any(|s| s.contains('\\'))
- {
- bail!(
- "rust-installer doesn't support '\\' in path components: {:?}",
- path
- );
+ if path.components().filter_map(|c| c.as_os_str().to_str()).any(|s| s.contains('\\')) {
+ bail!("rust-installer doesn't support '\\' in path components: {:?}", path);
}
// Normalize to Unix-style path separators.
let normalized_string;
let mut string = path.to_str().ok_or_else(|| {
- format_err!(
- "rust-installer doesn't support non-Unicode paths: {:?}",
- path
- )
+ format_err!("rust-installer doesn't support non-Unicode paths: {:?}", path)
})?;
if string.contains('\\') {
normalized_string = string.replace('\\', "/");