Split hack/{verify,update}-* files so we don't always go build

Right now some of the hack/* tools use `go run` and build almost every
time. There are some which expect you to have already run `go install`.
And in all cases the pre-commit hook, which runs a full build wouldn't
want to do either, since it just built!

This creates a new hack/after-build/ directory and has the scripts which
REQUIRE that the binary already be built. It doesn't test and complain.
It just fails miserably. Users should not be in this directory. Users
should just use hack/verify-* which will just do the build and then call
the "after-build" version. The pre-commit hook or anything which KNOWS
the binaries have been built can use the fast version.
This commit is contained in:
Eric Paris
2015-07-20 08:24:20 -05:00
parent 985fa94ebd
commit 3b7c39656c
25 changed files with 495 additions and 258 deletions

View File

@@ -23,37 +23,8 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
kube::golang::setup_env
genconversion=$(kube::util::find-binary "gendeepcopy")
"${KUBE_ROOT}/hack/build-go.sh" cmd/gendeepcopy
if [[ ! -x "$genconversion" ]]; then
{
echo "It looks as if you don't have a compiled conversion binary"
echo
echo "If you are running from a clone of the git repo, please run"
echo "'./hack/build-go.sh cmd/gendeepcopy'."
} >&2
exit 1
fi
APIROOT="${KUBE_ROOT}/pkg/api"
TMP_APIROOT="${KUBE_ROOT}/_tmp/api"
_tmp="${KUBE_ROOT}/_tmp"
mkdir -p "${_tmp}"
cp -a "${APIROOT}" "${TMP_APIROOT}"
"${KUBE_ROOT}/hack/update-generated-deep-copies.sh"
echo "diffing ${APIROOT} against freshly generated deep copies"
ret=0
diff -Naupr -I 'Auto generated by' "${APIROOT}" "${TMP_APIROOT}" || ret=$?
cp -a ${TMP_APIROOT} "${KUBE_ROOT}/pkg"
rm -rf "${_tmp}"
if [[ $ret -eq 0 ]]
then
echo "${APIROOT} up to date."
else
echo "${APIROOT} is out of date. Please run hack/update-generated-deep-copies.sh"
exit 1
fi
"${KUBE_ROOT}/hack/after-build/verify-generated-deep-copies.sh" "$@"
# ex: ts=2 sw=2 et filetype=sh