Skip to content

Commit

Permalink
Update 'rpm' to 0.13.1
Browse files Browse the repository at this point in the history
  • Loading branch information
olivierlemasle committed Dec 13, 2023
1 parent 7c320e0 commit 1dc6cb7
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 43 deletions.
2 changes: 1 addition & 1 deletion tooling/bundler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ regex = "1"
heck = "0.4"
ar = "0.9.0"
md5 = "0.7.0"
rpm = "0.12.1"
rpm = "0.13.1"

[lib]
name = "tauri_bundler"
Expand Down
18 changes: 10 additions & 8 deletions tooling/bundler/src/bundle/linux/rpm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
.or_else(|| settings.license())
.unwrap_or_default();

// This description is currently used as both summary and description.
// Waiting for a new release of crate "rpm", with https://github.com/rpm-rs/rpm/pull/178
// to have both summary and description.
let desc = settings.short_description();
let summary = settings.short_description().trim();

let package_base_name = format!("{name}-{version}-{release}.{arch}");
let package_name = format!("{package_base_name}.rpm");
Expand All @@ -55,10 +52,14 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {

info!(action = "Bundling"; "{} ({})", package_name, package_path.display());

let mut builder = rpm::PackageBuilder::new(name, version, license, arch, desc)
let mut builder = rpm::PackageBuilder::new(name, version, license, arch, summary)
.epoch(epoch)
.release(release);

if let Some(description) = settings.long_description() {
builder = builder.description(description.trim())
}

// Add requirements
for dep in settings.rpm().depends.as_ref().cloned().unwrap_or_default() {
builder = builder.requires(Dependency::any(dep));
Expand Down Expand Up @@ -134,9 +135,10 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
}

let pkg = if let Ok(raw_secret_key) = env::var("RPM_SIGN_KEY") {
// Does not support password-protected PGP keys
// Cf https://github.com/rpm-rs/rpm/issues/179
let signer = pgp::Signer::load_from_asc(&raw_secret_key)?;
let mut signer = pgp::Signer::load_from_asc(&raw_secret_key)?;
if let Ok(passphrase) = env::var("RPM_SIGN_KEY_PASSPHRASE") {
signer = signer.with_key_passphrase(passphrase);
}
builder.build_and_sign(signer)?
} else {
builder.build()?
Expand Down
12 changes: 1 addition & 11 deletions tooling/bundler/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,7 @@ pub enum Error {
/// Rpm error.
#[cfg(target_os = "linux")]
#[error("{0}")]
RpmError(String),
}

// We do not use #[from] from thiserror, because rpm::Error does not
// currently implement Send and Sync, and as such we do not want to have
// RpmError(rpm::Error).
#[cfg(target_os = "linux")]
impl From<rpm::Error> for Error {
fn from(e: rpm::Error) -> Self {
Self::RpmError(e.to_string())
}
RpmError(#[from] rpm::Error),
}

/// Convenient type alias of Result type.
Expand Down
64 changes: 41 additions & 23 deletions tooling/cli/Cargo.lock

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

1 change: 1 addition & 0 deletions tooling/cli/ENVIRONMENT_VARIABLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ These environment variables are inputs to the CLI which may have an equivalent C
- `TAURI_ANDROID_PROJECT_PATH` — Path of the tauri android project, usually will be `<project>/src-tauri/gen/android`.
- `TAURI_IOS_PROJECT_PATH` — Path of the tauri iOS project, usually will be `<project>/src-tauri/gen/ios`.
- `RPM_SIGN_KEY` — The private GPG key used to sign the RPM bundle, exported to its ASCII-armored format.
- `RPM_SIGN_KEY_PASSPHRASE` — The GPG key passphrase for `RPM_SIGN_KEY`, if needed.

### Tauri CLI Hook Commands

Expand Down

0 comments on commit 1dc6cb7

Please sign in to comment.