Get rid of hack/after-build scripts

The build is now fast enough to not need them.
This commit is contained in:
Tim Hockin
2016-05-03 22:00:27 -07:00
parent 833770d9ac
commit 18e7a3eb24
29 changed files with 434 additions and 760 deletions

View File

@@ -23,6 +23,39 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
kube::golang::setup_env
"${KUBE_ROOT}/hack/after-build/verify-generated-protobuf.sh" "$@"
APIROOTS=${APIROOTS:-pkg/api pkg/apis pkg/runtime pkg/util/intstr pkg/watch}
_tmp="${KUBE_ROOT}/_tmp"
# ex: ts=2 sw=2 et filetype=sh
cleanup() {
rm -rf "${_tmp}"
}
trap "cleanup" EXIT SIGINT
cleanup
for APIROOT in ${APIROOTS}; do
mkdir -p "${_tmp}/${APIROOT%/*}"
cp -a "${KUBE_ROOT}/${APIROOT}" "${_tmp}/${APIROOT}"
done
# If not running as root, we need to use sudo to restore the original generated
# protobuf files.
SUDO=""
if [[ "$(id -u)" != '0' ]]; then
SUDO="sudo"
fi
"${KUBE_ROOT}/hack/update-generated-protobuf.sh"
for APIROOT in ${APIROOTS}; do
TMP_APIROOT="${_tmp}/${APIROOT}"
echo "diffing ${APIROOT} against freshly generated protobuf"
ret=0
diff -Naupr -I 'Auto generated by' "${KUBE_ROOT}/${APIROOT}" "${TMP_APIROOT}" || ret=$?
${SUDO} cp -a "${TMP_APIROOT}" "${KUBE_ROOT}/${APIROOT%/*}"
if [[ $ret -eq 0 ]]; then
echo "${APIROOT} up to date."
else
echo "${APIROOT} is out of date. Please run hack/update-generated-protobuf.sh"
exit 1
fi
done