Skip to content

Commit

Permalink
Make hack/build-go.sh create symlinks for openshift
Browse files Browse the repository at this point in the history
  • Loading branch information
pmorie committed Jan 20, 2015
1 parent 05759a0 commit 2828187
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 7 deletions.
1 change: 1 addition & 0 deletions hack/build-go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ source "${OS_ROOT}/hack/common.sh"

os::build::build_binaries "$@"
os::build::place_bins
os::build::make_openshift_binary_symlinks
5 changes: 4 additions & 1 deletion hack/build-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,15 @@ gzip -f "${context}/archive.tar"
cat "${context}/archive.tar.gz" | docker run -i --cidfile="${context}/cid" openshift/origin-release
docker cp $(cat ${context}/cid):/go/src/github.com/openshift/origin/_output/local/releases "${OS_ROOT}/_output/local"

# copy the linux release back to the _output/go/bin dir
# copy the linux release back to the _output/local/go/bin dir
releases=$(find _output/local/releases/ -print | grep 'openshift-origin-.*-linux-' --color=never)
if [[ $(echo $releases | wc -l) -ne 1 ]]; then
echo "There should be exactly one Linux release tar in _output/local/releases"
exit 1
fi

bindir="_output/local/go/bin"
mkdir -p "${bindir}"
tar mxzf "${releases}" -C "${bindir}"

os::build::make_openshift_binary_symlinks
19 changes: 19 additions & 0 deletions hack/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ OS_ROOT=$(
OS_OUTPUT_SUBPATH="${OS_OUTPUT_SUBPATH:-_output/local}"
OS_OUTPUT="${OS_ROOT}/${OS_OUTPUT_SUBPATH}"
OS_OUTPUT_BINPATH="${OS_OUTPUT}/bin"
OS_LOCAL_BINPATH="${OS_ROOT}/_output/local/go/bin"

readonly OS_GO_PACKAGE=github.com/openshift/origin
readonly OS_GOPATH="${OS_OUTPUT}/go"
Expand All @@ -44,6 +45,14 @@ readonly OS_ALL_TARGETS=(
"${OS_CROSS_COMPILE_TARGETS[@]}"
)
readonly OS_ALL_BINARIES=("${OS_ALL_TARGETS[@]##*/}")
readonly OPENSHIFT_BINARY_SYMLINKS=(
openshift-router
openshift-deploy
openshift-sti-build
openshift-docker-build
osc
openshift-experimental
)

# os::build::binaries_from_targets take a list of build targets and return the
# full go package to be built
Expand Down Expand Up @@ -259,6 +268,16 @@ os::build::place_bins() {
)
}

# os::build::make_openshift_binary_symlinks makes symlinks for the openshift
# binary in _output/local/go/bin
os::build::make_openshift_binary_symlinks() {
if [[ -f "${OS_LOCAL_BINPATH}/openshift" ]]; then
for linkname in "${OPENSHIFT_BINARY_SYMLINKS[@]}"; do
ln -sf "${OS_LOCAL_BINPATH}/openshift" "${OS_LOCAL_BINPATH}/${linkname}"
done
fi
}

# os::build::get_version_vars loads the standard version variables as
# ENV vars
os::build::get_version_vars() {
Expand Down
3 changes: 0 additions & 3 deletions hack/test-cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ VOLUME_DIR=$(mktemp -d /tmp/openshift.local.volumes.XXXX)
# set path so OpenShift is available
GO_OUT="${OS_ROOT}/_output/local/go/bin"
export PATH="${GO_OUT}:${PATH}"
pushd "${GO_OUT}" > /dev/null
ln -fs "openshift" "osc"
popd > /dev/null

# Check openshift version
out=$(openshift version)
Expand Down
3 changes: 0 additions & 3 deletions hack/test-end-to-end.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ GO_OUT="${OS_ROOT}/_output/local/go/bin"

# set path so OpenShift is available
export PATH="${GO_OUT}:${PATH}"
pushd "${GO_OUT}" > /dev/null
ln -fs "$(pwd)/openshift" "osc"
popd > /dev/null

# teardown
function teardown()
Expand Down

0 comments on commit 2828187

Please sign in to comment.