comparison Scripts/lint-pkg.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-pkg.sh -- check various things in the 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_fhs()
23 {
24 echo "==> checking directory hierarchy"
25
26 if tar tf $1 | grep -Ev '^(bin|etc|include|lib|libexec|local|share|tmp|var)' 1>&2; then
27 echo "warning: the above files are not part of Vanilla Linux FHS" 1>&2
28 fi
29 }
30
31 check_libtool()
32 {
33 echo "==> checking presence of libtool files:"
34
35 if tar tf $1 | grep -E '\.la$' 1>&2; then
36 echo "warning: the following libtool files must be removed" 1>&2
37 fi
38 }
39
40 check_manpages()
41 {
42 echo "==> checking manual pages in uncompressed form:"
43
44 if tar tf $1 | grep -E 'share/man/man./.*\.(gz|bz2)$'; then
45 echo "warning: the above files must not be compressed" 1>&2
46 fi
47 }
48
49 usage()
50 {
51 echo "usage: lint-pkg.sh binary-package" 1>&2
52 exit 1
53 }
54
55 if [ "$#" -lt 1 ]; then
56 usage
57 # NOTREACHED
58 fi
59
60 echo "=> checking binary package content for $1"
61
62 check_fhs $1
63 check_libtool $1
64 check_manpages $1