Use ensured godep instead of relying on PATH

parent c0c62821
...@@ -31,5 +31,5 @@ fi ...@@ -31,5 +31,5 @@ fi
kube::util::ensure_godep_version kube::util::ensure_godep_version
kube::log::status "Downloading dependencies - this might take a while" kube::log::status "Downloading dependencies - this might take a while"
GOPATH="${GOPATH}:${KUBE_ROOT}/staging" godep restore "$@" GOPATH="${GOPATH}:${KUBE_ROOT}/staging" ${KUBE_GODEP:?} restore "$@"
kube::log::status "Done" kube::log::status "Done"
...@@ -71,7 +71,7 @@ kube::log::status "Running godep save - this might take a while" ...@@ -71,7 +71,7 @@ kube::log::status "Running godep save - this might take a while"
# This uses $(pwd) rather than ${KUBE_ROOT} because KUBE_ROOT will be # This uses $(pwd) rather than ${KUBE_ROOT} because KUBE_ROOT will be
# realpath'ed, and godep barfs ("... is not using a known version control # realpath'ed, and godep barfs ("... is not using a known version control
# system") on our staging dirs. # system") on our staging dirs.
GOPATH="${GOPATH}:$(pwd)/staging" godep save "${REQUIRED_BINS[@]}" GOPATH="${GOPATH}:$(pwd)/staging" ${KUBE_GODEP:?} save "${REQUIRED_BINS[@]}"
# create a symlink in vendor directory pointing to the staging client. This # create a symlink in vendor directory pointing to the staging client. This
# let other packages use the staging client as if it were vendored. # let other packages use the staging client as if it were vendored.
......
...@@ -454,13 +454,7 @@ kube::util::ensure_godep_version() { ...@@ -454,13 +454,7 @@ kube::util::ensure_godep_version() {
return return
fi fi
# If GODEP is in the path, then use it. # Otherwise, install forked godep
if [[ "$(godep version 2>/dev/null)" == *"godep ${godep_target_version}"* ]]; then
export KUBE_GODEP="$(which godep)"
kube::log::status "Using ${KUBE_GODEP}"
return
fi
kube::log::status "Installing godep version ${godep_target_version}" kube::log::status "Installing godep version ${godep_target_version}"
# Run in hermetic GOPATH # Run in hermetic GOPATH
kube::golang::setup_env kube::golang::setup_env
...@@ -468,6 +462,7 @@ kube::util::ensure_godep_version() { ...@@ -468,6 +462,7 @@ kube::util::ensure_godep_version() {
export KUBE_GODEP="${KUBE_GOPATH}/bin/godep" export KUBE_GODEP="${KUBE_GOPATH}/bin/godep"
kube::log::status "Installed ${KUBE_GODEP}" kube::log::status "Installed ${KUBE_GODEP}"
# Verify that the installed godep from fork is what we expect
if [[ "$(${KUBE_GODEP:?} version 2>/dev/null)" != *"godep ${godep_target_version}"* ]]; then if [[ "$(${KUBE_GODEP:?} version 2>/dev/null)" != *"godep ${godep_target_version}"* ]]; then
kube::log::error "Expected godep ${godep_target_version} from ${KUBE_GODEP}, got $(${KUBE_GODEP:?} version)" kube::log::error "Expected godep ${godep_target_version} from ${KUBE_GODEP}, got $(${KUBE_GODEP:?} version)"
return 1 return 1
......
...@@ -70,7 +70,7 @@ function updateGodepManifest() { ...@@ -70,7 +70,7 @@ function updateGodepManifest() {
pushd "${TMP_GOPATH}/src/k8s.io/${repo}" >/dev/null pushd "${TMP_GOPATH}/src/k8s.io/${repo}" >/dev/null
kube::log::status "Updating godeps for k8s.io/${repo}" kube::log::status "Updating godeps for k8s.io/${repo}"
rm -rf Godeps # remove the current Godeps.json so we always rebuild it rm -rf Godeps # remove the current Godeps.json so we always rebuild it
GOPATH="${TMP_GOPATH}:${GOPATH}:${GOPATH}/src/k8s.io/kubernetes/staging" godep save ${GODEP_OPTS} ./... 2>&1 | sed 's/^/ /' GOPATH="${TMP_GOPATH}:${GOPATH}:${GOPATH}/src/k8s.io/kubernetes/staging" ${KUBE_GODEP:?} save ${GODEP_OPTS} ./... 2>&1 | sed 's/^/ /'
# Rewriting Godeps.json to cross-out commits that don't really exist because we haven't pushed the prereqs yet # Rewriting Godeps.json to cross-out commits that don't really exist because we haven't pushed the prereqs yet
local repo local repo
......
...@@ -51,7 +51,6 @@ function cleanup { ...@@ -51,7 +51,6 @@ function cleanup {
echo "Removing ${_tmpdir}" echo "Removing ${_tmpdir}"
rm -rf "${_tmpdir}" rm -rf "${_tmpdir}"
fi fi
export GODEP=""
} }
trap cleanup EXIT trap cleanup EXIT
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment