Getting a list of dependencies which have to be installed ?

Randy Pratt bsd-unix at earthlink.net
Thu Dec 14 10:53:34 PST 2006


On Thu, 14 Dec 2006 19:10:27 +0100
Frank Staals <frankstaals at gmx.net> wrote:

> Hey...,
> 
> Is there a utility to display the dependencies of a port which have yet 
> to be installed ? I know you can get a complete dependency list on 
> freebsd.org/ports , pkg_info -r or just looking in the files in the 
> ports dir. But is there a command to display only the dependencies which 
> haven't been installed on your system yet ? I also looked at pkg_add -n 
> but it immediately starts fetching the packages needed. I don't want to 
> start downloading the complete package just because I want a list of 
> ports I haven't installed yet.
> 
> Or is the only way making a diff between the pkg_info -r output and your 
> pkg_info -a ? If so : Is there a way to tell pkg_info when using the -r 
> flag on a not-yet-installed-port to only get a list of the dependencies 
> instead of downloading the complete package ? Or is there just an other 
> utility which can display this information which I'm not aware of ?

I don't know of a utility that does that function.  Like you, I often
want to know what I'm committing to when installing a new port so I
wrote a small script to do just that:

what_do_i_need.sh
=================================================================
#!/bin/sh
#<title>List needed ports not already installed</title>

portsdir="`make -V PORTSDIR`"
pkgdbdir="`make -V PKG_DBDIR`"
indexfile="`make -V INDEXFILE`"

origin_list="`pwd` `make all-depends-list`"

for origin in ${origin_list}; do
#  echo "ORIGIN: ${origin}"
   pkg_name="`grep "|${origin}|" ${portsdir}/${indexfile} \
      | cut -d "|" -f 1`"
   padding=$(( 50 - `echo "${origin}" | wc -c` +1))
   if [ ! -e "${pkgdbdir}/${pkg_name}" ]; then
      printf " NEED: ${origin}%${padding}c${pkg_name}\n" " "
   fi
done
=================================================================

Put it in your path somewhere, chmod to executable and use like:
# cd xawtv
# what_do_i_need.sh 
 NEED: /usr/ports/multimedia/xawtv                       xawtv-3.95_1
 NEED: /usr/ports/x11-fonts/tv-fonts                     tv-fonts-1.1

It will only list the needed ports butyou can modify it to do as
you want.  Its probably a wise idea to make sure all ports have
been updated to match your ports tree.

HTH,

Randy
-- 


More information about the freebsd-questions mailing list