License check action (#1384)

* Add scripts + support docs for license check action

* Switch to genuine bash
This commit is contained in:
dotasek 2023-08-04 16:29:17 -04:00 committed by GitHub
parent 9c3a6a7f37
commit 3361e93bdf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 77 additions and 0 deletions

View File

@ -0,0 +1,49 @@
#!/bin/bash
IFS=$'\n'
readarray -t whitelist < ./.github/workflows/license-check/license-whitelist.txt
readarray -t specialcases < <( grep -vE "^#" ./.github/workflows/license-check/license-special-cases.txt )
exitStatus=0
for specialcase in "${specialcases[@]}"
do
echo "Special case: " "$specialcase"
done
readarray -t thirdparty < <( tail -n +3 ./target/generated-sources/license/THIRD-PARTY.txt )
for thirdpartyentry in "${thirdparty[@]}"
do
allLicensesValid=true
# Remove leading spaces
thirdpartyentry="${thirdpartyentry#"${thirdpartyentry%%[![:space:]]*}"}"
echo "Evaluating Dependency: " "$thirdpartyentry"
if [[ $(echo "${specialcases[@]}" | fgrep -w $thirdpartyentry) ]]
then
echo " Ignoring: " "$thirdpartyentry"
else
licenses=($(echo $thirdpartyentry | awk -vRS=")" -vFS="(" '{print $2}'))
for (( i=0; i < ${#licenses[@]} - 1 ; i++ ))
do
#echo ${licenses[i]}
licenseToCheck=${licenses[i]}
if [[ $(echo "${whitelist[@]}" | fgrep -w $licenseToCheck) ]]
then
#do nothing bsh no-op
:
else
echo " Unknown license found: " $licenseToCheck
allLicensesValid=false
exitStatus=1
fi
done
fi
if $allLicensesValid
then
echo " All licenses OK"
else
echo " Possible license incompatibilities found"
fi
done
exit $exitStatus

View File

@ -0,0 +1,3 @@
(Unknown license) javaparser (com.google.code.javaparser:javaparser:1.0.11 - http://code.google.com/p/javaparser/)
# IGNORE ME
(Apache Software License 2.0) HAPI FHIR - Validation Resources (FHIR R4) (ca.uhn.hapi.fhir:hapi-fhir-validation-resources-r4:6.4.1 - https://hapifhir.io/hapi-deployable-pom/hapi-fhir-validation-resources-r4)

View File

@ -0,0 +1,25 @@
The Apache Software License, Version 2.0
Apache Software License, version 1.1
Apache Software License 2.0
The Apache License, Version 2.0
The Apache Software License, Version 2.0
MIT License
The MIT License
Apache Software License, version 1.1
Apache 2
Apache 2.0
Apache License 2.0
Eclipse Public License v2.0
BSD licence
The BSD License
BSD-Style License
BSD License 3
New BSD License
BSD 3 Clause
The JSON License
Eclipse Public License - v 1.0
Eclipse Public License v. 2.0
Eclipse Distribution License v. 1.0
Eclipse Distribution License - v 1.0
Unicode/ICU License
BSD 2-Clause License