#update #arch-linux #packaging #offline #online #query #check

arch-updates-rs

Library to query arch linux packaging tools to see if updates are available

2 releases

0.1.1 Oct 22, 2024
0.1.0 Oct 22, 2024

#326 in Unix APIs

Download history 320/week @ 2024-10-20 14/week @ 2024-10-27

334 downloads per month

MIT and GPL-3.0 licenses

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 with pacman-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

~8–19MB
~267K SLoC