From 4673f6b558db8040dcd3e0c942fe4181944d12a8 Mon Sep 17 00:00:00 2001 From: "Dr. Stefan Schimanski" Date: Mon, 16 Oct 2017 14:09:26 +0200 Subject: [PATCH 1/2] update-bazel.sh: fix on Mac --- hack/update-bazel.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hack/update-bazel.sh b/hack/update-bazel.sh index 4f42d098340..6bfa9b062d2 100755 --- a/hack/update-bazel.sh +++ b/hack/update-bazel.sh @@ -20,6 +20,15 @@ set -o pipefail export KUBE_ROOT=$(dirname "${BASH_SOURCE}")/.. source "${KUBE_ROOT}/hack/lib/init.sh" +if LANG=C sed --help 2>&1 | grep -q GNU; then + SED="sed" +elif which gsed &>/dev/null; then + SED="gsed" +else + echo "Failed to find GNU sed as sed or gsed. If you are on Mac: brew install gnu-sed." >&2 + exit 1 +fi + # Remove generated files prior to running kazel. # TODO(spxtr): Remove this line once Bazel is the only way to build. rm -f "${KUBE_ROOT}/pkg/generated/openapi/zz_generated.openapi.go" @@ -44,6 +53,6 @@ gazelle fix \ # gazelle won't follow the symlinks in vendor/, so we can't just exclude # staging/. Instead we just fix the bad paths with sed. find staging -name BUILD -o -name BUILD.bazel | \ - xargs sed -i 's|\(importpath = "\)k8s.io/kubernetes/staging/src/\(.*\)|\1\2|' + xargs ${SED} -i 's|\(importpath = "\)k8s.io/kubernetes/staging/src/\(.*\)|\1\2|' kazel From 4156ec979b4fa3013d9bda7edc5d951538cc36cd Mon Sep 17 00:00:00 2001 From: "Dr. Stefan Schimanski" Date: Mon, 16 Oct 2017 14:36:49 +0200 Subject: [PATCH 2/2] build/common.sh: silence kube::build::has_ip on Mac --- build/common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/common.sh b/build/common.sh index b9c80fef0ac..750440dcd13 100755 --- a/build/common.sh +++ b/build/common.sh @@ -330,7 +330,7 @@ function kube::build::has_docker() { } function kube::build::has_ip() { - ip -Version | grep 'iproute2' &> /dev/null + which ip &> /dev/null && ip -Version | grep 'iproute2' &> /dev/null } # Detect if a specific image exists