view Scripts/lint-src.sh @ 1125:68a5e3c8aac9

ruiby/rb-rack: initial import, closes #2393
author David Demelier <markand@malikania.fr>
date Mon, 23 Sep 2019 21:11:00 +0200
parents 297b5eef115e
children 9867e578b1a9
line wrap: on
line source

#!/bin/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()
{
	printf "${BOLD}==> checking structure${RESET}\n"

	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

printf "${BOLD}=> checking binary package content for $1${RESET}\n"

check_structure $1