view Scripts/lint-deps.sh @ 874:e9ed02f2d46d

libretro-openlara: initial import, closes #2167
author David Demelier <markand@malikania.fr>
date Sun, 25 Aug 2019 12:51:04 +0200
parents aa3c1de1780a
children ddab65a5b3f5
line wrap: on
line source

#!/bin/sh
#
# lint-deps.sh -- ensure that dependencies listed in PKGDEPENDS exist
#
# 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.
#

alias basename="busybox basename"
alias dirname="busybox dirname"
alias echo="busybox echo"
alias find="busybox find"
alias grep="busybox grep"
alias realpath="busybox realpath"

TOP=$(realpath $(dirname $0)/../)
PROGNAME=$(basename $0)

usage()
{
	echo "usage: $PROGNAME [category/package]" 1>&2
	exit 1
}

check()
{(
	name=$(basename $1).sh
	failed=0

	cd $TOP/$1

	echo -n "checking dependencies for $1: "

	# Reset PKGDEPENDS in case script is broken.
	PKGDEPENDS=""

	. ./$name

	for d in $PKGDEPENDS; do
		dep=$TOP/${d%:*}/$(basename ${d%:*}).sh

		if [ ! -f $dep ]; then
			# Only print "error" once.
			if [ $failed -eq 0 ]; then
				failed=1
				echo "error"
			fi

			echo "missing ${d%:*}" 1>&2
		fi
	done

	if [ $failed -eq 0 ]; then
		echo "ok"
	fi
)}

$TOP/Scripts/list.sh $1 | while read -r pkg; do
	check $pkg
done