searching INDEX in .sh

Aiza aiza21 at
Sun Jul 25 05:55:01 UTC 2010

b. f. wrote:
>> I'm looking for a snippet of .sh type shell code that searches the
>> /usr/ports/INDEX-8 file for dependents.
>> Just a pointer to a script in the ports system that has this would be
>> helpful
> Do you mean that, given port A, you want to find all ports that need
> port A in order to be fetched, extracted, patched, built or installed?
>  Or do you want to find all ports that are needed to fetch, extract,
> patch, build or install port A? If the former, you could look at the
> parts of ports/Mk/ that are used by running `make -C
> $PORTSDIR search bdeps=<insert PKGNAME of port A here>
> display=name,path`, and `make -C $PORTSDIR search rdeps=<insert
> PKGNAME of port A here>  display=name,path`.  If the latter, look at
> the parts of ports/Mk/ that are used by running `make -C
> <insert PKGORIGIN of port A here> pretty-print-run-depends
> pretty-print-build-depends`.  Also, parts of the ports-mgmt/portmaster
> script used with --index-only may have similar functionality.
> And do you mean to only use the INDEX?  Or are you able to use parts
> of the port tree?  Or the pkg_info utility?

I just found /usr/ports/Tools/scripts/postsearch which uses the 
/usr/ports/INDEX-8 file as its source to search. This is a perl script 
but can be used from within in .sh script.

Been playing with it and see a big inconsistence in how ports list 
build-deps and run-deps. Some ports list no build-deps just run-deps and 
vise-versa and some have same listed list in both.

Thinking I will have to take both the build and run deps lists and sort 
them together and drop dups to create a good list of dependents to allow 
for the lax enforcement of standards in the Makefile about how to list 
the ports dependents.

More information about the freebsd-questions mailing list