|
|
@@ -23,6 +23,26 @@ toggle_failpoints() {
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
+etcd_setup_gopath() {
|
|
|
+ echo "Setting GOPATH from vendor directory at 'gopath'"
|
|
|
+ d=$(dirname "$0")
|
|
|
+ CDIR=$(cd "$d" && pwd)
|
|
|
+ cd "$CDIR"
|
|
|
+ etcdGOPATH="${CDIR}/gopath"
|
|
|
+ # preserve old gopath to support building with unvendored tooling deps (e.g., gofail)
|
|
|
+ if [ -n "$GOPATH" ]; then
|
|
|
+ GOPATH="$GOPATH"
|
|
|
+ fi
|
|
|
+ rm -rf "${etcdGOPATH:?}/"
|
|
|
+ mkdir -p "${etcdGOPATH}/vendor" "${etcdGOPATH}/etcd_src/src/github.com/coreos"
|
|
|
+ export GOPATH=${etcdGOPATH}/vendor:${etcdGOPATH}/etcd_src:$GOPATH
|
|
|
+ ln -s "${CDIR}/vendor" "${etcdGOPATH}/vendor/src"
|
|
|
+ ln -s "${CDIR}" "${etcdGOPATH}/etcd_src/src/github.com/coreos/etcd"
|
|
|
+
|
|
|
+ #ln -s "${CDIR}/vendor" "${etcdGOPATH}/src"
|
|
|
+ #ln -s "${CDIR}" "${etcdGOPATH}/src/github.com/coreos"
|
|
|
+}
|
|
|
+
|
|
|
toggle_failpoints_default() {
|
|
|
mode="disable"
|
|
|
if [ ! -z "$FAILPOINTS" ]; then mode="enable"; fi
|
|
|
@@ -41,6 +61,27 @@ etcd_build() {
|
|
|
CGO_ENABLED=0 go build $GO_BUILD_FLAGS -installsuffix cgo -ldflags "$GO_LDFLAGS" -o "${out}/etcdctl" ${REPO_PATH}/etcdctl || return
|
|
|
}
|
|
|
|
|
|
+tools_build() {
|
|
|
+ out="bin"
|
|
|
+ if [ -n "${BINDIR}" ]; then out="${BINDIR}"; fi
|
|
|
+ # shellcheck disable=SC2039
|
|
|
+ tools=(
|
|
|
+ benchmark
|
|
|
+ etcd-dump-db
|
|
|
+ etcd-dump-logs
|
|
|
+ functional-tester/etcd-agent
|
|
|
+ functional-tester/etcd-tester
|
|
|
+ functional-tester/etcd-runner
|
|
|
+ local-tester/bridge
|
|
|
+ )
|
|
|
+ # shellcheck disable=SC2039
|
|
|
+ for tool in "${tools[@]}"
|
|
|
+ do
|
|
|
+ # shellcheck disable=SC2086
|
|
|
+ CGO_ENABLED=0 go build $GO_BUILD_FLAGS -installsuffix cgo -ldflags "$GO_LDFLAGS" -o "${out}/${tool}" "${REPO_PATH}/tools/${tool}" || return
|
|
|
+ done
|
|
|
+}
|
|
|
+
|
|
|
toggle_failpoints_default
|
|
|
|
|
|
# only build when called directly, not sourced
|