pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: finding the leaf packages



Steven M. Bellovin wrote:
Is there some simple way to get a list of all leaf packages, in the form
of, say, pkg_tools/pkgdepgrah.  (I use that as a non-random example, since
it obviously knows how to do that, but I haven't figured out the options
to do it in any way other than as input to graphviz.)

Metadata-wise, it's the list of all directories in ${PKG_DBDIR} (/var/db/pkg) that do not have a +REQUIRED_BY file, so something simple like the following script would work for now, though it will most likely not work in the future after the pkg_install rewrite:

#!/bin/sh

: ${PKG_DBDIR=/var/db/pkg}

cd ${PKG_DBDIR}
for dir in *; do
        test -d "$dir" || continue
        test -f "$dir/+REQUIRED_BY" || echo "$dir"
done

        Cheers,

        -- Johnny Lam <jlam%pkgsrc.org@localhost>



Home | Main Index | Thread Index | Old Index