|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
use crate::builder::pacman::PacmanQueryBuilder;
|
|
|
|
|
use crate::internal::commands::ShellCommand;
|
|
|
|
|
use crate::internal::error::SilentUnwrap;
|
|
|
|
|
use crate::internal::exit_code::AppExitCode;
|
|
|
|
@ -42,40 +43,31 @@ pub async fn upgrade(options: Options) {
|
|
|
|
|
log!("Upgrading AUR packages");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let pacman_output = ShellCommand::pacman()
|
|
|
|
|
.arg("-Qm")
|
|
|
|
|
.args(&["--color", "never"])
|
|
|
|
|
.wait_with_output()
|
|
|
|
|
let non_native_pkgs = PacmanQueryBuilder::default()
|
|
|
|
|
.foreign(true)
|
|
|
|
|
.query()
|
|
|
|
|
.await
|
|
|
|
|
.silent_unwrap(AppExitCode::PacmanError);
|
|
|
|
|
let non_native_pkgs = pacman_output
|
|
|
|
|
.stdout
|
|
|
|
|
.split('\n')
|
|
|
|
|
.filter(|p| !p.is_empty())
|
|
|
|
|
.filter_map(|p| p.split_once(' '))
|
|
|
|
|
.collect::<Vec<(&str, &str)>>();
|
|
|
|
|
|
|
|
|
|
if verbosity >= 1 {
|
|
|
|
|
log!("{:?}", non_native_pkgs);
|
|
|
|
|
}
|
|
|
|
|
tracing::debug!("aur packages: {non_native_pkgs:?}");
|
|
|
|
|
let mut aur_upgrades = vec![];
|
|
|
|
|
|
|
|
|
|
for (pkg_name, pkg_version) in non_native_pkgs {
|
|
|
|
|
if verbosity >= 1 {
|
|
|
|
|
log!(
|
|
|
|
|
"remote package: name = {}, version = {}",
|
|
|
|
|
pkg_name,
|
|
|
|
|
pkg_version
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
let remote_package = rpcinfo(pkg_name).await.silent_unwrap(AppExitCode::RpcError);
|
|
|
|
|
for pkg in non_native_pkgs {
|
|
|
|
|
let remote_package = rpcinfo(&pkg.name)
|
|
|
|
|
.await
|
|
|
|
|
.silent_unwrap(AppExitCode::RpcError);
|
|
|
|
|
|
|
|
|
|
if let Some(remote_package) = remote_package {
|
|
|
|
|
if remote_package.metadata.version != pkg_version {
|
|
|
|
|
aur_upgrades.push(pkg_name.to_string());
|
|
|
|
|
if remote_package.metadata.version != pkg.version {
|
|
|
|
|
tracing::debug!(
|
|
|
|
|
"local version: {}, remote version: {}",
|
|
|
|
|
pkg.version,
|
|
|
|
|
remote_package.metadata.version
|
|
|
|
|
);
|
|
|
|
|
aur_upgrades.push(pkg.name);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
warn!("Could not find the remote package for {}", pkg_name);
|
|
|
|
|
warn!("Could not find the remote package for {}", pkg.name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|