Merge pull request #2404 from jbeda/fix-nogo-build

Make dockerized build work when golang isn't installed.
This commit is contained in:
Brendan Burns 2014-11-17 09:43:08 -08:00
commit 403e57be09
2 changed files with 44 additions and 1 deletions

View File

@ -39,4 +39,4 @@ source "${KUBE_ROOT}/hack/lib/version.sh"
source "${KUBE_ROOT}/hack/lib/golang.sh"
source "${KUBE_ROOT}/hack/lib/etcd.sh"
KUBE_OUTPUT_HOSTBIN="${KUBE_OUTPUT_BINPATH}/$(kube::golang::host_platform)"
KUBE_OUTPUT_HOSTBIN="${KUBE_OUTPUT_BINPATH}/$(kube::util::host_platform)"

View File

@ -36,3 +36,46 @@ kube::util::wait_for_url() {
kube::log::error "Timed out waiting for ${url}"
return 1
}
# This figures out the host platform without relying on golang. We need this as
# we don't want a golang install to be a prerequisite to building yet we need
# this info to figure out where the final binaries are placed.
kube::util::host_platform() {
local host_os
local host_arch
case "$(uname -s)" in
Darwin)
host_os=darwin
;;
Linux)
host_os=linux
;;
*)
kube::log::error "Unsupported host OS. Must be Linux or Mac OS X."
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
;;
*)
kube::log::error "Unsupported host arch. Must be x86_64, 386 or arm."
exit 1
;;
esac
echo "${host_os}/${host_arch}"
}