Ask the API for the package base

This commit is contained in:
Jack L. Frost 2015-01-27 19:52:45 +03:00
parent 9de0ce1e8d
commit e0b175f496

10
zpac
View File

@ -6,6 +6,7 @@
_self="${0##*/}"
cfg_workdir="/tmp/$USER/zpac"
cfg_aur_api='https://aur.archlinux.org/rpc.php'
echo() { printf '%s\n' "$*"; }
err() { echo "$*" >&2; }
@ -21,8 +22,9 @@ usage() {
}
aur.get() {
local aur_url pkg_group tarball_url=$(package-query -1 -AS -f %u "$1")
IFS='/' read _ _ aur_url _ _ pkg_group _ <<< "$tarball_url"
local aur_url
local tarball_url=$(package-query -1 -AS -f %u "$1")
local pkg_base=$( curl "${cfg_aur_api}?type=info&arg=${1}" | jshon -e results -e PackageBase )
cd "$cfg_workdir"
@ -32,10 +34,10 @@ aur.get() {
return 1
}
echo ": ${cfg_workdir}/${pkg_group}"
echo ": ${cfg_workdir}/${pkg_base}"
if (( flag_get_deps )); then
cd "${cfg_workdir}/${pkg_group}"
cd "${cfg_workdir}/${pkg_base}"
source PKGBUILD
for i in "${depends[@]}" "${makedepends[@]}"; do