Mercurial > vanilla
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Scripts/lint-src.sh Fri Aug 30 21:05:00 2019 +0200 @@ -0,0 +1,54 @@ +#!/bin/busybox sh +# +# lint-src.sh -- check various things in the source 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_structure() +{ + echo "==> checking structure" + + local pkgname=$(basename ${1%#*}) + + # Check if we have the extracted source tree? + if [ $(tar tf $1 2> /dev/null | wc -l) -gt 32 ]; then + echo "warning: the source file seems to have too many files" 1>&2 + fi + + # Check build script file + if ! tar tf $1 $pkgname/$pkgname.sh > /dev/null 2>&1; then + echo "warning: missing build script file" 1>&2 + fi + + # TODO: verify PKGDOWNLOAD. +} + +usage() +{ + echo "usage: lint-src.sh source-package" 1>&2 + exit 1 +} + +if [ "$#" -lt 1 ]; then + usage + # NOTREACHED +fi + +echo "=> checking binary package content for $1" + +check_structure $1