diff --git a/scratch b/scratch index db33a65..d9911f8 100755 --- a/scratch +++ b/scratch @@ -300,11 +300,32 @@ showdepends() { msgmiss "$dep" fi done -} +} + +isorphan() { + needarg $1 + + for pkg in $(allinstalled); do + pkgpath=$(getportpath $pkg) + #echo $pkgpath + if [ $pkgpath ]; then + depend=$(grep "^# depends[[:blank:]]*:" $pkgpath/$BUILD_SCRIPT | sed 's/^# depends[[:blank:]]*:[[:blank:]]*//' | tr ' ' '\n' | awk '!a[$0]++') + for dep in ${depend[@]}; do + if [ $dep = $1 ]; then + return 1 + fi + done + fi + unset depend dep + done + return 0 +} showdependent() { local port all dep pname + needarg $1 + for port in ${PORT_REPO[@]}; do if [ -d $port ]; then for all in $port/*/$BUILD_SCRIPT; do @@ -1406,6 +1427,11 @@ main() { missingdep exit $? fi + + if [ "$mode" = "isorphan" ]; then + isorphan $1 + exit $? + fi echo "Run 'scratch help' to see available operations and options" exit 5