Fix check_licenses.sh tomcat error failure

This commit is contained in:
mars 2022-11-26 21:53:03 -07:00
parent 7ab55cf13b
commit b1b7d1d4e7
1 changed files with 7 additions and 6 deletions

View File

@ -12,16 +12,17 @@ dir="$(pwd | sed 's/\//\n/g' | tail -n 1)"
for toml in $(find "$PWD" -name "Cargo.toml"); do
printf "Project: %s\n" "$(tomcat package.name "$toml")"
if [ "$(toml_lic="$(tomcat package.license "$toml" && printf "%s\n" "$?")")" = "0" ]; then
printf "%s: Missing license information\n" "$(printf "%s\n" "$toml" |\
sed "s/^.\+$dir\///g")"
continue
fi
for file in $(find "$(printf "%s\n" "$toml" |\
sed 's/Cargo\.toml/src/g')" -name "*.rs")
do
info="$(head -n 2 "$file")"
toml_lic="$(tomcat package.license "$toml")"
if ! test -n "$toml_lic"; then
printf "%s: Missing license information\n" "$(printf "%s\n" "$toml" |\
sed "s/^.\+$dir\///g")"
continue 2
fi
if ! [ "$toml_lic" = "$(printf "%s\n" "$info" | tail -n 1 |\
sed -n 's/\/\/ SPDX-License-Identifier: //p')" ]
then