Expand description
§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, pacman_cache)), 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(&pacman_cache),
check_aur_updates_offline(&aur_cache),
check_devel_updates_offline(&devel_cache),
) else {
panic!();
};
assert!(pacman.is_empty() && aur.is_empty() && devel.is_empty());
}
Structs§
- AurUpdate
- Current status of an installed AUR package, vs the status of the latest version.
- AurUpdates
Cache - Cached state for offline updates check
- Devel
Update - Current status of an installed devel package, vs latest commit hash on the source repo.
- Devel
Updates Cache - Cached state for offline updates check
- Pacman
Update - Current status of an installed pacman package, vs the status of the latest version.
- Pacman
Updates Cache - Cached state for offline updates check
Enums§
- Error
- Source
Repo - Source of a package. https://wiki.archlinux.org/title/Official_repositories
Constants§
- DEVEL_
SUFFIXES - Packages ending with one of the devel suffixes will be checked against the repository, as well as just the pkgver and pkgrel.
Functions§
- check_
aur_ updates_ offline - Check if any AUR packages have updates to their pkgver-pkgrel.
- check_
aur_ updates_ online - Check if any AUR packages have updates to their pkgver-pkgrel.
- check_
devel_ updates_ offline - Check if any packages ending in
DEVEL_SUFFIXES
have updates to their source repositories. - check_
devel_ updates_ online - Check if any packages ending in
DEVEL_SUFFIXES
have updates to their source repositories. - check_
pacman_ updates_ offline - Use the
checkupdates
function to check if any pacman-managed packages have updates due. - check_
pacman_ updates_ online - Use the
checkupdates
function to check if any pacman-managed packages have updates due.