#arch-linux #aur #arch #pkgbuild

aur-fetch

用于下载和比较AUR软件包的库

21个不稳定版本

0.11.2 2022年11月21日
0.11.0 2022年7月9日
0.10.0 2021年9月21日
0.9.1 2021年1月20日
0.1.0 2019年3月22日

#872 in Unix API

Download history 6704/week @ 2024-03-14 5100/week @ 2024-03-21 4729/week @ 2024-03-28 4109/week @ 2024-04-04 3777/week @ 2024-04-11 3695/week @ 2024-04-18 3717/week @ 2024-04-25 3886/week @ 2024-05-02 3932/week @ 2024-05-09 4214/week @ 2024-05-16 4090/week @ 2024-05-23 4052/week @ 2024-05-30 3997/week @ 2024-06-06 3885/week @ 2024-06-13 4042/week @ 2024-06-20 3305/week @ 2024-06-27

15,841 每月下载量
用于 paru

GPL-3.0 许可证

30KB
666 行代码(不含注释)

aur-fetch

aur-fetch是一个用于管理从AUR下载和比较软件包的crate。这个过程被分解为多个不同的步骤,以提供最大程度的控制,并确保用户确认阅读后再合并软件包。

注意:此crate仅处理获取软件包。它假定传递给它的软件包列表是pkgbases,因此不能与拆分软件包一起工作。要处理拆分软件包,必须使用AUR RPC从pkgname获取pkgbase。

示例

打印 - 差异

use aur_fetch::Fetch;


let pkgs = vec!["discord", "spotify", "pacman-git"];

// Create our handle
let fetch = Fetch::new()?;

// Clone/Fetch the packages.
let fetched = fetch.download(&pkgs)?;

// Merge changes
fetch.merge(&fetched)?;

// Only diff packages that have not been reviewed
let to_diff = fetch.unseen(&pkgs)?;

// Print each diff
for (diff, pkg) in fetch.diff(&to_diff, true)?.iter().zip(pkgs.iter()) {
    println!("{}:", pkg);
    println!("{}", diff.trim());
}

差异视图

use aur_fetch::Fetch;
use std::process::Command;


let pkgs = vec!["discord", "spotify", "pacman-git"];

// Create our handle
let fetch = Fetch::new()?;

// Clone/Fetch the packages.
let fetched = fetch.download(&pkgs)?;

// Merge the changes.
fetch.merge(&fetched)?;

// Save diffs to cache.
fetch.save_diffs(&fetched)?;

// Make a view of the new files so we can easily see them in the file browser
let dir = fetch.make_view( "/tmp/aur_view",  &pkgs, &fetched)?;
Command::new("vifm").arg("/tmp/aur_view").spawn()?.wait()?;

使用回调

use aur_fetch::Fetch;


let pkgs = vec!["discord", "spotify", "pacman-git"];

// Create our handle
let fetch = Fetch::new()?;

// Clone/Fetch the packages.
let feteched = fetch.download(&pkgs)?;

// Download the packages, printing downloads as they complete.
let fetched = fetch.download_cb(&pkgs, |cb| {
    println!("Downloaded ({:0pad$}/{:0pad$}): {}", cb.n, pkgs.len(), cb.pkg, pad = 3);
})?;

// Merge the changes.
// In a real tool you would ask for user conformation before this
// As long as the changes are not merged this process can always be restarted and the diffs
// perserved
fetch.merge(&fetched)?;

依赖关系

~1.5MB
~51K SLoC