comparison Scripts/lint-options.sh @ 721:034a2a62a9f8

vanilla: consolidate options with lint-options.sh
author David Demelier <markand@malikania.fr>
date Mon, 05 Aug 2019 13:19:31 +0200
parents
children ddab65a5b3f5
comparison
equal deleted inserted replaced
720:100b1ba8672d 721:034a2a62a9f8
1 #!/bin/sh
2 #
3 # lint-options.sh -- check if packages use predefined options
4 #
5 # Copyright (c) 2019 David Demelier <markand@malikania.fr>
6 #
7 # Permission to use, copy, modify, and/or distribute this software for any
8 # purpose with or without fee is hereby granted, provided that the above
9 # copyright notice and this permission notice appear in all copies.
10 #
11 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 #
19
20 alias basename="busybox basename"
21 alias dirname="busybox dirname"
22 alias echo="busybox echo"
23 alias grep="busybox grep"
24 alias realpath="busybox realpath"
25
26 TOP=$(realpath $(dirname $0)/../)
27 PROGNAME=$(basename $0)
28
29 check()
30 {(
31 name=$(basename $1).sh
32
33 cd $TOP/$1
34
35 if [ ! -f $name ]; then
36 echo "warning: skipping $pkg" 1>&2
37 return 1
38 fi
39
40 . ./$name
41
42 for o in $PKGOPTIONS; do
43 if ! grep -q $o $TOP/Docs/options.md; then
44 echo "$pkg: option $o is unknown or custom"
45 fi
46 done
47 )}
48
49 $TOP/Scripts/list.sh $1 | while read -r pkg; do
50 check $pkg
51 done