From e0b175f496c4826b27c33963dff64295245ff06b Mon Sep 17 00:00:00 2001 From: fbt Date: Tue, 27 Jan 2015 19:52:45 +0300 Subject: [PATCH] Ask the API for the package base --- zpac | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/zpac b/zpac index 5cd5cc9..9da797b 100755 --- a/zpac +++ b/zpac @@ -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