support AUR 4

This commit is contained in:
Jack L. Frost 2015-06-10 14:15:52 +03:00
parent 840ab9254c
commit dd0d7f7902

29
prm
View File

@ -6,8 +6,9 @@
_self="${0##*/}" _self="${0##*/}"
cfg_workdir="$PWD" cfg_workdir="$PWD"
cfg_aur_url='https://aur.archlinux.org'
cfg_aur_api="${cfg_aur_url}/rpc.php" # Version 3 by default. For now
cfg_aur_version='3'
err() { printf "$@" >&2; } err() { printf "$@" >&2; }
@ -66,12 +67,18 @@ aur.get() {
read -r pkg_aur_info read -r pkg_aur_info
# A temporary hack till AUR4 becomes the main version
if (( cfg_aur_version == 4 )); then
read -r pkg_base < <( jshon -e results -e PackageBase -u <<< "$pkg_aur_info" )
tarball_path="/cgit/aur.git/snapshot/${pkg_base}.tar.gz"
else
{ {
read -r pkg_base read -r pkg_base
read -r tarball_path read -r tarball_path
} < <( } < <(
jshon -e results -e PackageBase -u -p -e URLPath -u <<< "$pkg_aur_info" jshon -e results -e PackageBase -u -p -e URLPath -u <<< "$pkg_aur_info"
) )
fi
(( flag_force )) || { (( flag_force )) || {
[[ -d "${cfg_workdir}/${pkg_base}" ]] && { [[ -d "${cfg_workdir}/${pkg_base}" ]] && {
@ -188,6 +195,14 @@ main() {
action='search' action='search'
flag_search_syncdb=1;; flag_search_syncdb=1;;
(-V)
cfg_aur_version="$2"
shift;;
(-u)
cfg_aur_url="$2"
shift;;
(-d) (-d)
if [[ "$action" == 'get' ]]; then if [[ "$action" == 'get' ]]; then
flag_get_deps=1 flag_get_deps=1
@ -217,6 +232,16 @@ main() {
unset flag_search_aur flag_search_syncdb unset flag_search_aur flag_search_syncdb
} }
if [[ -z "$cfg_aur_url" ]]; then
if (( cfg_aur_version == 3 )); then
cfg_aur_url="https://aur.archlinux.org"
else
cfg_aur_url="https://aur4.archlinux.org"
fi
fi
cfg_aur_api="${cfg_aur_url}/rpc.php"
[[ "$action" ]] || { [[ "$action" ]] || {
usage usage
return 1 return 1