fix: ensure file type bit is set for rpm bundle (#5459)

By using the `permissions()` method of `FileOptionsBuilder`,
which was added in version 0.20.0 of the `rpm` crate, we fix
a bug where newer versions of `rpm` (the package, not the
crate) would fail when installing the bundle.
This commit is contained in:
Lluc Simó authored and GitHub committed 2026-04-07 12:55:16 -07:00
1 parent a07b406699
commit 610ee8107f
3 files changed
+21 -11

No files matched your search

Generated
+3 -2
View File
@@ -13112,9 +13112,9 @@ checksum = "6c20b6793b5c2fa6553b250154b78d6d0db37e72700ae35fad9387a46f487c97"
[[package]] [[package]]
name = "rpm" name = "rpm"
version = "0.19.0" version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95c0e45982d67e35e3bbffb24d95e3d0282211ac2dad755b2ab24b9ffc07b199" checksum = "42b9353ebc70385f83520d2490e23139ae78f897a5d7e3b7c34cb8a9f91c69a6"
dependencies = [ dependencies = [
"base64 0.22.1", "base64 0.22.1",
"bitflags 2.11.0", "bitflags 2.11.0",
@@ -13126,6 +13126,7 @@ dependencies = [
"itertools 0.14.0", "itertools 0.14.0",
"log", "log",
"md-5", "md-5",
"memchr",
"nom 8.0.0", "nom 8.0.0",
"num", "num",
"num-derive", "num-derive",
+1 -1
View File
@@ -239,7 +239,7 @@ image = "0.25.6"
zip = { version = "4", default-features = false, features = ["deflate"] } zip = { version = "4", default-features = false, features = ["deflate"] }
sha1 = "0.10.6" sha1 = "0.10.6"
md5 = "0.8.0" md5 = "0.8.0"
rpm = { version = "0.19.0", default-features = false, features = ["gzip-compression"] } rpm = { version = "0.20.0", default-features = false, features = ["gzip-compression"] }
lru = "0.16.0" lru = "0.16.0"
async-trait = "0.1.88" async-trait = "0.1.88"
axum = { version = "0.8.4", default-features = false } axum = { version = "0.8.4", default-features = false }
+17 -8
View File
@@ -248,7 +248,10 @@ impl BundleContext<'_> {
let binary_path = self.main_binary_path(); let binary_path = self.main_binary_path();
let dest_bin = format!("/usr/bin/{name}"); let dest_bin = format!("/usr/bin/{name}");
builder = builder builder = builder
.with_file(&binary_path, rpm::FileOptions::new(dest_bin).mode(0o755)) .with_file(
&binary_path,
rpm::FileOptions::new(dest_bin).permissions(0o755),
)
.context("Failed to add binary to RPM")?; .context("Failed to add binary to RPM")?;
let deb_settings = self.deb(); let deb_settings = self.deb();
@@ -264,7 +267,7 @@ impl BundleContext<'_> {
builder = builder builder = builder
.with_file( .with_file(
&temp_desktop, &temp_desktop,
rpm::FileOptions::new(desktop_dest).mode(0o644), rpm::FileOptions::new(desktop_dest).permissions(0o644),
) )
.context("Failed to add desktop file to RPM")?; .context("Failed to add desktop file to RPM")?;
@@ -287,7 +290,10 @@ impl BundleContext<'_> {
let dest = let dest =
format!("/usr/share/icons/hicolor/{size}x{size}/apps/{name}.png"); format!("/usr/share/icons/hicolor/{size}x{size}/apps/{name}.png");
builder = builder builder = builder
.with_file(icon_path, rpm::FileOptions::new(dest).mode(0o644)) .with_file(
icon_path,
rpm::FileOptions::new(dest).permissions(0o644),
)
.context("Failed to add icon to RPM")?; .context("Failed to add icon to RPM")?;
} }
} }
@@ -295,7 +301,7 @@ impl BundleContext<'_> {
"svg" => { "svg" => {
let dest = format!("/usr/share/icons/hicolor/scalable/apps/{name}.svg"); let dest = format!("/usr/share/icons/hicolor/scalable/apps/{name}.svg");
builder = builder builder = builder
.with_file(icon_path, rpm::FileOptions::new(dest).mode(0o644)) .with_file(icon_path, rpm::FileOptions::new(dest).permissions(0o644))
.context("Failed to add SVG icon to RPM")?; .context("Failed to add SVG icon to RPM")?;
} }
"ico" => { "ico" => {
@@ -317,7 +323,10 @@ impl BundleContext<'_> {
let dest = format!("/usr/share/icons/hicolor/{size}x{size}/apps/{name}.png"); let dest = format!("/usr/share/icons/hicolor/{size}x{size}/apps/{name}.png");
builder = builder builder = builder
.with_file(&converted_icon, rpm::FileOptions::new(dest).mode(0o644)) .with_file(
&converted_icon,
rpm::FileOptions::new(dest).permissions(0o644),
)
.context("Failed to add converted ICO icon to RPM")?; .context("Failed to add converted ICO icon to RPM")?;
} }
_ => { _ => {
@@ -341,7 +350,7 @@ impl BundleContext<'_> {
relative.to_string_lossy().replace('\\', "/") relative.to_string_lossy().replace('\\', "/")
); );
builder = builder builder = builder
.with_file(src, rpm::FileOptions::new(&dest).mode(0o644)) .with_file(src, rpm::FileOptions::new(&dest).permissions(0o644))
.with_context(|| format!("Failed to add resource {} to RPM", relative.display()))?; .with_context(|| format!("Failed to add resource {} to RPM", relative.display()))?;
} }
@@ -355,7 +364,7 @@ impl BundleContext<'_> {
.context("External binary is missing a file name")?; .context("External binary is missing a file name")?;
let dest = format!("/usr/bin/{dest_name}"); let dest = format!("/usr/bin/{dest_name}");
builder = builder builder = builder
.with_file(src, rpm::FileOptions::new(&dest).mode(0o755)) .with_file(src, rpm::FileOptions::new(&dest).permissions(0o755))
.with_context(|| format!("Failed to add external binary {dest_name} to RPM"))?; .with_context(|| format!("Failed to add external binary {dest_name} to RPM"))?;
} }
@@ -374,7 +383,7 @@ impl BundleContext<'_> {
format!("/{dest}") format!("/{dest}")
}; };
builder = builder builder = builder
.with_file(&src, rpm::FileOptions::new(&dest).mode(0o644)) .with_file(&src, rpm::FileOptions::new(&dest).permissions(0o644))
.context("Failed to add custom file to RPM")?; .context("Failed to add custom file to RPM")?;
} }
} }