Ports tree depencency calculation The first run scans the whole ports tree: export PORTSDIR=/path/to/ports export DEPENDSDIR=/var/db/chkversion mkdir -p $DEPENDSDIR depends.pl On the following runs, a file containing updated files is created: CVSOUT=`mktemp`; CVSERR=`mktemp` cd $PORTSDIR && cvs -R -q update -AdP >"$CVSOUT" 2>"$CVSERR" export FILESLIST=`mktemp` sed -n -e 's/^[UPM] //p' "$CVSOUT" >"$FILESLIST" sed -n -e 's/^cvs update: \(.*\)is no longer in the repository$/\1/p' "$CVSERR" >>"$FILESLIST" rm "$CVSOUT" "$CVSERR" and fed in the script like above export PORTSDIR=/path/to/ports export DEPENDSDIR=/var/db/chkversion mkdir -p $DEPENDSDIR export PORTSLIST=$DEPENDSDIR/PORTSLIST depends.pl rm $FILESLIST now $PORTSLIST contains a list of affected ports. EXAMPLES: print all slave ports of mail/exim: awk -F\| '$1 == "mail/exim/Makefile" {print $3}' $DEPENDSDIR/DEPENDS NOTES: When not all modified files are fed into the script, the database gets out of sync and has to be regenerated.