Update golang-base.eclass
This commit is contained in:
parent
522582fcf2
commit
efe9ec19f8
|
@ -159,7 +159,7 @@ GOLANG_PKG_TAGS="${GOLANG_PKG_TAGS:-}"
|
||||||
# Sets additional standard Go workspaces to be appended to the environment
|
# Sets additional standard Go workspaces to be appended to the environment
|
||||||
# variable GOPATH, as described in http://golang.org/doc/code.html.
|
# variable GOPATH, as described in http://golang.org/doc/code.html.
|
||||||
# This eclass defaults to an empty list.
|
# This eclass defaults to an empty list.
|
||||||
GOLANG_PKG_VENDOR=()
|
GOLANG_PKG_VENDOR="${GOLANG_PKG_VENDOR:-}"
|
||||||
|
|
||||||
# @ECLASS-VARIABLE: GOLANG_PKG_STATIK
|
# @ECLASS-VARIABLE: GOLANG_PKG_STATIK
|
||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
|
@ -395,7 +395,6 @@ golang_setup() {
|
||||||
export GOBIN="$_GOBIN"
|
export GOBIN="$_GOBIN"
|
||||||
export CGO_ENABLED
|
export CGO_ENABLED
|
||||||
export GOEXPERIMENT
|
export GOEXPERIMENT
|
||||||
export GO15VENDOREXPERIMENT=0
|
|
||||||
|
|
||||||
debug-print "${FUNCNAME}: GOPATH = ${GOPATH}"
|
debug-print "${FUNCNAME}: GOPATH = ${GOPATH}"
|
||||||
debug-print "${FUNCNAME}: GOBIN = ${GOBIN}"
|
debug-print "${FUNCNAME}: GOBIN = ${GOBIN}"
|
||||||
|
@ -521,7 +520,6 @@ golang-base_src_prepare() {
|
||||||
local VENDOR="${S}/vendor"
|
local VENDOR="${S}/vendor"
|
||||||
if [[ -d "${VENDOR}" ]]; then
|
if [[ -d "${VENDOR}" ]]; then
|
||||||
golang_add_vendor "${VENDOR}"
|
golang_add_vendor "${VENDOR}"
|
||||||
export GO15VENDOREXPERIMENT=1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Auto-detects the presence of Go's vendored
|
# Auto-detects the presence of Go's vendored
|
||||||
|
@ -549,7 +547,7 @@ golang-base_src_prepare() {
|
||||||
# (see github.com/tools/godep for more infos).
|
# (see github.com/tools/godep for more infos).
|
||||||
VENDOR="${S}/Godeps/_workspace"
|
VENDOR="${S}/Godeps/_workspace"
|
||||||
if [[ -d "${VENDOR}" ]]; then
|
if [[ -d "${VENDOR}" ]]; then
|
||||||
golang_add_vendor "${VENDOR}"
|
GOLANG_PKG_VENDOR+=" ${VENDOR}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
@ -678,19 +676,22 @@ golang-base_src_compile() {
|
||||||
[[ ${EGO} ]] || die "No GoLang implementation set (golang_setup not called?)."
|
[[ ${EGO} ]] || die "No GoLang implementation set (golang_setup not called?)."
|
||||||
|
|
||||||
# Populates env variable GOPATH with vendored workspaces (if present).
|
# Populates env variable GOPATH with vendored workspaces (if present).
|
||||||
if [[ -n ${GOLANG_PKG_VENDOR} ]]; then
|
if [[ -n ${GOLANG_PKG_VENDOR} || "1" == ${GO15VENDOREXPERIMENT} ]]; then
|
||||||
einfo "Using vendored dependencies from:"
|
einfo "Using vendored dependencies from:"
|
||||||
|
|
||||||
|
# Prints Go's vendored directory.
|
||||||
|
if [[ "1" == ${GO15VENDOREXPERIMENT} ]]; then
|
||||||
|
einfo "- vendor"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Prints user defined vendored directories.
|
||||||
|
if [[ -n ${GOLANG_PKG_VENDOR} ]]; then
|
||||||
for path in "${GOLANG_PKG_VENDOR[@]}"; do
|
for path in "${GOLANG_PKG_VENDOR[@]}"; do
|
||||||
[ -d ${path} ] || continue
|
[ -d ${path} ] || continue
|
||||||
|
|
||||||
if [[ ${path//${S}\//} == "vendor" ]]; then
|
|
||||||
einfo "- vendor/ (native vendoring support)"
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
debug-print "$FUNCNAME: GOPATH: Adding vendor path ${path}"
|
debug-print "$FUNCNAME: GOPATH: Adding vendor path ${path}"
|
||||||
ebegin "- ${path//${S}\//}"
|
ebegin "- ${path//${WORKDIR}\//}"
|
||||||
GOPATH="${GOPATH}:$( echo ${path} )"
|
GOPATH="${GOPATH}:$( echo ${path} )"
|
||||||
eend
|
eend
|
||||||
done
|
done
|
||||||
|
@ -831,7 +832,7 @@ golang-base_src_test() {
|
||||||
|
|
||||||
# Defines sub-packages.
|
# Defines sub-packages.
|
||||||
local EGO_SUBPACKAGES="${GOLANG_PKG_IMPORTPATH_ALIAS}/${GOLANG_PKG_NAME}${GOLANG_PKG_BUILDPATH}"
|
local EGO_SUBPACKAGES="${GOLANG_PKG_IMPORTPATH_ALIAS}/${GOLANG_PKG_NAME}${GOLANG_PKG_BUILDPATH}"
|
||||||
[[ -z ${GOLANG_PKG_IS_MULTIPLE} ]] || EGO_SUBPACKAGES="./..."
|
[[ -n ${GOLANG_PKG_IS_MULTIPLE} ]] || EGO_SUBPACKAGES="./..."
|
||||||
|
|
||||||
# Runs the unit tests.
|
# Runs the unit tests.
|
||||||
einfo "${EGO} test ${EGO_BUILD_FLAGS} ${EGO_SUBPACKAGES}"
|
einfo "${EGO} test ${EGO_BUILD_FLAGS} ${EGO_SUBPACKAGES}"
|
||||||
|
@ -900,16 +901,22 @@ golang_add_vendor() {
|
||||||
|
|
||||||
[[ ${GOLANG_VERSION} ]] || die "No Golang implementation set (golang_setup not called?)."
|
[[ ${GOLANG_VERSION} ]] || die "No Golang implementation set (golang_setup not called?)."
|
||||||
|
|
||||||
[[ ! -d "${1}" ]] && return
|
case $( get_version_component_range 1-2 ${GOLANG_VERSION} ) in
|
||||||
|
1.4*)
|
||||||
# NOTE: this hack is required by Go v1.4 and older versions.
|
# TODO: traverse $1 and expose all the bundled /vendor
|
||||||
|
# sub-directories to GOLANG_PKG_VENDOR
|
||||||
if [[ ! -d "${1}"/src ]]; then
|
if [[ ! -d "${1}"/src ]]; then
|
||||||
ebegin "Fixing $1"
|
ebegin "Fixing $1"
|
||||||
ln -s "${1}" "${1}"/src || die
|
ln -s "${1}" "${1}"/src || die
|
||||||
eend
|
eend
|
||||||
fi
|
fi
|
||||||
|
|
||||||
GOLANG_PKG_VENDOR+=(${1})
|
GOLANG_PKG_VENDOR+=" ${1}"
|
||||||
|
;;
|
||||||
|
1.5*)
|
||||||
|
export GO15VENDOREXPERIMENT=1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue