On Nov 07 19:21:07, srikant....@gmail.com wrote:
> Jan Stary wrote:
> > cat /var/db/pkg/$PACKAGE/+REQUIRING | xargs pkg_info -s
> 
> Thats just the first level of dependencies. What about the
> dependencies of the dependencies, and so on? It is a tree
> structure. Recursion is needed if you want to know the
> 'real collateral damage' :)

Ah, recursively. Sorry.


#!/bin/sh

test $# -gt 0 || {
        echo usage: $0 package >&2
        exit 1
}

pkg=`pkg_info -I $1 2>/dev/null | awk '{print$1}'`
test -n "$pkg" || {
        echo package $1 not recognized >&2
        exit 1
}
        
dir=/var/db/pkg/$pkg
test -d "$dir" || {
        echo $dir does not exist >&2
        exit 1
}

{
echo $pkg
cat $dir/+REQUIRING 2>/dev/null | xargs -r -n1 $0
} | sort -u


This lists the dependencies recursively
- just pipe the output through 'pkg_info -s'.
(Damn, I like the "| xargs $0" bit a lot.)

Am I reading pkg_info(1) wrong, or is there really
not a trivial way to list the recursive dependencies
of a given package (the opposite of -R) in pkg_info
itself?

        Jan

Reply via email to