add isorphan function

This commit is contained in:
emmett1
2019-04-29 17:58:41 +08:00
parent 9f98cc6b09
commit 301684f744

28
scratch
View File

@@ -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