Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

MacPorts recursive dependency re
Tuesday, July 15th, 2008 at 11:47:36pm UTC 

  1. #!/bin/bash
  2. #
  3. # Outputs dependencies for MacPorts recursivly, each port and its dependencies
  4. # in a separate line.
  5. #
  6. # Usage: ./deepdeps.sh <portname>
  7. #
  8. # (c) Thomas Keller <[email protected]>
  9. #
  10. # Licensed under GPLv3
  11. #
  12. if [ -z "$1" ]; then
  13.    echo "No argument given"
  14.    exit 1
  15. fi
  16.  
  17. declare -a processed_deps
  18.  
  19. function getDeps {
  20.         processed_deps[${#processed_deps[*]}]=$i
  21.         deps=`port deps $1 | egrep -v "^$1" | cut -f 2 | sort | uniq`
  22.         if [[ -z "$deps" ]]; then
  23.                 echo "$(tput setaf 1)$1:$(tput setaf 9) none"
  24.                 return
  25.         fi
  26.  
  27.         echo "$(tput setaf 1)$1:$(tput setaf 9) ${deps//
  28. / }"
  29.  
  30.         for i in $deps
  31.         do
  32.                 j=0
  33.                 while [ "$j" -lt "${#processed_deps[*]}" ]
  34.                 do
  35.                         if [ "$i" = "${processed_deps[$j]}" ]; then
  36.                                 return
  37.                         fi
  38.                         let "j = $j + 1"
  39.                 done
  40.                 getDeps $i;
  41.         done
  42. }
  43.  
  44. getDeps $1

Paste Details

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right worth-right