mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
53 lines
774 B
Bash
53 lines
774 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
# Compare licenses of Go dependencies against a whitelist.
|
||
|
|
||
|
set -e -o pipefail
|
||
|
|
||
|
not_allowed() {
|
||
|
echo "license not allowed for package: $line"
|
||
|
err=1
|
||
|
}
|
||
|
|
||
|
go mod download
|
||
|
|
||
|
go-licenses csv ./... | {
|
||
|
while read line; do
|
||
|
|
||
|
pkg=${line%%,*}
|
||
|
lic=${line##*,}
|
||
|
|
||
|
case $lic in
|
||
|
Apache-2.0|BSD-2-Clause|BSD-3-Clause|ISC|MIT)
|
||
|
;;
|
||
|
|
||
|
MPL-2.0)
|
||
|
case $pkg in
|
||
|
github.com/talos-systems/talos/pkg/machinery/config/encoder)
|
||
|
;;
|
||
|
*)
|
||
|
not_allowed
|
||
|
;;
|
||
|
esac
|
||
|
;;
|
||
|
|
||
|
Unknown)
|
||
|
case $pkg in
|
||
|
github.com/edgelesssys/constellation/*)
|
||
|
;;
|
||
|
*)
|
||
|
not_allowed
|
||
|
;;
|
||
|
esac
|
||
|
;;
|
||
|
|
||
|
*)
|
||
|
echo "unknown license: $line"
|
||
|
err=1
|
||
|
;;
|
||
|
esac
|
||
|
|
||
|
done
|
||
|
exit $err
|
||
|
}
|