comparison Scripts/lint-src.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
children 52b36e54f1b7
comparison
equal deleted inserted replaced
1027:34c9fa83dc08 1028:e46348eb3fbd
1 #!/bin/busybox sh
2 #
3 # lint-src.sh -- check various things in the source package
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 . $(dirname $0)/scripts.subr
21
22 check_structure()
23 {
24 echo "==> checking structure"
25
26 local pkgname=$(basename ${1%#*})
27
28 # Check if we have the extracted source tree?
29 if [ $(tar tf $1 2> /dev/null | wc -l) -gt 32 ]; then
30 echo "warning: the source file seems to have too many files" 1>&2
31 fi
32
33 # Check build script file
34 if ! tar tf $1 $pkgname/$pkgname.sh > /dev/null 2>&1; then
35 echo "warning: missing build script file" 1>&2
36 fi
37
38 # TODO: verify PKGDOWNLOAD.
39 }
40
41 usage()
42 {
43 echo "usage: lint-src.sh source-package" 1>&2
44 exit 1
45 }
46
47 if [ "$#" -lt 1 ]; then
48 usage
49 # NOTREACHED
50 fi
51
52 echo "=> checking binary package content for $1"
53
54 check_structure $1