diff --git a/.changes/deb-rpm-provides-conflicts-replaces.md b/.changes/deb-rpm-provides-conflicts-replaces.md new file mode 100644 index 000000000..8b6fd7473 --- /dev/null +++ b/.changes/deb-rpm-provides-conflicts-replaces.md @@ -0,0 +1,6 @@ +--- +'tauri-bundler': 'minor:feat' +'tauri-utils': 'minor:feat' +--- + +Added support for `provides`, `conflicts` and `replaces` (`obsoletes` for RPM) options for `bundler > deb` and `bundler > rpm` configs. diff --git a/core/tauri-config-schema/schema.json b/core/tauri-config-schema/schema.json index 2261211b3..edaee4254 100644 --- a/core/tauri-config-schema/schema.json +++ b/core/tauri-config-schema/schema.json @@ -2422,6 +2422,36 @@ "type": "string" } }, + "provides": { + "description": "The list of dependencies the package provides.", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "conflicts": { + "description": "The list of package conflicts.", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "replaces": { + "description": "The list of package replaces.", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, "files": { "description": "The files to include on the package.", "default": {}, @@ -2503,6 +2533,36 @@ "type": "string" } }, + "provides": { + "description": "The list of RPM dependencies your application provides.", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "conflicts": { + "description": "The list of RPM dependencies your application conflicts with. They must not be present in order for the package to be installed.", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "obsoletes": { + "description": "The list of RPM dependencies your application supersedes - if this package is installed, packages listed as “obsoletes” will be automatically removed (if they are present).", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, "release": { "description": "The RPM release tag.", "default": "1", diff --git a/core/tauri-utils/src/config.rs b/core/tauri-utils/src/config.rs index a9afc6e6b..23b611c2b 100644 --- a/core/tauri-utils/src/config.rs +++ b/core/tauri-utils/src/config.rs @@ -323,6 +323,12 @@ pub struct AppImageConfig { pub struct DebConfig { /// The list of deb dependencies your application relies on. pub depends: Option>, + /// The list of dependencies the package provides. + pub provides: Option>, + /// The list of package conflicts. + pub conflicts: Option>, + /// The list of package replaces. + pub replaces: Option>, /// The files to include on the package. #[serde(default)] pub files: HashMap, @@ -384,6 +390,14 @@ pub struct LinuxConfig { pub struct RpmConfig { /// The list of RPM dependencies your application relies on. pub depends: Option>, + /// The list of RPM dependencies your application provides. + pub provides: Option>, + /// The list of RPM dependencies your application conflicts with. They must not be present + /// in order for the package to be installed. + pub conflicts: Option>, + /// The list of RPM dependencies your application supersedes - if this package is installed, + /// packages listed as “obsoletes” will be automatically removed (if they are present). + pub obsoletes: Option>, /// The RPM release tag. #[serde(default = "default_release")] pub release: String, @@ -420,6 +434,9 @@ impl Default for RpmConfig { fn default() -> Self { Self { depends: None, + provides: None, + conflicts: None, + obsoletes: None, release: default_release(), epoch: 0, files: Default::default(), diff --git a/tooling/bundler/src/bundle/linux/debian.rs b/tooling/bundler/src/bundle/linux/debian.rs index 95c38a376..1de9278db 100644 --- a/tooling/bundler/src/bundle/linux/debian.rs +++ b/tooling/bundler/src/bundle/linux/debian.rs @@ -182,6 +182,33 @@ fn generate_control_file( if !dependencies.is_empty() { writeln!(file, "Depends: {}", dependencies.join(", "))?; } + let provides = settings + .deb() + .provides + .as_ref() + .cloned() + .unwrap_or_default(); + if !provides.is_empty() { + writeln!(file, "Provides: {}", provides.join(", "))?; + } + let conflicts = settings + .deb() + .conflicts + .as_ref() + .cloned() + .unwrap_or_default(); + if !conflicts.is_empty() { + writeln!(file, "Conflicts: {}", conflicts.join(", "))?; + } + let replaces = settings + .deb() + .replaces + .as_ref() + .cloned() + .unwrap_or_default(); + if !replaces.is_empty() { + writeln!(file, "Replaces: {}", replaces.join(", "))?; + } let mut short_description = settings.short_description().trim(); if short_description.is_empty() { short_description = "(none)"; diff --git a/tooling/bundler/src/bundle/linux/rpm.rs b/tooling/bundler/src/bundle/linux/rpm.rs index 437fe5b68..5181e1def 100644 --- a/tooling/bundler/src/bundle/linux/rpm.rs +++ b/tooling/bundler/src/bundle/linux/rpm.rs @@ -58,6 +58,39 @@ pub fn bundle_project(settings: &Settings) -> crate::Result> { builder = builder.requires(Dependency::any(dep)); } + // Add provides + for dep in settings + .rpm() + .provides + .as_ref() + .cloned() + .unwrap_or_default() + { + builder = builder.provides(Dependency::any(dep)); + } + + // Add conflicts + for dep in settings + .rpm() + .conflicts + .as_ref() + .cloned() + .unwrap_or_default() + { + builder = builder.conflicts(Dependency::any(dep)); + } + + // Add obsoletes + for dep in settings + .rpm() + .obsoletes + .as_ref() + .cloned() + .unwrap_or_default() + { + builder = builder.obsoletes(Dependency::any(dep)); + } + // Add binaries for bin in settings.binaries() { let src = settings.binary_path(bin); diff --git a/tooling/bundler/src/bundle/settings.rs b/tooling/bundler/src/bundle/settings.rs index 694305c0b..235849a8f 100644 --- a/tooling/bundler/src/bundle/settings.rs +++ b/tooling/bundler/src/bundle/settings.rs @@ -168,6 +168,12 @@ pub struct DebianSettings { // OS-specific settings: /// the list of debian dependencies. pub depends: Option>, + /// the list of dependencies the package provides. + pub provides: Option>, + /// the list of package conflicts. + pub conflicts: Option>, + /// the list of package replaces. + pub replaces: Option>, /// List of custom files to add to the deb package. /// Maps the path on the debian package to the path of the file to include (relative to the current working directory). pub files: HashMap, @@ -214,6 +220,14 @@ pub struct AppImageSettings { pub struct RpmSettings { /// The list of RPM dependencies your application relies on. pub depends: Option>, + /// The list of RPM dependencies your application provides. + pub provides: Option>, + /// The list of RPM dependencies your application conflicts with. They must not be present + /// in order for the package to be installed. + pub conflicts: Option>, + /// The list of RPM dependencies your application supersedes - if this package is installed, + /// packages listed as “obsoletes” will be automatically removed (if they are present). + pub obsoletes: Option>, /// The RPM release tag. pub release: String, /// The RPM epoch. diff --git a/tooling/cli/schema.json b/tooling/cli/schema.json index 2261211b3..edaee4254 100644 --- a/tooling/cli/schema.json +++ b/tooling/cli/schema.json @@ -2422,6 +2422,36 @@ "type": "string" } }, + "provides": { + "description": "The list of dependencies the package provides.", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "conflicts": { + "description": "The list of package conflicts.", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "replaces": { + "description": "The list of package replaces.", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, "files": { "description": "The files to include on the package.", "default": {}, @@ -2503,6 +2533,36 @@ "type": "string" } }, + "provides": { + "description": "The list of RPM dependencies your application provides.", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "conflicts": { + "description": "The list of RPM dependencies your application conflicts with. They must not be present in order for the package to be installed.", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "obsoletes": { + "description": "The list of RPM dependencies your application supersedes - if this package is installed, packages listed as “obsoletes” will be automatically removed (if they are present).", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, "release": { "description": "The RPM release tag.", "default": "1", diff --git a/tooling/cli/src/interface/rust.rs b/tooling/cli/src/interface/rust.rs index 4eae3c14a..1eea9b54d 100644 --- a/tooling/cli/src/interface/rust.rs +++ b/tooling/cli/src/interface/rust.rs @@ -1208,6 +1208,7 @@ fn tauri_config_to_bundle_settings( .unwrap_or(BundleResources::List(Vec::new())); #[allow(unused_mut)] let mut depends_deb = config.linux.deb.depends.unwrap_or_default(); + #[allow(unused_mut)] let mut depends_rpm = config.linux.rpm.depends.unwrap_or_default(); @@ -1330,6 +1331,9 @@ fn tauri_config_to_bundle_settings( } else { Some(depends_deb) }, + provides: config.linux.deb.provides, + conflicts: config.linux.deb.conflicts, + replaces: config.linux.deb.replaces, files: config.linux.deb.files, desktop_template: config.linux.deb.desktop_template, section: config.linux.deb.section, @@ -1349,6 +1353,9 @@ fn tauri_config_to_bundle_settings( } else { Some(depends_rpm) }, + provides: config.linux.rpm.provides, + conflicts: config.linux.rpm.conflicts, + obsoletes: config.linux.rpm.obsoletes, release: config.linux.rpm.release, epoch: config.linux.rpm.epoch, files: config.linux.rpm.files,