Tracing build dependencies

Randy Pratt rpratt1950 at
Tue Apr 27 15:52:25 PDT 2004

On Tue, 27 Apr 2004 16:53:51 -0400
Jim Trigg <jtrigg at> wrote:

> On Tue, Apr 27, 2004 at 01:43:02PM -0700, Kent Stewart wrote:
> > On Tuesday 27 April 2004 01:19 pm, Jim Trigg wrote:
> > > I remember seeing come across one of the FreeBSD lists (either ports,
> > > stable, or questions) a shell script to show build dependencies of
> > > installed ports (for use in determining whether installed ports are
> > > orphans or not), but cannot now find it (either in my saved mail, in
> > > the list archives, or through a web search).  Does anyone have such a
> > > script?
> > 
> > Look at pkg_cutleaves. There are a number of others in ../sysutils. I 
> > followed the thread and installed it and pkg_tree.
> Unfortunately, it only looks in the pkgdb, which does not track build
> dependencies (only RUN_DEPENDS and LIB_DEPENDS).

I think you might be referring to a script I quickly wrote one day
to use with pkg_cutleaves to find only build dependencies:

It was a situation where I did not want to remove build dependencies
because it was a slow box and did not want to have to rebuild them
if not necessary during the next portupgrade.

I rewrote that script after thinking about it a bit.  It had the
drawbacks of having to have another database file and requiring it
to be manually updated if you wanted it to reflect the current status
of installed ports.

If all you need to know is that something depends on a port, then
this might do what you want.  It uses ports/INDEX as its source which
includes both build and run dependencies.  No extra databases are
needed but it makes no distinction whether its a build or run

You will need to supply the full package name, ie: rpm-3.0.6_9

---begin script---
#Find Build/Run Dependencies for a Port (Uses ports/INDEX)


pkg_exist=`pkg_info | awk '{print $1}'`

list=`grep $1 $database | awk -F "|" '{print $1}'`

for i in $list; do
  if [ $i != $1 ]; then
    for j in $pkg_exist; do
      if [ $j = $i ]; then
        echo "$i"
---end script---

Note that the script will filter out references to the port that
you are checking for dependencies.



More information about the freebsd-ports mailing list