Crate arch_updates_rs

Crate arch_updates_rs 

Source
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.
AurUpdatesCache
Cached state for offline updates check
DevelUpdate
Current status of an installed devel package, vs latest commit hash on the source repo.
DevelUpdatesCache
Cached state for offline updates check
PacmanUpdate
Current status of an installed pacman package, vs the status of the latest version.
PacmanUpdatesCache
Cached state for offline updates check

Enums§

Error
SourceRepo
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.

Type Aliases§

Result