Browse Source

fix(rpm): use product name for output package (#9974)

* fix(rpm): use product name for output package

ref: https://github.com/tauri-apps/tauri/pull/9375
ref: https://github.com/tauri-apps/tauri/pull/9375#issuecomment-2144997488

* use kebab-case product-name for rpm

* fmt
Amr Bashir 1 year ago
parent
commit
de7da04a62
2 changed files with 10 additions and 3 deletions
  1. 6 0
      .changes/bundler-rpm-filename.md
  2. 4 3
      tooling/bundler/src/bundle/linux/rpm.rs

+ 6 - 0
.changes/bundler-rpm-filename.md

@@ -0,0 +1,6 @@
+---
+"tauri-bundler": "patch:bug"
+---
+
+Use the `productName` for `rpm` package name instead of main binary name, to be consistent with other bundle types.
+

+ 4 - 3
tooling/bundler/src/bundle/linux/rpm.rs

@@ -18,7 +18,7 @@ use super::freedesktop;
 /// Bundles the project.
 /// Returns a vector of PathBuf that shows where the RPM was created.
 pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
-  let name = settings.main_binary_name();
+  let product_name = settings.product_name();
   let version = settings.version_string();
   let release = settings.rpm().release.as_str();
   let epoch = settings.rpm().epoch;
@@ -30,7 +30,7 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
 
   let summary = settings.short_description().trim();
 
-  let package_base_name = format!("{name}-{version}-{release}.{arch}");
+  let package_base_name = format!("{product_name}-{version}-{release}.{arch}");
   let package_name = format!("{package_base_name}.rpm");
 
   let base_dir = settings.project_out_directory().join("bundle/rpm");
@@ -45,7 +45,8 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
   log::info!(action = "Bundling"; "{} ({})", package_name, package_path.display());
 
   let license = settings.license().unwrap_or_default();
-  let mut builder = rpm::PackageBuilder::new(name, version, &license, arch, summary)
+  let name = heck::AsKebabCase(settings.product_name()).to_string();
+  let mut builder = rpm::PackageBuilder::new(&name, version, &license, arch, summary)
     .epoch(epoch)
     .release(release)
     // This matches .deb compression. On a 240MB source binary the bundle will be 100KB larger than rpm's default while reducing build times by ~25%.