2 releases
0.1.1 | Oct 22, 2024 |
---|---|
0.1.0 | Oct 22, 2024 |
#327 in Unix APIs
356 downloads per month
28KB
481 lines
arch_updates_rs
Library to query arch linux packaging tools to see if updates are available. Designed for cosmic-applet-arch, but could be used in similar apps as well. Please refer to docs.rs with api documentation and usage examples.
Dependencies
The following tools or dependencies are required:
checkupdates
(included withpacman-contrib
- openssl (included with
coreutils
)
lib.rs
:
arch_updates_rs
Library to query arch linux packaging tools to see if updates are available. Designed for cosmic-applet-arch, but could be used in similar apps as well.
Usage example
This example shows how to check for updates online and print them to the terminal. It also shows how to check for updates offline, using the cache returned from the online check. If a system update is run in between as per the example, the offline check should return 0 updates due.
use arch_updates_rs::*;
#[tokio::main]
pub async fn main() {
let (Ok(pacman), Ok((aur, aur_cache)), Ok((devel, devel_cache))) = tokio::join!(
check_pacman_updates_online(),
check_aur_updates_online(),
check_devel_updates_online(),
) else {
panic!();
};
println!("pacman: {:#?}", pacman);
println!("aur: {:#?}", aur);
println!("devel: {:#?}", devel);
std::process::Command::new("paru")
.arg("-Syu")
.spawn()
.unwrap()
.wait()
.unwrap();
let (Ok(pacman), Ok(aur), Ok(devel)) = tokio::join!(
check_pacman_updates_offline(),
check_aur_updates_offline(&aur_cache),
check_devel_updates_offline(&devel_cache),
) else {
panic!();
};
assert!(pacman.is_empty() && aur.is_empty() && devel.is_empty());
}
Dependencies
~7–19MB
~259K SLoC