Fix shell script quoting, clean up build scripts

Fix quoting so that it works with arbitrary path names (e.g. containing
spaces.)  Make hack/config-go.sh non-executable since it is meant for
sourcing and not as a standalone.

Tested:
- Checked out the tree to a directory with spaces, called the
  build script from outside the tree, confirmed it worked as expected.
- Confirmed binaries work by running them with -version.
- Ran hack/build-go.sh cmd/kubecfg and confirmed only kubecfg was built.
- Ran hack/build-go.sh cmd/integration and confirmed it was built.
- Checked it out on a Mac and confirmed that the build script works.
- Confirmed that hack/test-go.sh and hack/test-cmd.sh work.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
This commit is contained in:
Filipe Brandenburger
2014-07-30 17:07:28 -07:00
parent d7396acced
commit d00e08bb5f
2 changed files with 47 additions and 38 deletions

View File

@@ -16,19 +16,29 @@
# This script sets up a go workspace locally and builds all go components.
set -e
set -o errexit
set -o nounset
set -o pipefail
hackdir=$(dirname "$0")
# Set the environment variables required by the build.
. "${hackdir}/config-go.sh"
# Go to the top of the tree.
cd "${KUBE_REPO_ROOT}"
# Update the version.
$(dirname $0)/version-gen.sh
"${hackdir}/version-gen.sh"
source $(dirname $0)/config-go.sh
cd "${KUBE_TARGET}"
BINARIES="cmd/proxy cmd/apiserver cmd/controller-manager cmd/kubelet cmd/kubecfg"
if [ $# -gt 0 ]; then
BINARIES="$@"
if [[ $# == 0 ]]; then
# Update $@ with the default list of targets to build.
set -- cmd/proxy cmd/apiserver cmd/controller-manager cmd/kubelet cmd/kubecfg
fi
go install $(for b in $BINARIES; do echo "${KUBE_GO_PACKAGE}"/${b}; done)
binaries=()
for arg; do
binaries+=("${KUBE_GO_PACKAGE}/${arg}")
done
go install "${binaries[@]}"