#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

#320 in Unix APIs

Download history 307/week @ 2024-10-19 26/week @ 2024-10-26 27/week @ 2024-11-02 2/week @ 2024-11-09 3/week @ 2024-11-16

73 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

~7–20MB
~257K SLoC