aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEinhard Leichtfuß <alguien@respiranto.de>2018-03-28 23:58:17 +0200
committerEinhard Leichtfuß <alguien@respiranto.de>2018-03-28 23:58:17 +0200
commit51fe2a44f30e2d676212a1c5691ba1aa6779f885 (patch)
treeb45094ebe2556762739f2d585e93aff5c0f694fd
parentf41d24b77a5299cefa773b84a794932b9b25c36b (diff)
Search locally for deps also
-rwxr-xr-xauria.sh25
1 files changed, 20 insertions, 5 deletions
diff --git a/auria.sh b/auria.sh
index dd92402..30b3016 100755
--- a/auria.sh
+++ b/auria.sh
@@ -45,8 +45,10 @@
# TODO: differentiate errors and failures in return codes (mostly done).
# TODO: conflicts.
# TODO: find packages only providing a dep (e.g. commonist->java-environment)
+# `- apparently impossible via AUR RPC.
# TODO: (print_localver) case pkg is only provided.
-# TODO: print_repover may print several results (e.g. java-environment).
+# TODO: print_repover may print several results (e.g. parabola/linux-libre).
+# `- print_localver probably has the same issue.
# TODO: use inform/note/subinform properly.
# TODO: remove package from repo_deps, if it later gets added to the aur
# lists
@@ -469,9 +471,19 @@ function resolve_deps
rst_kind="${rst[1]}"
rst_ver="${rst[2]}"
- # Search locally and in the repos first (for deps).
+ # Search locally and in the repos first (for deps and upon update).
# This does also populate the $repo_deps array.
- [[ "$itype" == dep ]] && depsearch_noaur "$pkg" "$pkgstr" && return 0
+ if [[ "$itype" == dep ]]
+ then
+ depsearch_noaur "$pkg" "$pkgstr" && return 0
+ elif [[ "$itype" == update ]]
+ then
+ if depsearch_noaur "$pkg" "$pkgstr"
+ then
+ inform "$pkgstr exists in the regular repositories."
+ ask n "Try to update from AUR anyways" || return 0
+ fi
+ fi
# Search the AUR.
if [[ -n "${aur_itype["$pkg"]}" ]]
@@ -616,8 +628,10 @@ function depsearch_noaur
# In case of no dep restriction, look up in list first.
[[ "$pkg" == "$pkgstr" ]] && match "$pkg" "${repo_deps[@]}" && return 0
+ # Search locally.
qpacman -T "$pkgstr" && return 0
+ # Search in the repos.
qpacman -Sp "$pkgstr" \
&& { match "$pkg" "${repo_deps[@]}" || repo_deps+=("$pkg"); } \
&& return 0
@@ -661,14 +675,14 @@ function print_restriction
# prints local version: version string
function print_localver
{
- pacman -R --print-format "%v" "$1"
+ pacman -Rdd --print-format "%v" "$1"
}
# $1 package: name
# prints repository version: version string
function print_repover
{
- pacman -S --print-format "%v" "$1"
+ pacman -Sdd --print-format "%v" "$1"
}
# $1 package: name
@@ -687,6 +701,7 @@ function update_all
for pkg in $(pacman -Qmq)
do
+ #qpacman -T "$pkg" && continue
subinform "Resolving dependencies for ${pkg}..."
resolve_deps "$pkg" update '' || return $?
done