feat(bundler): fallback to publisher for deb maintainer, closes #10777 (#10825)

This commit is contained in:
Lucas Fernandes Nogueira 2024-08-29 15:41:40 -03:00 committed by GitHub
parent 0d2efd9ff4
commit 5ec74456b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 25 additions and 6 deletions

View File

@ -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
Cargo.lock generated
View File

@ -7019,7 +7019,7 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
[[package]]
name = "tauri"
version = "2.0.0-rc.7"
version = "2.0.0-rc.8"
dependencies = [
"anyhow",
"bytes",

View File

@ -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 {

View File

@ -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].

View File

@ -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"

View File

@ -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"

View File

@ -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`.