Compare commits

..

8 Commits

Author SHA1 Message Date
arabianq 1008c37163 change version to 1.0.1 2026-06-10 15:15:11 +03:00
arabianq 6feb4c02c1 deps: cargo update 2026-06-10 15:14:49 +03:00
arabianq f5b85085fb deps: update rpm to 0.25.1 2026-06-10 15:13:07 +03:00
arabianq c5b04a8970 fixed cargo clippy warnings 2026-06-10 15:12:19 +03:00
arabianq 8e5195d233 cargo clippy --fix 2026-06-10 15:10:23 +03:00
arabianq cedeb89d2f cargo fix 2026-06-10 15:09:45 +03:00
arabianq 49b879d874 replace deprecated .show method with .show_inside 2026-06-10 15:09:12 +03:00
arabianq 6f043f8222 deps: update egui and eframe to 0.34.3 2026-06-10 15:08:34 +03:00
4 changed files with 745 additions and 576 deletions
Generated
+692 -518
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -1,6 +1,6 @@
[package]
name = "egui_rpm_installer"
version = "1.0.0"
version = "1.0.1"
edition = "2024"
authors = ["arabianq"]
description = "Simple graphical utility that installs/upgrades/removes .rpm files built with Rust and EGUI."
@@ -15,16 +15,16 @@ name = "rpmi"
path = "src/main.rs"
[dependencies]
egui = { version = "0.33.3", default-features = false, features = [
egui = { version = "0.34.3", default-features = false, features = [
"default_fonts",
] }
eframe = { version = "0.33.3", default-features = false, features = [
eframe = { version = "0.34.3", default-features = false, features = [
"default_fonts",
"glow",
"wayland",
"x11",
] }
rpm = { version = "0.18.4", default-features = false, features = [] }
rpm = { version = "0.25.1", default-features = false, features = [] }
[profile.release]
strip = true
+36 -42
View File
@@ -43,47 +43,45 @@ pub fn get_package_state(pkg: &rpm::Package) -> PackageState {
let child_stdout = child.stdout.take().expect("Couldn't take stdout");
for line in BufReader::new(child_stdout).lines() {
if let Ok(line) = line {
let parts: Vec<&str> = line.split_whitespace().collect();
for line in BufReader::new(child_stdout).lines().map_while(Result::ok) {
let parts: Vec<&str> = line.split_whitespace().collect();
if parts.len() != 3 {
continue;
}
let name_splitted: Vec<&str> = parts[0].split(".").collect();
let (name, arch) = (name_splitted[0], name_splitted[1]);
let version_prepared = parts[1]
.split_once(':')
.map(|(_epoch, version)| version)
.unwrap_or(parts[1]);
let version_splitted: Vec<&str> = version_prepared.split("-").collect();
let (version, release) = (version_splitted[0], version_splitted[1]);
if pkg_name.eq(name) && pkg_arch.eq(arch) {
child.kill().unwrap();
child.wait().unwrap();
let package_entry = PackageEntry {
name: name.to_string(),
arch: arch.to_string(),
version: version.to_string(),
release: release.to_string(),
};
if pkg_version.eq(version) && pkg_release.eq(release) {
return PackageState::OldVersion;
}
return PackageState::NewVersion(package_entry);
if parts.len() != 3 {
continue;
}
let name_splitted: Vec<&str> = parts[0].split(".").collect();
let (name, arch) = (name_splitted[0], name_splitted[1]);
let version_prepared = parts[1]
.split_once(':')
.map(|(_epoch, version)| version)
.unwrap_or(parts[1]);
let version_splitted: Vec<&str> = version_prepared.split("-").collect();
let (version, release) = (version_splitted[0], version_splitted[1]);
if pkg_name.eq(name) && pkg_arch.eq(arch) {
child.kill().unwrap();
child.wait().unwrap();
let package_entry = PackageEntry {
name: name.to_string(),
arch: arch.to_string(),
version: version.to_string(),
release: release.to_string(),
};
if pkg_version.eq(version) && pkg_release.eq(release) {
return PackageState::OldVersion;
}
return PackageState::NewVersion(package_entry);
}
}
child.kill().ok();
child.wait().ok();
return PackageState::NewPackage;
PackageState::NewPackage
}
pub fn dnf_start_action(
@@ -117,19 +115,15 @@ pub fn dnf_start_action(
let stdout_thread = thread::spawn(move || {
let stdout_lines = BufReader::new(child_stdout).lines();
for line in stdout_lines {
if let Ok(line) = line {
stdout_tx.send(line).ok();
}
for line in stdout_lines.map_while(Result::ok) {
stdout_tx.send(line).ok();
}
});
let stderr_thread = thread::spawn(move || {
let stderr_lines = BufReader::new(child_stderr).lines();
for line in stderr_lines {
if let Ok(line) = line {
stderr_tx.send(line).ok();
}
for line in stderr_lines.map_while(Result::ok) {
stderr_tx.send(line).ok();
}
});
@@ -148,5 +142,5 @@ pub fn dnf_start_action(
child.wait().ok();
});
return (action_thread, rx);
(action_thread, rx)
}
+13 -12
View File
@@ -4,7 +4,7 @@ use crate::utils::*;
use eframe::{App, CreationContext, Frame, HardwareAcceleration, NativeOptions, run_native};
use egui::{
Align, Button, CentralPanel, Color32, Context, Direction, FontFamily, Label, Layout, RichText,
Align, Button, CentralPanel, Color32, Direction, FontFamily, Label, Layout, RichText,
ScrollArea, TextWrapMode, Ui, Vec2, ViewportBuilder,
text::{LayoutJob, TextFormat, TextWrapping},
};
@@ -57,12 +57,11 @@ impl Application {
fn get_package_state(&mut self) -> JoinHandle<()> {
let pkg_state_shared = self.pkg_state_shared.clone();
let pkg = self.pkg.clone();
let thread = thread::spawn(move || {
thread::spawn(move || {
let pkg_state = get_package_state(&pkg);
let mut guard = pkg_state_shared.lock().unwrap();
*guard = Some(pkg_state);
});
return thread;
})
}
fn start_process(&mut self) {
@@ -105,7 +104,7 @@ impl Application {
} else {
let mut value_layout_job = LayoutJob {
wrap: TextWrapping {
max_rows: max_rows,
max_rows,
..Default::default()
},
..Default::default()
@@ -165,7 +164,7 @@ impl Application {
add_info_entry(
ui,
"Architecture",
&self.pkg.metadata.get_arch().unwrap_or("-"),
self.pkg.metadata.get_arch().unwrap_or("-"),
1,
false,
);
@@ -179,28 +178,28 @@ impl Application {
add_info_entry(
ui,
"Summary ",
&self.pkg.metadata.get_summary().unwrap_or("-"),
self.pkg.metadata.get_summary().unwrap_or("-"),
3,
false,
);
add_info_entry(
ui,
"URL ",
&self.pkg.metadata.get_url().unwrap_or("-"),
self.pkg.metadata.get_url().unwrap_or("-"),
1,
true,
);
add_info_entry(
ui,
"License ",
&self.pkg.metadata.get_license().unwrap_or("-"),
self.pkg.metadata.get_license().unwrap_or("-"),
2,
false,
);
add_info_entry(
ui,
"Description ",
&self.pkg.metadata.get_description().unwrap_or("-"),
self.pkg.metadata.get_description().unwrap_or("-"),
5,
false,
);
@@ -283,7 +282,7 @@ impl Application {
}
impl App for Application {
fn update(&mut self, ctx: &Context, _: &mut Frame) {
fn logic(&mut self, _ctx: &egui::Context, _frame: &mut Frame) {
if let Some(process_thread) = &self.process_thread
&& let Some(process_rx) = &self.process_rx
{
@@ -300,8 +299,10 @@ impl App for Application {
self.process_log.push('\n');
}
}
}
CentralPanel::default().show(ctx, |ui| {
fn ui(&mut self, ui: &mut egui::Ui, _frame: &mut Frame) {
CentralPanel::default().show_inside(ui, |ui| {
if self.pkg_state.is_none() {
if self.pkg_state_loading_thread.is_none() {
self.pkg_state_loading_thread = Some(self.get_package_state());