aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEinhard Leichtfuß <alguien@respiranto.de>2017-10-22 15:22:09 +0200
committerEinhard Leichtfuß <alguien@respiranto.de>2017-10-22 15:23:03 +0200
commitb386641da32a66f8452569337ad0abdb190452a5 (patch)
tree180c75633b2bd7008924798170bf10ca688ec3f9
parent28bb25ca68f929fa69a6bde00d865f7272a3f874 (diff)
Improve get_pkgbase's error messages
Also, remove a few quotes around $itype.
-rwxr-xr-xauria.sh27
1 files changed, 18 insertions, 9 deletions
diff --git a/auria.sh b/auria.sh
index 8a42e9c..dac230b 100755
--- a/auria.sh
+++ b/auria.sh
@@ -218,7 +218,7 @@ function install_full
#inform "Fetching package information from AUR..."
inform "Resolving dependencies..."
- resolve_deps "$pkg" "$itype"
+ resolve_deps "$pkg" $itype
# TODO: Make order.
# TODO: Do this for each dep (in proper order).
@@ -268,7 +268,7 @@ function install_single
subinform " ${pkg}"
rpc info "${tmp}/json" loud "$*" || return $?
- get_pkgbase "$pkg" "${tmp}/json" || return $?
+ get_pkgbase "$pkg" "$pkg" "${tmp}/json" explicit || return $?
test -z "$retstr" && return 0; local -i i=$retstr
pkgbase="$(jq -er ".results[$i].PackageBase" "${tmp}/json" || return 4)"
@@ -292,20 +292,29 @@ function install_single
}
# $1 package: name
-# $2 json file: filename
+# $2 package: name [. pkgver-comparator . version string]
+# $3 json file: filename
+# $4 installation type: (dep|explicit|update)
# $retstr result: numeric id {on success}
-# interactive.
+# interactive {if several pkgbases match}.
function get_pkgbase
{
retstr=''
local pkg="$1"
- local json="$2"
+ local pkgstr="$2"
+ local json="$3"
+ local itype=$4
local -i rcount="$(jq -er '.resultcount' "$json" || return 4)"
local -i i
if [[ $rcount -eq 0 ]]
then
- error "[RPC] No result for ${pkg} found."
+ if [[ "$itype" == dep ]]
+ then
+ error "Dependency ${pkgstr} could not be resolved."
+ else
+ error "[RPC] No result for ${pkg} found."
+ fi
return 2
elif [[ $rcount -gt 1 ]]
then
@@ -416,7 +425,7 @@ function resolve_deps
local itype pkgstr pkg pkgbase pkgver rst rst_kind rst_ver existed new
pkgstr="$1"
- itype="$2"
+ itype=$2
# Check for version restriction.
rst=( $(print_restriction "$pkgstr") )
@@ -446,7 +455,7 @@ function resolve_deps
fi
fi
- get_pkgbase "$pkg" "${tmp}/json" || return $?
+ get_pkgbase "$pkg" "$pkgstr" "${tmp}/json" $itype || return $?
test -z "$retstr" && return 1; local -i i=$retstr
pkgbase="$(jq -er ".results[$i].PackageBase" "${tmp}/json" || return 4)"
aur_pkgbase["$pkg"]="$pkgbase"
@@ -475,7 +484,7 @@ function resolve_deps
local dep
for dep in "${deps[@]}" "${makedeps[@]}"
do
- echo $dep
+ #echo $dep
aur_revdeps["$dep"]="$pkg"
resolve_deps "$dep" dep
done