how to distinguish direct/indirect requirements?

Andrew Pantyukhin infofarmer at FreeBSD.org
Mon Nov 26 07:54:36 PST 2007


On Fri, Nov 23, 2007 at 11:00:32PM +0100, Alex Dupre wrote:
> Andrew Pantyukhin wrote:
> > You can cd some/port/&&make depends
> 
> One way only. It would be more useful to know which installed ports
> directly depend on a specific port.

As an obvious working (but not nearly correct) example:

pkg_direct_req <pkg name or regexp>

#!/bin/sh
indirect_reqs=`pkg_info -Rx "$1"|egrep -v '(:|^$)'`
pkg_origin=`pkg_info -ox "$1"|grep -m1 /`
for i in $indirect_reqs;do
	req_origin=`pkg_info -o "$i"|grep /`
	depdirs=`cd /usr/ports/$req_origin;make -V _DEPEND_DIRS`
	if echo $depdirs|grep -qw $pkg_origin;then
		echo $i is a direct req
	fi
done


More information about the freebsd-ports mailing list