3 export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4 source "${SCRIPTDIR}/.validate"
6 validate_vendor_diff(){
8 files=( $(validate_diff --diff-filter=ACMR --name-only -- 'vendor.conf' 'vendor/' || true) )
11 if [ ${#files[@]} -gt 0 ]; then
12 # We run vndr to and see if we have a diff afterwards
14 # Let see if the working directory is clean
15 diffs="$(git status --porcelain -- vendor 2>/dev/null)"
18 echo 'The result of vndr differs'
22 echo 'Please vendor your package with github.com/LK4D4/vndr.'
27 echo 'Congratulations! All vendoring changes are done the right way.'
30 echo 'No vendor changes in diff.'
34 # 1. make sure all the vendored packages are used
35 # 2. make sure all the packages contain license information (just warning, because it can cause false-positive)
36 validate_vendor_used() {
37 pkgs=$(mawk '/^[a-zA-Z0-9]/ { print $1 }' < vendor.conf)
39 if ls -d vendor/$f > /dev/null 2>&1; then
40 found=$(find vendor/$f -iregex '.*LICENSE.*' -or -iregex '.*COPYRIGHT.*' -or -iregex '.*COPYING.*' | wc -l)
41 if [ $found -eq 0 ]; then
42 echo "WARNING: could not find copyright information for $f"
45 echo "WARNING: $f is vendored but unused"