From a3fc31dc16b442bf492ab52f9c48d4ea230878d8 Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Mon, 12 Jan 2009 17:02:53 -0500 Subject: Add license checking to make-sourceball Confirm that the license of a package requires source distribution before building the source tarball TODO: Make sure we can skip this check somehow Signed-off-by: Aaron Griffin --- misc-scripts/make-sourceball | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'misc-scripts') diff --git a/misc-scripts/make-sourceball b/misc-scripts/make-sourceball index c02a84d..91dc122 100755 --- a/misc-scripts/make-sourceball +++ b/misc-scripts/make-sourceball @@ -1,5 +1,8 @@ #!/bin/bash +# Allowed licenses: build only for licenses in this array +ALLOWED_LICENSES=('GPL' 'GPL1' 'GPL2' 'LGPL' 'LGPL1' 'LGPL2') + if [ $# -ne 3 ]; then echo "usage: $(basename $0) " exit 1 @@ -34,10 +37,32 @@ die() { cleanup 1 } +#usage: chk_license ${license[@]}" +chk_license() { + local l + for l in "$@"; do + l="$(echo $l | tr '[:upper:]' '[:lower:]')" + for allowed in ${ALLOWED_LICENSES[@]}; do + allowed="$(echo $allowed | tr '[:upper:]' '[:lower:]')" + if [ "$l" = "$allowed" ]; then + return 0 + fi + done + done + + return 1 +} + create_srcpackage() { if [ -d "$1" ]; then pushd "$1" >/dev/null . "$BUILDSCRIPT" + if ! chk_license ${license[@]}; then + echo "Package license does not require source tarballs. Doing nothing" + echo " license => (${license[@]})" + cleanup 0 + fi + if ! /usr/bin/makepkg --allsource >/dev/null 2>&1; then popd >/dev/null return 1 -- cgit v1.2.3-2-g168b