From 4d8273532802e91f7805f1c7885fcd36d4c98bff Mon Sep 17 00:00:00 2001 From: Geoff Levand Date: Thu, 14 May 2015 15:41:59 -0700 Subject: [PATCH 1/5] eclass/coreos-go: Enhance error messages Signed-off-by: Geoff Levand --- .../coreos-overlay/eclass/coreos-go.eclass | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sdk_container/src/third_party/coreos-overlay/eclass/coreos-go.eclass b/sdk_container/src/third_party/coreos-overlay/eclass/coreos-go.eclass index 5280b424df..becaa6dadc 100644 --- a/sdk_container/src/third_party/coreos-overlay/eclass/coreos-go.eclass +++ b/sdk_container/src/third_party/coreos-overlay/eclass/coreos-go.eclass @@ -9,7 +9,7 @@ # @DESCRIPTION: # Name of the Go package unpacked to ${S}, this is required. -[[ ${EAPI} != "5" ]] && die "Only EAPI=5 is supported" +[[ ${EAPI} != "5" ]] && die "${ECLASS}: Only EAPI=5 is supported" inherit flag-o-matic multiprocessing toolchain-funcs @@ -20,14 +20,14 @@ DEPEND="dev-lang/go" go_build() { debug-print-function ${FUNCNAME} "$@" - [[ $# -eq 0 || $# -gt 2 ]] && die "go_install: incorrect # of arguments" + [[ $# -eq 0 || $# -gt 2 ]] && die "${ECLASS}: go_install: incorrect # of arguments" local package_name="$1" local binary_name="${package_name##*/}" go build -x -p "$(makeopts_jobs)" \ -ldflags "-extldflags '${LDFLAGS}'" \ -o "${GOPATH}/bin/${binary_name}" "${package_name}" \ - || die "go build failed" + || die "${ECLASS}: go build failed" } coreos-go_src_prepare() { @@ -35,15 +35,15 @@ coreos-go_src_prepare() { export GOPATH="${WORKDIR}/gopath" export GOBIN="${GOPATH}/bin" - mkdir -p "${GOBIN}" || die + mkdir -p "${GOBIN}" || die "${ECLASS}: bad path: ${GOBIN}" if [[ -z "${COREOS_GO_PACKAGE}" ]]; then - die "COREOS_GO_PACKAGE must be defined by the ebuild" + die "${ECLASS}: COREOS_GO_PACKAGE must be defined by the ebuild" fi local package_path="${GOPATH}/src/${COREOS_GO_PACKAGE}" - mkdir -p "${package_path%/*}" || die - ln -sT "${S}" "${package_path}" || die + mkdir -p "${package_path%/*}" || die "${ECLASS}: bad path: ${package_path%/*}" + ln -sT "${S}" "${package_path}" || die "${ECLASS}: bad path: ${S}" # Go's 6l linker does not support PIE, disable so cgo binaries # which use 6l+gcc for linking can be built correctly. From a0e4791518966e580d743b1c725069f1bd72c169 Mon Sep 17 00:00:00 2001 From: Geoff Levand Date: Thu, 14 May 2015 15:41:59 -0700 Subject: [PATCH 2/5] eclass/coreos-go: Add cross build support To support golang cross builds add a new function go_get_arch() for ebuilds to use as needed. Also update coreos-go_src_prepare() to set the go compiler environment variable GOARCH to the result of go_get_arch(). The setting of GOARCH will cause the compiler to generate the correct binary type for the board. Signed-off-by: Geoff Levand --- .../src/third_party/coreos-overlay/eclass/coreos-go.eclass | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sdk_container/src/third_party/coreos-overlay/eclass/coreos-go.eclass b/sdk_container/src/third_party/coreos-overlay/eclass/coreos-go.eclass index becaa6dadc..4130c130b2 100644 --- a/sdk_container/src/third_party/coreos-overlay/eclass/coreos-go.eclass +++ b/sdk_container/src/third_party/coreos-overlay/eclass/coreos-go.eclass @@ -15,6 +15,12 @@ inherit flag-o-matic multiprocessing toolchain-funcs DEPEND="dev-lang/go" +# @FUNCTION: go_get_arch +# @USAGE: export GOARCH=$(go_get_arch) +go_get_arch() { + echo ${ARCH} +} + # @FUNCTION: go_build # @USAGE: [] go_build() { @@ -33,6 +39,7 @@ go_build() { coreos-go_src_prepare() { debug-print-function ${FUNCNAME} "$@" + export GOARCH=$(go_get_arch) export GOPATH="${WORKDIR}/gopath" export GOBIN="${GOPATH}/bin" mkdir -p "${GOBIN}" || die "${ECLASS}: bad path: ${GOBIN}" From 5c126c74d3145079a486eaf7a0b0518356223b83 Mon Sep 17 00:00:00 2001 From: Geoff Levand Date: Thu, 14 May 2015 15:41:59 -0700 Subject: [PATCH 3/5] app-admin/sdnotify-proxy: Fix description Signed-off-by: Geoff Levand --- .../app-admin/sdnotify-proxy/sdnotify-proxy-9999.ebuild | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk_container/src/third_party/coreos-overlay/app-admin/sdnotify-proxy/sdnotify-proxy-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/app-admin/sdnotify-proxy/sdnotify-proxy-9999.ebuild index 94e9ae1add..e97c42d972 100644 --- a/sdk_container/src/third_party/coreos-overlay/app-admin/sdnotify-proxy/sdnotify-proxy-9999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/app-admin/sdnotify-proxy/sdnotify-proxy-9999.ebuild @@ -15,7 +15,7 @@ fi inherit cros-workon -DESCRIPTION="fleet" +DESCRIPTION="sdnotify-proxy" HOMEPAGE="https://github.com/coreos/sdnotify-proxy" SRC_URI="" From f997ce7533866802b5cfa666297ed5e9c17e822b Mon Sep 17 00:00:00 2001 From: Geoff Levand Date: Thu, 14 May 2015 15:41:59 -0700 Subject: [PATCH 4/5] app-admin/sdnotify-proxy: Update to use coreos-go.eclass Signed-off-by: Geoff Levand --- .../sdnotify-proxy/sdnotify-proxy-9999.ebuild | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sdk_container/src/third_party/coreos-overlay/app-admin/sdnotify-proxy/sdnotify-proxy-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/app-admin/sdnotify-proxy/sdnotify-proxy-9999.ebuild index e97c42d972..309b160c3a 100644 --- a/sdk_container/src/third_party/coreos-overlay/app-admin/sdnotify-proxy/sdnotify-proxy-9999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/app-admin/sdnotify-proxy/sdnotify-proxy-9999.ebuild @@ -1,10 +1,12 @@ # Copyright (c) 2014 CoreOS, Inc.. All rights reserved. # Distributed under the terms of the GNU General Public License v2 -EAPI=4 +EAPI=5 CROS_WORKON_PROJECT="coreos/sdnotify-proxy" CROS_WORKON_LOCALNAME="sdnotify-proxy" CROS_WORKON_REPO="git://github.com" +COREOS_GO_PACKAGE="github.com/coreos/sdnotify-proxy" +inherit coreos-go cros-workon if [[ "${PV}" == 9999 ]]; then KEYWORDS="~amd64" @@ -13,8 +15,6 @@ else KEYWORDS="amd64" fi -inherit cros-workon - DESCRIPTION="sdnotify-proxy" HOMEPAGE="https://github.com/coreos/sdnotify-proxy" SRC_URI="" @@ -26,10 +26,10 @@ IUSE="" DEPEND=">=dev-lang/go-1.3" src_compile() { - ./build + go_build "${COREOS_GO_PACKAGE}" } src_install() { exeinto /usr/libexec - doexe ${S}/bin/sdnotify-proxy + doexe ${GOBIN}/sdnotify-proxy } From 24f039f5d516dc16fce52053283f19eefe69c706 Mon Sep 17 00:00:00 2001 From: Geoff Levand Date: Thu, 14 May 2015 15:41:59 -0700 Subject: [PATCH 5/5] app-admin/sdnotify-proxy: Add arm64 keywords Signed-off-by: Geoff Levand --- ...tify-proxy-0.1.0.ebuild => sdnotify-proxy-0.1.0-r1.ebuild} | 0 .../app-admin/sdnotify-proxy/sdnotify-proxy-9999.ebuild | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename sdk_container/src/third_party/coreos-overlay/app-admin/sdnotify-proxy/{sdnotify-proxy-0.1.0.ebuild => sdnotify-proxy-0.1.0-r1.ebuild} (100%) diff --git a/sdk_container/src/third_party/coreos-overlay/app-admin/sdnotify-proxy/sdnotify-proxy-0.1.0.ebuild b/sdk_container/src/third_party/coreos-overlay/app-admin/sdnotify-proxy/sdnotify-proxy-0.1.0-r1.ebuild similarity index 100% rename from sdk_container/src/third_party/coreos-overlay/app-admin/sdnotify-proxy/sdnotify-proxy-0.1.0.ebuild rename to sdk_container/src/third_party/coreos-overlay/app-admin/sdnotify-proxy/sdnotify-proxy-0.1.0-r1.ebuild diff --git a/sdk_container/src/third_party/coreos-overlay/app-admin/sdnotify-proxy/sdnotify-proxy-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/app-admin/sdnotify-proxy/sdnotify-proxy-9999.ebuild index 309b160c3a..c41bf27495 100644 --- a/sdk_container/src/third_party/coreos-overlay/app-admin/sdnotify-proxy/sdnotify-proxy-9999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/app-admin/sdnotify-proxy/sdnotify-proxy-9999.ebuild @@ -9,10 +9,10 @@ COREOS_GO_PACKAGE="github.com/coreos/sdnotify-proxy" inherit coreos-go cros-workon if [[ "${PV}" == 9999 ]]; then - KEYWORDS="~amd64" + KEYWORDS="~amd64 ~arm64" else CROS_WORKON_COMMIT="f516129af110fd4a51bd5ea2654f4dc8dd02e5c4" - KEYWORDS="amd64" + KEYWORDS="amd64 arm64" fi DESCRIPTION="sdnotify-proxy"