Skip to content

Commit

Permalink
feat(bundler): fallback to publisher for deb maintainer, closes #10777 (
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog authored Aug 29, 2024
1 parent 0d2efd9 commit 5ec7445
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changes/maintainer-fallback.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion crates/tauri-bundler/src/bundle/linux/debian.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion crates/tauri-bundler/src/bundle/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,9 @@ pub struct BundleSettings {
/// the app's identifier.
pub identifier: Option<String>,
/// 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<String>,
/// A url to the home page of your application. If None, will
/// fallback to [PackageSettings::homepage].
Expand Down
2 changes: 1 addition & 1 deletion crates/tauri-cli/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion crates/tauri-schema-generator/schemas/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion crates/tauri-utils/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
/// A url to the home page of your application. If unset, will
/// fallback to `homepage` defined in `Cargo.toml`.
Expand Down

0 comments on commit 5ec7445

Please sign in to comment.