clipped absolute paths

This commit is contained in:
Emma Tebibyte 2022-11-16 01:25:08 -05:00
parent 5670793f90
commit 3ec3dd97a5
1 changed files with 11 additions and 4 deletions

View File

@ -8,24 +8,31 @@ if ! command -v tomcat >/dev/null 2>&1; then
exit 69 # sysexits(3) EX_UNAVAILABLE exit 69 # sysexits(3) EX_UNAVAILABLE
fi fi
dir="$(pwd | sed 's/\//\n/g' | tail -n 1)"
for toml in $(find "$PWD" -name "Cargo.toml"); do for toml in $(find "$PWD" -name "Cargo.toml"); do
printf "Project: %s\n" "$(tomcat package.name "$toml")" printf "Project: %s\n" "$(tomcat package.name "$toml")"
for file in $(find "$(printf "%s\n" "$toml" | sed 's/Cargo\.toml/src/g')" -name "*.rs"); do for file in $(find "$(printf "%s\n" "$toml" |\
sed 's/Cargo\.toml/src/g')" -name "*.rs")
do
info="$(head -n 2 "$file")" info="$(head -n 2 "$file")"
toml_lic="$(tomcat package.license "$toml")" toml_lic="$(tomcat package.license "$toml")"
if ! test -n "$toml_lic"; then if ! test -n "$toml_lic"; then
printf "%s: Missing license information\n" "$toml" printf "%s: Missing license information\n" "$(printf "%s\n" "$toml" |\
sed "s/^.\+$dir\///g")"
continue 2 continue 2
fi fi
if ! [ "$toml_lic" = "$(printf "%s\n" "$info" | tail -n 1 |\ if ! [ "$toml_lic" = "$(printf "%s\n" "$info" | tail -n 1 |\
sed -n 's/\/\/ SPDX-License-Identifier: //p')" ] sed -n 's/\/\/ SPDX-License-Identifier: //p')" ]
then then
printf "%s: Missing or malformed license information\n" "$file" printf "%s: Missing or malformed license information\n" \
"$(printf "%s\n" "$file" | sed "s/^.\+$dir\///g")"
fi fi
if ! test -n "$(printf "%s\n" "$info" | head -n 1 |\ if ! test -n "$(printf "%s\n" "$info" | head -n 1 |\
sed -n '/\/\/ Copyright (c) .\+/p')" sed -n '/\/\/ Copyright (c) .\+/p')"
then then
printf "%s: Missing or malformed copyright holder information\n" "$file" printf "%s: Missing or malformed copyright holder information\n" \
"$(printf "%s\n" "$file" | sed "s/^.\+$dir\///g")"
fi fi
done done
done done