summaryrefslogtreecommitdiffstats
path: root/misc-scripts/make-sourceball
diff options
context:
space:
mode:
authorAaron Griffin <aaronmgriffin@gmail.com>2009-01-12 23:02:53 +0100
committerAaron Griffin <aaronmgriffin@gmail.com>2009-01-12 23:02:53 +0100
commita3fc31dc16b442bf492ab52f9c48d4ea230878d8 (patch)
tree42a8f2f26e083cea0e8d6468c205e84d52a5bf95 /misc-scripts/make-sourceball
parent671f36cb092ac5b8c8c30f53c19c05b8249bdee0 (diff)
downloaddbscripts-a3fc31dc16b442bf492ab52f9c48d4ea230878d8.tar.gz
dbscripts-a3fc31dc16b442bf492ab52f9c48d4ea230878d8.tar.xz
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 <aaronmgriffin@gmail.com>
Diffstat (limited to 'misc-scripts/make-sourceball')
-rwxr-xr-xmisc-scripts/make-sourceball25
1 files changed, 25 insertions, 0 deletions
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) <packagename> <repo> <arch>"
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