diff options
Diffstat (limited to 'auria.sh')
-rwxr-xr-x | auria.sh | 66 |
1 files changed, 48 insertions, 18 deletions
@@ -221,31 +221,31 @@ function install_full #inform "Fetching package information from AUR..." inform "Resolving dependencies..." - resolve_deps "$pkg" $itype - # TODO: Make order. + resolve_deps "$pkg" $itype || return $? + make_pkgorder || return $? - # TODO: Do this for each dep (in proper order). - { + for pkg in "${aur_pkgorder[@]}" + do pkgbase="${aur_pkgbase[$pkg]}" # Get sources and cd into $aur_root/$pkgbase. get_sources "$pkgbase" || return $? local old_pkgbuild_exists=$retstr - } - if ! test -f PKGBUILD - then - error "PKGBUILD does not exist." - return 2 - fi + if ! test -f PKGBUILD + then + error "PKGBUILD does not exist." + return 2 + fi - if ! match "$pkg" "${yes_pkgs[@]}" - then - present_files $old_pkgbuild_exists - ask y "Continue" || return 0 - fi + if ! match "$pkg" "${yes_pkgs[@]}" + then + present_files $old_pkgbuild_exists + ask y "Continue" || return 0 + fi - makepkg "${makepkg_options[@]}" -i || return 2 + makepkg "${makepkg_options[@]}" -si || return 2 + done } # $1 package: name @@ -269,7 +269,7 @@ function install_single inform "Fetching package information from AUR..." #inform "Resolving dependencies..." subinform " ${pkg}" - rpc info "${tmp}/json" loud "$*" || return $? + rpc info "${tmp}/json" loud "$*" || return $? get_pkgbase "$pkg" "$pkg" "${tmp}/json" explicit || return $? test -z "$retstr" && return 0; local -i i=$retstr @@ -278,7 +278,6 @@ function install_single get_sources "$pkgbase" || return $? local old_pkgbuild_exists=$retstr - if ! test -f PKGBUILD then error "PKGBUILD does not exist." @@ -502,6 +501,37 @@ function resolve_deps fi } +# Requires prepare_sources() to be run and its results unaltered. +function make_pkgorder +{ + local pkg + + ## Go up the reverse tree from bottom to top. + + local -i i=0 + while [ $i -lt ${#aur_pkgorder} ] + do + pkg="${aur_pkgorder[$i]}" + + # Remove the resolved package off the dependency tree. + # Note, that the reverse dependencies do not require removal. + for revdep in "${aur_revdeps["$pkg"]}" + do + aur_deps["$revdep"]="${aur_deps["$revdep"]/ $pkg /}" + if test -z "${aur_deps["$revdep"]}" + then + aur_pkgorder+=("$revdep") + fi + done + done + + if test -n "${aur_deps["$pkg"]}" + then + error "Circular dependency found." + return 2 + fi +} + function install_deptree { local pkg |