mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-11-28 03:47:37 +03:00
feat(bundler): added provides, conflicts and replaces for deb and rpm (#9331)
* feat(bundler): added provides, conflicts and replaces for deb and rpm packages * added change file * update .changes/deb-rpm-provides-conflicts-replaces.md according to review Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com> * inlined provides/conflicts/replaces(obsoletes) variables * fmt
This commit is contained in:
parent
2f20fdf1d6
commit
36b4c12497
6
.changes/deb-rpm-provides-conflicts-replaces.md
Normal file
6
.changes/deb-rpm-provides-conflicts-replaces.md
Normal file
@ -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.
|
@ -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",
|
||||
|
@ -323,6 +323,12 @@ pub struct AppImageConfig {
|
||||
pub struct DebConfig {
|
||||
/// The list of deb dependencies your application relies on.
|
||||
pub depends: Option<Vec<String>>,
|
||||
/// The list of dependencies the package provides.
|
||||
pub provides: Option<Vec<String>>,
|
||||
/// The list of package conflicts.
|
||||
pub conflicts: Option<Vec<String>>,
|
||||
/// The list of package replaces.
|
||||
pub replaces: Option<Vec<String>>,
|
||||
/// The files to include on the package.
|
||||
#[serde(default)]
|
||||
pub files: HashMap<PathBuf, PathBuf>,
|
||||
@ -384,6 +390,14 @@ pub struct LinuxConfig {
|
||||
pub struct RpmConfig {
|
||||
/// The list of RPM dependencies your application relies on.
|
||||
pub depends: Option<Vec<String>>,
|
||||
/// The list of RPM dependencies your application provides.
|
||||
pub provides: Option<Vec<String>>,
|
||||
/// 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<Vec<String>>,
|
||||
/// 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<Vec<String>>,
|
||||
/// 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(),
|
||||
|
@ -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)";
|
||||
|
@ -58,6 +58,39 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
|
||||
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);
|
||||
|
@ -168,6 +168,12 @@ pub struct DebianSettings {
|
||||
// OS-specific settings:
|
||||
/// the list of debian dependencies.
|
||||
pub depends: Option<Vec<String>>,
|
||||
/// the list of dependencies the package provides.
|
||||
pub provides: Option<Vec<String>>,
|
||||
/// the list of package conflicts.
|
||||
pub conflicts: Option<Vec<String>>,
|
||||
/// the list of package replaces.
|
||||
pub replaces: Option<Vec<String>>,
|
||||
/// 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<PathBuf, PathBuf>,
|
||||
@ -214,6 +220,14 @@ pub struct AppImageSettings {
|
||||
pub struct RpmSettings {
|
||||
/// The list of RPM dependencies your application relies on.
|
||||
pub depends: Option<Vec<String>>,
|
||||
/// The list of RPM dependencies your application provides.
|
||||
pub provides: Option<Vec<String>>,
|
||||
/// 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<Vec<String>>,
|
||||
/// 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<Vec<String>>,
|
||||
/// The RPM release tag.
|
||||
pub release: String,
|
||||
/// The RPM epoch.
|
||||
|
@ -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",
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user