Mercurial > vanilla
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Scripts/lint-pkg.sh Fri Aug 30 21:05:00 2019 +0200 @@ -0,0 +1,64 @@ +#!/bin/busybox sh +# +# lint-pkg.sh -- check various things in the package +# +# Copyright (c) 2019 David Demelier <markand@malikania.fr> +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# + +. $(dirname $0)/scripts.subr + +check_fhs() +{ + echo "==> checking directory hierarchy" + + if tar tf $1 | grep -Ev '^(bin|etc|include|lib|libexec|local|share|tmp|var)' 1>&2; then + echo "warning: the above files are not part of Vanilla Linux FHS" 1>&2 + fi +} + +check_libtool() +{ + echo "==> checking presence of libtool files:" + + if tar tf $1 | grep -E '\.la$' 1>&2; then + echo "warning: the following libtool files must be removed" 1>&2 + fi +} + +check_manpages() +{ + echo "==> checking manual pages in uncompressed form:" + + if tar tf $1 | grep -E 'share/man/man./.*\.(gz|bz2)$'; then + echo "warning: the above files must not be compressed" 1>&2 + fi +} + +usage() +{ + echo "usage: lint-pkg.sh binary-package" 1>&2 + exit 1 +} + +if [ "$#" -lt 1 ]; then + usage + # NOTREACHED +fi + +echo "=> checking binary package content for $1" + +check_fhs $1 +check_libtool $1 +check_manpages $1