#!/bin/bash # # Outputs dependencies for MacPorts recursivly, each port and its dependencies # in a separate line. # # Usage: ./deepdeps.sh # # (c) Thomas Keller # # Licensed under GPLv3 # if [ -z "$1" ]; then echo "No argument given" exit 1 fi declare -a processed_deps function getDeps { processed_deps[${#processed_deps[*]}]=$i deps=`port deps $1 | egrep -v "^$1" | cut -f 2 | sort | uniq` if [[ -z "$deps" ]]; then echo "$(tput setaf 1)$1:$(tput setaf 9) none" return fi echo "$(tput setaf 1)$1:$(tput setaf 9) ${deps// / }" for i in $deps do j=0 while [ "$j" -lt "${#processed_deps[*]}" ] do if [ "$i" = "${processed_deps[$j]}" ]; then return fi let "j = $j + 1" done getDeps $i; done } getDeps $1