aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEinhard Leichtfuß <alguien@respiranto.de>2017-10-31 21:12:43 +0100
committerEinhard Leichtfuß <alguien@respiranto.de>2017-10-31 21:17:16 +0100
commit45ac92c03729f9e9806027be27513dca4b1d6e7f (patch)
tree0387a475f25b0ad99e96f69952cd16fd5fc79b14
parent7359d2ecdd0e7a8586342a5715fa676f1cdc6430 (diff)
Fix resolve_deps() and make_pkgorder()
- Change resolve_deps such that the `parent' package is known. - Use that to exclusively add AUR-dependencies.
-rwxr-xr-xauria.sh40
1 files changed, 26 insertions, 14 deletions
diff --git a/auria.sh b/auria.sh
index 60e9eb0..094ed5b 100755
--- a/auria.sh
+++ b/auria.sh
@@ -219,7 +219,7 @@ function install_full
#inform "Fetching package information from AUR..."
inform "Resolving dependencies..."
- resolve_deps "$pkg" $itype || return $?
+ resolve_deps "$pkg" $itype '' || return $?
make_pkgorder || return $?
for pkg in "${aur_pkgorder[@]}"
@@ -420,13 +420,16 @@ function present_files
# non-explicit ones.
# $1 package: name [. pkgver-comparator . version string]
# $2 installation type: (dep|explicit|update)
+# $3 direct reverse dependency (caller): (name|)
# interactive (<- get_pkgbase).
function resolve_deps
{
- local itype pkgstr pkg pkgbase pkgver rst rst_kind rst_ver existed new
+ local itype pkgstr pkg pkgbase pkgver rst rst_kind rst_ver existed new \
+ abovepkg
pkgstr="$1"
itype=$2
+ abovepkg="$3"
# Check for version restriction.
rst=( $(print_restriction "$pkgstr") )
@@ -454,6 +457,7 @@ function resolve_deps
else
error "[RPC] ${retstr}"
fi
+ return 2
fi
get_pkgbase "$pkg" "$pkgstr" "${tmp}/json" $itype || return $?
@@ -472,6 +476,13 @@ function resolve_deps
return 2
fi
+ # Add edges to the tree if the dep will be taken from the AUR.
+ if test -n "$abovepkg"
+ then
+ aur_deps["$abovepkg"]+=" $pkg "
+ aur_revdeps["$pkg"]+=" $abovepkg "
+ fi
+
if $new
then
local deps makedeps
@@ -480,20 +491,17 @@ function resolve_deps
makedeps=( $(jq -r ".results[$i].MakeDepends[]?" "${tmp}/json" \
|| return 4) )
- aur_deps["$pkg"]="$(printf " %s " "${deps[@]}" "${makedeps[@]}")"
+ # Recurse.
+ local dep
+ for dep in "${deps[@]}" "${makedeps[@]}"
+ do
+ #echo $dep
+ resolve_deps "$dep" dep "$pkg" || return $?
+ done
- if (( ${#deps} + ${#makedeps} == 0 ))
+ if test -z "${aur_deps["$pkg"]}"
then
aur_pkgorder+=("$pkg")
- else
- # Recurse.
- local dep
- for dep in "${deps[@]}" "${makedeps[@]}"
- do
- #echo $dep
- aur_revdeps["$dep"]+=" $pkg "
- resolve_deps "$dep" dep
- done
fi
fi
}
@@ -503,7 +511,11 @@ function make_pkgorder
{
local pkg
- test -n "${aur_pkgorder[$i]}" && return 0
+ if test -z "${aur_pkgorder[0]}"
+ then
+ error "Circular dependency found."
+ return 2
+ fi
## Go up the reverse tree from bottom to top.