Don't query AUR for each package dammit
This commit is contained in:
parent
351a03c515
commit
0b62cf2bc4
33
prm
33
prm
|
@ -66,25 +66,26 @@ aur.info() {
|
||||||
|
|
||||||
aur.get_updates() {
|
aur.get_updates() {
|
||||||
declare -a foreign_packages
|
declare -a foreign_packages
|
||||||
declare p_aur_info p_localver p_aur_version
|
declare p_aur_info p_localver p_aur_version aur_api_multireq aur_api_data
|
||||||
|
|
||||||
read -d '' -r -a foreign_packages < <( pacman -Qqm )
|
read -d '' -r -a foreign_packages < <( pacman -Qqm )
|
||||||
|
|
||||||
for p in "${foreign_packages[@]}"; do
|
for p in "${foreign_packages[@]}"; do
|
||||||
unset p_aur_info
|
aur_api_multireq+="&arg\[\]=$p"
|
||||||
read -r p_aur_info < <( aur.info "$p" )
|
done
|
||||||
|
|
||||||
if [[ "$p_aur_info" ]]; then
|
aur_api_data=$( curl "${cfg_curl_opts[@]}" "${cfg_aur_api}?type=multiinfo${aur_api_multireq}" )
|
||||||
read -r p_aur_version < <(
|
|
||||||
jshon -e results -e Version -u <<< "$p_aur_info"
|
|
||||||
)
|
|
||||||
|
|
||||||
read -r _ p_localver < <( pacman -Q "$p" )
|
aur_api_data_length=$( jshon -e results -l <<< "$aur_api_data" )
|
||||||
|
(( aur_api_data_length-- ))
|
||||||
|
|
||||||
|
for (( n=0; n<=aur_api_data_length; n++ )); do
|
||||||
|
read -r n_name < <( jshon -e results -e "$n" -e Name -u <<< "$aur_api_data")
|
||||||
|
read -r n_version < <( jshon -e results -e "$n" -e Version -u <<< "$aur_api_data" )
|
||||||
|
read -r l_name l_version < <( pacman -Q "$n_name" )
|
||||||
|
|
||||||
if (( $(vercmp "$p_aur_version" "$p_localver") )); then
|
if (( $(vercmp "$n_version" "$l_version") )); then
|
||||||
printf '%s\n' "$p"
|
printf '%s\n' "$n_name"
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -275,6 +276,11 @@ main() {
|
||||||
|
|
||||||
case "$action" in
|
case "$action" in
|
||||||
(get)
|
(get)
|
||||||
|
[[ "$package" ]] || {
|
||||||
|
usage
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
[[ -d "$cfg_workdir" ]] || {
|
[[ -d "$cfg_workdir" ]] || {
|
||||||
mkdir -p "$cfg_workdir" || {
|
mkdir -p "$cfg_workdir" || {
|
||||||
err "Can't create workdir: %s\n" "$cfg_workdir"
|
err "Can't create workdir: %s\n" "$cfg_workdir"
|
||||||
|
@ -315,6 +321,11 @@ main() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(search)
|
(search)
|
||||||
|
[[ "$package" ]] || {
|
||||||
|
usage
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
if (( flag_search_aur )); then
|
if (( flag_search_aur )); then
|
||||||
aur.search "$package" || {
|
aur.search "$package" || {
|
||||||
err "No packages found\n"
|
err "No packages found\n"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user