hack/validate/vendor: clean up license validation step
Signed-off-by: Bjorn Neergaard <bneergaard@mirantis.com>
(cherry picked from commit 9f004830a5
)
Signed-off-by: Bjorn Neergaard <bneergaard@mirantis.com>
This commit is contained in:
parent
a4957d2585
commit
036398f512
1 changed files with 10 additions and 9 deletions
|
@ -24,25 +24,26 @@ validate_vendor_diff() {
|
|||
# check if any files have changed
|
||||
git diff --quiet HEAD -- "${vendor_files[@]}"
|
||||
else
|
||||
echo >&2 'No vendor changes in diff; skipping vendor check.'
|
||||
echo >&2 'INFO: no vendor changes in diff; skipping vendor check.'
|
||||
fi
|
||||
}
|
||||
|
||||
validate_vendor_license() {
|
||||
for f in $(mawk '$1 = "#" { print $2 }' 'vendor/modules.txt'); do
|
||||
if [ -d "vendor/$f" ]; then
|
||||
if ! echo "vendor/$f"/* | grep -qiEc '/(LICENSE|COPYING)'; then
|
||||
echo >&2 "WARNING: could not find copyright information for $f"
|
||||
fi
|
||||
while IFS= read -r module; do
|
||||
test -d "vendor/$module" || continue
|
||||
if ! compgen -G "vendor/$module/*" | grep -qEi '/(LICENSE|COPYING)[^/]*$'; then
|
||||
echo >&2 "WARNING: could not find copyright information for $module"
|
||||
fi
|
||||
done
|
||||
done < <(awk '/^# /{ print $2 }' vendor/modules.txt)
|
||||
}
|
||||
|
||||
if validate_vendor_tidy && validate_vendor_diff && validate_vendor_license; then
|
||||
echo >&2 'Vendoring has been performed correctly!'
|
||||
echo >&2 'PASS: Vendoring has been performed correctly!'
|
||||
else
|
||||
{
|
||||
echo 'Vendoring was not performed correctly; the following files changed during re-vendor:'
|
||||
echo 'FAIL: Vendoring was not performed correctly!'
|
||||
echo
|
||||
echo 'The following files changed during re-vendor:'
|
||||
echo
|
||||
git diff --name-status HEAD -- "${vendor_files[@]}"
|
||||
echo
|
||||
|
|
Loading…
Reference in a new issue