From 913dc4e4905d47a137dd9d1d0a9dc76d5ba16bdc Mon Sep 17 00:00:00 2001 From: Dawn Chen Date: Tue, 14 Apr 2015 11:24:49 -0700 Subject: [PATCH] Revert "Use a helper to find built binaries" --- cluster/kubectl.sh | 44 ++++++++++++++++++++++++++++++++++++++++++-- hack/ginkgo-e2e.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 86 insertions(+), 4 deletions(-) diff --git a/cluster/kubectl.sh b/cluster/kubectl.sh index 7bb0351eb55e..2c146bc9d670 100755 --- a/cluster/kubectl.sh +++ b/cluster/kubectl.sh @@ -20,7 +20,6 @@ set -o pipefail KUBE_ROOT=$(dirname "${BASH_SOURCE}")/.. source "${KUBE_ROOT}/cluster/kube-env.sh" -source "${KUBE_ROOT}/hack/lib/util.sh" UTILS=${KUBE_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh if [ -f ${UTILS} ]; then source "${UTILS}" @@ -32,10 +31,51 @@ get_absolute_dirname() { echo "$(cd "$(dirname "$1")" && pwd)" } +# Detect the OS name/arch so that we can find our binary +case "$(uname -s)" in + Darwin) + host_os=darwin + ;; + Linux) + host_os=linux + ;; + *) + echo "Unsupported host OS. Must be Linux or Mac OS X." >&2 + exit 1 + ;; +esac + +case "$(uname -m)" in + x86_64*) + host_arch=amd64 + ;; + i?86_64*) + host_arch=amd64 + ;; + amd64*) + host_arch=amd64 + ;; + arm*) + host_arch=arm + ;; + i?86*) + host_arch=x86 + ;; + *) + echo "Unsupported host arch. Must be x86_64, 386 or arm." >&2 + exit 1 + ;; +esac + # If KUBECTL_PATH isn't set, gather up the list of likely places and use ls # to find the latest one. if [[ -z "${KUBECTL_PATH:-}" ]]; then - kubectl=$(kube::util::find-binary "kubectl") + locations=( + "${KUBE_ROOT}/_output/dockerized/bin/${host_os}/${host_arch}/kubectl" + "${KUBE_ROOT}/_output/local/bin/${host_os}/${host_arch}/kubectl" + "${KUBE_ROOT}/platforms/${host_os}/${host_arch}/kubectl" + ) + kubectl=$( (ls -t "${locations[@]}" 2>/dev/null || true) | head -1 ) if [[ ! -x "$kubectl" ]]; then { diff --git a/hack/ginkgo-e2e.sh b/hack/ginkgo-e2e.sh index d5254eaa2b09..93d7364e1dd0 100755 --- a/hack/ginkgo-e2e.sh +++ b/hack/ginkgo-e2e.sh @@ -21,8 +21,50 @@ set -o pipefail KUBE_ROOT=$(dirname "${BASH_SOURCE}")/.. # --- Find local test binaries. -source "${KUBE_ROOT}/hack/lib/util.sh" -e2e=$(kube::util::find-binary "e2e") + +# Detect the OS name/arch so that we can find our binary +case "$(uname -s)" in + Darwin) + host_os=darwin + ;; + Linux) + host_os=linux + ;; + *) + echo "Unsupported host OS. Must be Linux or Mac OS X." >&2 + exit 1 + ;; +esac + +case "$(uname -m)" in + x86_64*) + host_arch=amd64 + ;; + i?86_64*) + host_arch=amd64 + ;; + amd64*) + host_arch=amd64 + ;; + arm*) + host_arch=arm + ;; + i?86*) + host_arch=x86 + ;; + *) + echo "Unsupported host arch. Must be x86_64, 386 or arm." >&2 + exit 1 + ;; +esac + +# Gather up the list of likely places and use ls to find the latest one. +locations=( + "${KUBE_ROOT}/_output/dockerized/bin/${host_os}/${host_arch}/e2e" + "${KUBE_ROOT}/_output/local/bin/${host_os}/${host_arch}/e2e" + "${KUBE_ROOT}/platforms/${host_os}/${host_arch}/e2e" +) +e2e=$( (ls -t "${locations[@]}" 2>/dev/null || true) | head -1 ) # --- Setup some env vars.