Finding a port's dependencies

Elias Pipping pipping at macports.org
Sat Mar 31 13:03:04 PDT 2007


>>> I forget again: is there an easy way to tell if any
>>> ports depend on those?
>>
>> yes, there is:
>>
>> $grep :cairo-devel */*/Portfile
>
> I'll put this in the FAQ.  Would it be useful to make the port  
> command do
> this in a future revision?
>
> Mark

I've put together a script to search for dependents. Here's what it  
does:

  * works on ports that aren't currently installed
  * supports both the (bin|lib):foo:name and the port:name syntax
  * matches the exact name [1]
    (searching for ncurses does not bring up results for ncursesw)
  * supports regexp [2]
    (e.g. searching for "ncursesw?")
  * finds dependencies that hide in variants
  * finds dependencies that hide in comments (yet to be gotten rid of)

setup:      the script needs to be run from within the dports folder.
invocation: foo.sh ncursesw?

==== foo ====

#! /bin/sh

# room for customization
SED=/usr/bin/sed
GREP=/usr/bin/grep

$GREP -E "(port|(lib|bin):[^:]+):$1([\t ]|$)" */*/Portfile | $SED "s=/ 
Portfile:.*==g"

==== bar ====

[1] http://paste.lisp.org/display/39008/raw
[2] http://paste.lisp.org/display/39008,1/raw


Regards,

Elias



More information about the macports-dev mailing list