From 5ec74456b9ae45eaa63e225856de1b7eb83abe6f Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Thu, 29 Aug 2024 15:41:40 -0300 Subject: [PATCH] feat(bundler): fallback to publisher for deb maintainer, closes #10777 (#10825) --- .changes/maintainer-fallback.md | 5 +++++ Cargo.lock | 2 +- crates/tauri-bundler/src/bundle/linux/debian.rs | 12 +++++++++++- crates/tauri-bundler/src/bundle/settings.rs | 4 +++- crates/tauri-cli/config.schema.json | 2 +- .../schemas/config.schema.json | 2 +- crates/tauri-utils/src/config.rs | 4 +++- 7 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 .changes/maintainer-fallback.md diff --git a/.changes/maintainer-fallback.md b/.changes/maintainer-fallback.md new file mode 100644 index 000000000..28491d1e9 --- /dev/null +++ b/.changes/maintainer-fallback.md @@ -0,0 +1,5 @@ +--- +"tauri-bundler": patch:enhance +--- + +The debian `Maintainer` field now defaults to the Cargo.toml authors, but fallbacks to the `publisher` config value and the second part of the bundle identifier. diff --git a/Cargo.lock b/Cargo.lock index 967b3c276..c697efdfc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7019,7 +7019,7 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "tauri" -version = "2.0.0-rc.7" +version = "2.0.0-rc.8" dependencies = [ "anyhow", "bytes", diff --git a/crates/tauri-bundler/src/bundle/linux/debian.rs b/crates/tauri-bundler/src/bundle/linux/debian.rs index 4af355e9d..4baeba7a8 100644 --- a/crates/tauri-bundler/src/bundle/linux/debian.rs +++ b/crates/tauri-bundler/src/bundle/linux/debian.rs @@ -163,7 +163,17 @@ fn generate_control_file( writeln!(file, "Architecture: {arch}")?; // Installed-Size must be divided by 1024, see https://www.debian.org/doc/debian-policy/ch-controlfields.html#installed-size writeln!(file, "Installed-Size: {}", total_dir_size(data_dir)? / 1024)?; - let authors = settings.authors_comma_separated().unwrap_or_default(); + let authors = settings + .authors_comma_separated() + .or_else(|| settings.publisher().map(ToString::to_string)) + .unwrap_or_else(|| { + settings + .bundle_identifier() + .split('.') + .nth(1) + .unwrap_or(settings.bundle_identifier()) + .to_string() + }); writeln!(file, "Maintainer: {authors}")?; if let Some(section) = &settings.deb().section { diff --git a/crates/tauri-bundler/src/bundle/settings.rs b/crates/tauri-bundler/src/bundle/settings.rs index b749fa52f..fcf609805 100644 --- a/crates/tauri-bundler/src/bundle/settings.rs +++ b/crates/tauri-bundler/src/bundle/settings.rs @@ -539,7 +539,9 @@ pub struct BundleSettings { /// the app's identifier. pub identifier: Option, /// The app's publisher. Defaults to the second element in the identifier string. - /// Currently maps to the Manufacturer property of the Windows Installer. + /// + /// Currently maps to the Manufacturer property of the Windows Installer + /// and the Maintainer field of debian packages if the Cargo.toml does not have the authors field. pub publisher: Option, /// A url to the home page of your application. If None, will /// fallback to [PackageSettings::homepage]. diff --git a/crates/tauri-cli/config.schema.json b/crates/tauri-cli/config.schema.json index f0ad03cfc..79c9b1b0b 100644 --- a/crates/tauri-cli/config.schema.json +++ b/crates/tauri-cli/config.schema.json @@ -1546,7 +1546,7 @@ ] }, "publisher": { - "description": "The application's publisher. Defaults to the second element in the identifier string.\n Currently maps to the Manufacturer property of the Windows Installer.", + "description": "The application's publisher. Defaults to the second element in the identifier string.\n\n Currently maps to the Manufacturer property of the Windows Installer\n and the Maintainer field of debian packages if the Cargo.toml does not have the authors field.", "type": [ "string", "null" diff --git a/crates/tauri-schema-generator/schemas/config.schema.json b/crates/tauri-schema-generator/schemas/config.schema.json index f0ad03cfc..79c9b1b0b 100644 --- a/crates/tauri-schema-generator/schemas/config.schema.json +++ b/crates/tauri-schema-generator/schemas/config.schema.json @@ -1546,7 +1546,7 @@ ] }, "publisher": { - "description": "The application's publisher. Defaults to the second element in the identifier string.\n Currently maps to the Manufacturer property of the Windows Installer.", + "description": "The application's publisher. Defaults to the second element in the identifier string.\n\n Currently maps to the Manufacturer property of the Windows Installer\n and the Maintainer field of debian packages if the Cargo.toml does not have the authors field.", "type": [ "string", "null" diff --git a/crates/tauri-utils/src/config.rs b/crates/tauri-utils/src/config.rs index b362a2376..7092cb558 100644 --- a/crates/tauri-utils/src/config.rs +++ b/crates/tauri-utils/src/config.rs @@ -1142,7 +1142,9 @@ pub struct BundleConfig { /// Produce updaters and their signatures or not pub create_updater_artifacts: Updater, /// The application's publisher. Defaults to the second element in the identifier string. - /// Currently maps to the Manufacturer property of the Windows Installer. + /// + /// Currently maps to the Manufacturer property of the Windows Installer + /// and the Maintainer field of debian packages if the Cargo.toml does not have the authors field. pub publisher: Option, /// A url to the home page of your application. If unset, will /// fallback to `homepage` defined in `Cargo.toml`.