diff --git a/hack/verify-vendor-licenses.sh b/hack/verify-vendor-licenses.sh index 3cbe9c8cd14..d497c44f0db 100755 --- a/hack/verify-vendor-licenses.sh +++ b/hack/verify-vendor-licenses.sh @@ -24,34 +24,7 @@ set -o nounset set -o pipefail KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. -source "${KUBE_ROOT}/hack/lib/init.sh" -# create a nice clean place to put our new licenses -mkdir -p "${KUBE_ROOT}/_tmp" -_tmpdir="$(mktemp -d "${KUBE_ROOT}/_tmp/kube-licenses.XXXXXX")" -#echo "Created workspace: ${_tmpdir}" -function cleanup { - #echo "Removing workspace: ${_tmpdir}" - rm -rf "${_tmpdir}" -} -kube::util::trap_add cleanup EXIT +source "${KUBE_ROOT}/hack/lib/verify-generated.sh" -# symlink all vendor subfolders in temp vendor -mkdir -p "${_tmpdir}/vendor" -for child in "${KUBE_ROOT}/vendor"/* -do - ln -s "${child}" "${_tmpdir}/vendor" -done - -ln -s "${KUBE_ROOT}/LICENSE" "${_tmpdir}" -ln -s "${KUBE_ROOT}/staging" "${_tmpdir}" - -# Update licenses -LICENSE_ROOT="${_tmpdir}" "${KUBE_ROOT}/hack/update-vendor-licenses.sh" - -# Compare licenses -if ! _out="$(diff -Naupr -x OWNERS "${KUBE_ROOT}/LICENSES" "${_tmpdir}/LICENSES")"; then - echo "Your LICENSES tree is out of date. Run hack/update-vendor-licenses.sh and commit the results." >&2 - echo "${_out}" >&2 - exit 1 -fi +kube::verify::generated "Generated files need to be updated" "Please run 'hack/update-vendor-licenses.sh'" hack/update-vendor-licenses.sh "$@"