Getting rid of package-query
This commit is contained in:
parent
1fdde28724
commit
40f797ac20
44
zpac
44
zpac
|
@ -23,8 +23,25 @@ usage() {
|
|||
EOF
|
||||
}
|
||||
|
||||
aur.search() {
|
||||
local aur_api_search_data aur_search_result_num pkg
|
||||
|
||||
aur_api_search_data=$( curl -skL "${cfg_aur_api}?type=search&arg=${1}" )
|
||||
aur_search_result_num=$( jshon -e resultcount -u <<< "$aur_api_search_data" )
|
||||
|
||||
if (( aur_search_result_num )); then
|
||||
aur_search_results=( $( jshon -e results -a -e Name -u <<< "$aur_api_search_data" ) )
|
||||
|
||||
for i in "${!aur_search_results[@]}"; do
|
||||
printf 'aur/%s\n %s\n' "${aur_search_results[${i}]}" "$( jshon -e results -e $i -e Description -u <<< "$aur_api_search_data" )"
|
||||
done
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
aur.info() {
|
||||
local pkg_aur_info=$( curl "${cfg_aur_api}?type=info&arg=${1}" 2>/dev/null )
|
||||
local pkg_aur_info=$( curl -skL "${cfg_aur_api}?type=info&arg=${1}" 2>/dev/null )
|
||||
local aur_query_result=$( jshon -e resultcount -u <<< "$pkg_aur_info" )
|
||||
|
||||
if (( aur_query_result )); then
|
||||
|
@ -63,7 +80,7 @@ aur.get() {
|
|||
aur_api_multireq+="&arg\[\]=$dep_name"
|
||||
done
|
||||
|
||||
aur_deps_api_data=$( curl "${cfg_aur_api}?type=multiinfo${aur_api_multireq}" )
|
||||
aur_deps_api_data=$( curl -skL "${cfg_aur_api}?type=multiinfo${aur_api_multireq}" )
|
||||
aur_deps_count=$( jshon -e resultcount <<< "$aur_deps_api_data" )
|
||||
|
||||
if (( aur_deps_count )); then
|
||||
|
@ -137,8 +154,13 @@ main() {
|
|||
if (( ! "$?" )); then
|
||||
repo='aur'
|
||||
else
|
||||
repo=$( package-query -S -f '%r' "$package" )
|
||||
(( "$?" )) || {
|
||||
while read; do
|
||||
if [[ "$REPLY" =~ ^Repository ]]; then
|
||||
repo="${REPLY##* }"
|
||||
fi
|
||||
done < <( pacman -Si "$package" )
|
||||
|
||||
[[ "$repo" ]] || {
|
||||
err "Can't find package ${package}"
|
||||
return 1
|
||||
}
|
||||
|
@ -151,7 +173,7 @@ main() {
|
|||
aur.get <<< "$pkg_aur_info";;
|
||||
|
||||
(core|extra|community|multilib)
|
||||
abs.get "${package}" "";;
|
||||
abs.get "${package}";;
|
||||
|
||||
(*)
|
||||
err "Repository $repo not supported."
|
||||
|
@ -160,7 +182,17 @@ main() {
|
|||
;;
|
||||
|
||||
(search)
|
||||
package-query -ASs "$package"
|
||||
if type -P package-query &>/dev/null; then
|
||||
package-query -ASs "$package"
|
||||
else
|
||||
aur.search "$package" || { flag_aur_search_fail=1; }
|
||||
pacman -Ss "$package" 2>/dev/null || { flag_pacman_search_fail=1; }
|
||||
|
||||
if (( flag_aur_search_fail && flag_pacman_search_fail )); then
|
||||
err "No packages found."
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user