summaryrefslogtreecommitdiff
path: root/src/get.sh
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-06-06 18:39:20 +0100
committerdavidovski <david@davidovski.xyz>2022-06-06 18:39:20 +0100
commitdd8004ccbf58b546f48205d2878d9101bbfcaadc (patch)
tree7864c5224a4728a37f858f3703e05286bb6a2687 /src/get.sh
parenta8c14970881292501f40c3cf1f5c36b71525fee0 (diff)
fixed sort to be faster
Diffstat (limited to 'src/get.sh')
-rwxr-xr-xsrc/get.sh17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/get.sh b/src/get.sh
index 4296569..4a15bd7 100755
--- a/src/get.sh
+++ b/src/get.sh
@@ -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 + $#))