hack/update-staging-godep.sh: check for staging repos in GOPATH

pull/6/head
Dr. Stefan Schimanski 2017-07-24 10:44:42 +02:00
parent a6bfeef4fe
commit 263b918541
3 changed files with 19 additions and 12 deletions

View File

@ -24,6 +24,7 @@ source "${KUBE_ROOT}/hack/lib/util.sh"
kube::util::ensure_single_dir_gopath
kube::util::ensure_godep_version v79
kube::util::ensure_no_staging_repos_in_gopath
if [ -e "${KUBE_ROOT}/vendor" -o -e "${KUBE_ROOT}/Godeps" ]; then
echo "The directory vendor/ or Godeps/ exists. Remove them before running godep-save.sh" 1>&2
@ -40,18 +41,6 @@ REQUIRED_BINS=(
)
pushd "${KUBE_ROOT}" > /dev/null
# sanity check that staging directories do not exist in GOPATH
error=0
for repo in $(ls ${KUBE_ROOT}/staging/src/k8s.io); do
if [ -e "${GOPATH}/src/k8s.io/${repo}" ]; then
echo "k8s.io/${repo} exists in GOPATH. Remove before running godep-save.sh." 1>&2
error=1
fi
done
if [ "${error}" = "1" ]; then
exit 1
fi
echo "Running godep save. This will take around 15 minutes."
GOPATH=${GOPATH}:${KUBE_ROOT}/staging godep save "${REQUIRED_BINS[@]}"

View File

@ -513,6 +513,22 @@ kube::util::ensure_godep_version() {
godep version
}
# Ensure that none of the staging repos is checked out in the GOPATH because this
# easily confused godep.
kube::util::ensure_no_staging_repos_in_gopath() {
kube::util::ensure_single_dir_gopath
local error=0
for repo in $(ls ${KUBE_ROOT}/staging/src/k8s.io); do
if [ -e "${GOPATH}/src/k8s.io/${repo}" ]; then
echo "k8s.io/${repo} exists in GOPATH. Remove before running godep-save.sh." 1>&2
error=1
fi
done
if [ "${error}" = "1" ]; then
exit 1
fi
}
# Installs the specified go package at a particular commit.
kube::util::go_install_from_commit() {
local -r pkg=$1

View File

@ -56,7 +56,9 @@ if ! kube::util::godep_restored 2>&1 | sed 's/^/ /'; then
fi
kube::util::ensure-temp-dir
kube::util::ensure_single_dir_gopath
kube::util::ensure_godep_version v79
kube::util::ensure_no_staging_repos_in_gopath
TMP_GOPATH="${KUBE_TEMP}/go"