diff options
author | davidovski <david@davidovski.xyz> | 2022-06-06 18:39:20 +0100 |
---|---|---|
committer | davidovski <david@davidovski.xyz> | 2022-06-06 18:39:20 +0100 |
commit | dd8004ccbf58b546f48205d2878d9101bbfcaadc (patch) | |
tree | 7864c5224a4728a37f858f3703e05286bb6a2687 /src/get.sh | |
parent | a8c14970881292501f40c3cf1f5c36b71525fee0 (diff) |
fixed sort to be faster
Diffstat (limited to 'src/get.sh')
-rwxr-xr-x | src/get.sh | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -8,7 +8,7 @@ list_deps() { [ -f $tree_file ] && for dep in $(cat "$tree_file"); do echo $dep - done | sort -u + done } # list all dependencies and sub dependencies of a package @@ -30,18 +30,21 @@ resolve_deps () { local package=$1 #only add if not already added - if ! echo ${deps} | grep -q "\b$package\b"; then + case " $deps " in + *" $package "*);; + *) deps="$deps $package" i=$((i+1)) - fi + ;; + esac for dep in $(list_deps $package); do # if not already checked - if echo $@ | grep -qv "\b$dep\b"; then - set -- $@ $dep - fi + case " $@ $deps " in + *" $dep "*) ;; + *) set -- $@ $dep;; + esac done - shift ${QUIET} || hbar -T "${CHECKMARK} resolving dependencies" $i $((i + $#)) |