diff Scripts/lint-options.sh @ 1028:e46348eb3fbd

vanilla: create a generic lint.sh script
author David Demelier <markand@malikania.fr>
date Fri, 30 Aug 2019 21:05:00 +0200
parents ddab65a5b3f5
children 52b36e54f1b7
line wrap: on
line diff
--- a/Scripts/lint-options.sh	Thu Aug 29 21:00:00 2019 +0200
+++ b/Scripts/lint-options.sh	Fri Aug 30 21:05:00 2019 +0200
@@ -17,35 +17,23 @@
 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
 
-alias basename="busybox basename"
-alias dirname="busybox dirname"
-alias echo="busybox echo"
-alias grep="busybox grep"
-alias realpath="busybox realpath"
-
-TOP=$(realpath $(dirname $0)/../)
-PROGNAME=$(basename $0)
+. $(dirname $0)/scripts.subr
 
 check()
-{(
-	name=$(basename $1).sh
+{
+	vnl_open_build $1
 
-	cd $TOP/$1
-
-	if [ ! -f $name ]; then
-		echo "warning: skipping $pkg" 1>&2
-		return 1
+	if [ -z "$PKGNAME" ]; then
+		exit 1
 	fi
 
-	. ./$name
+	echo "=> checking common options for $PKGNAME"
 
 	for o in $PKGOPTIONS; do
-		if ! grep -q $o $TOP/Docs/options.md; then
-			echo "$pkg: option $o is unknown or custom"
+		if ! grep -q "^- $o:" $TOP/Docs/options.md; then
+			echo "note: option $o is unknown or custom" 1>&2
 		fi
 	done
-)}
+}
 
-$TOP/Scripts/list.sh $1 | while read -r pkg; do
-	check $pkg
-done
+check $1