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