Update verify-godeps.sh to actually work

The diff was incorrect. It was doing `diff -NIaupr`. And so diff was
interpreting the argument to -I to be `aupr`. So it was not running
recursively. The fix is not so simple because there is an intentionally
broken symlink in one of the godeps. Which diff -r fails on by default.
On linux there is an options to not dereference symlink and just make
sure they point to the same thing. No so on OS X. So we have to exclude
all files called "symlink". Which thankfully there is only one of.
This commit is contained in:
Eric Paris 2015-09-18 16:30:06 -04:00
parent c95a7470f1
commit 6766b732a5

View File

@ -70,7 +70,7 @@ preload-dep "github.com/prometheus" "client_golang" "692492e54b553a81013254cc1fb
echo "Download finished" echo "Download finished"
# copy the contents of your kube directory into the nice clean place # copy the contents of your kube directory into the nice clean place
_kubetmp="${_tmpdir}/src/k8s.io/" _kubetmp="${_tmpdir}/src/k8s.io"
mkdir -p "${_kubetmp}" mkdir -p "${_kubetmp}"
#should create ${_kubectmp}/kubernetes #should create ${_kubectmp}/kubernetes
git archive --format=tar --prefix=kubernetes/ $(git write-tree) | (cd "${_kubetmp}" && tar xf -) git archive --format=tar --prefix=kubernetes/ $(git write-tree) | (cd "${_kubetmp}" && tar xf -)
@ -84,11 +84,19 @@ rm -rf ./Godeps
git init > /dev/null 2>&1 git init > /dev/null 2>&1
# recreate the Godeps using the nice clean set we just downloaded # recreate the Godeps using the nice clean set we just downloaded
"${GODEP}" save ./... "${GODEP}" save -t ./...
popd > /dev/null popd > /dev/null
# Check for any (meaninful) differences between the godeps in the tree and this nice clean one we just built if ! _out="$(diff -Naupr --ignore-matching-lines='^\s*\"GoVersion\":' --ignore-matching-lines='^\s*\"Comment\":' ${KUBE_ROOT}/Godeps/Godeps.json ${_kubetmp}/Godeps/Godeps.json)"; then
if ! _out="$(diff -NIaupr --ignore-matching-lines='^\s*\"GoVersion\":' --ignore-matching-lines='^\s*\"Comment\":' ${KUBE_ROOT}/Godeps/ ${_kubetmp}/Godeps/)"; then echo "Your Godeps.json is different:"
echo "${_out}"
exit 1
fi
# Godeps/_workstapces/src/github.com/fsouza/go-dockerclient/testing/data/symlink'
# is an intentionally broken symlink. Linux can use --no-dereference. OS X cannot.
# So we --exclude='symlink' so diff -r doesn't die following a bad symlink.
if ! _out="$(diff -Naupr --exclude='symlink' ${KUBE_ROOT}/Godeps/_workspace/src ${_kubetmp}/Godeps/_workspace/src)"; then
echo "Your godeps changes are not reproducable" echo "Your godeps changes are not reproducable"
echo "${_out}" echo "${_out}"
exit 1 exit 1