From b19a21acf1c4227e411316f2560b2e9b3b7f0160 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Thu, 25 Aug 2016 12:27:19 -0700 Subject: [PATCH 1/8] coreos-go-utils: new eclass for Go related utilities This eclass adopts parts of coreos-go.eclass and the dev-lang/go ebuilds, providing functionality useful to both types of builds. --- .../containerd/containerd-0.2.3.ebuild | 2 +- .../runc/runc-1.0.0_rc1_p20160615-r1.ebuild | 2 +- .../eclass/coreos-go-utils.eclass | 116 ++++++++++++++++++ .../coreos-overlay/eclass/coreos-go.eclass | 36 +----- 4 files changed, 124 insertions(+), 32 deletions(-) create mode 100644 sdk_container/src/third_party/coreos-overlay/eclass/coreos-go-utils.eclass diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/containerd/containerd-0.2.3.ebuild b/sdk_container/src/third_party/coreos-overlay/app-emulation/containerd/containerd-0.2.3.ebuild index 9e685da1b4..462a6c2109 100644 --- a/sdk_container/src/third_party/coreos-overlay/app-emulation/containerd/containerd-0.2.3.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/containerd/containerd-0.2.3.ebuild @@ -32,7 +32,7 @@ RDEPEND="app-emulation/runc S=${WORKDIR}/${P}/src/${EGO_PN} src_compile() { - export GOARCH=$(go_get_arch) + export GOARCH=$(go_arch) export CGO_ENABLED=1 export CC=$(tc-getCC) export CXX=$(tc-getCXX) diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/runc/runc-1.0.0_rc1_p20160615-r1.ebuild b/sdk_container/src/third_party/coreos-overlay/app-emulation/runc/runc-1.0.0_rc1_p20160615-r1.ebuild index d87ae79698..cffab21a0b 100644 --- a/sdk_container/src/third_party/coreos-overlay/app-emulation/runc/runc-1.0.0_rc1_p20160615-r1.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/runc/runc-1.0.0_rc1_p20160615-r1.ebuild @@ -34,7 +34,7 @@ src_prepare() { src_compile() { # fix up cross-compiling variables - export GOARCH=$(go_get_arch) + export GOARCH=$(go_arch) export CGO_ENABLED=1 export CC=$(tc-getCC) export CXX=$(tc-getCXX) diff --git a/sdk_container/src/third_party/coreos-overlay/eclass/coreos-go-utils.eclass b/sdk_container/src/third_party/coreos-overlay/eclass/coreos-go-utils.eclass new file mode 100644 index 0000000000..5131e5d716 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/eclass/coreos-go-utils.eclass @@ -0,0 +1,116 @@ +# Copyright 2016 CoreOS, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +# @ECLASS: coreos-go-utils.eclass +# @BLURB: Utility functions for Go +# @DESCRIPTION: +# A utility eclass for functions needed when building both Go itself +# and packages that depend on it. It does not set any metadata. + +case "${EAPI:-0}" in + 5|6) ;; + *) die "Unsupported EAPI=${EAPI} for ${ECLASS}" +esac + +inherit flag-o-matic toolchain-funcs + +# @FUNCTION: go_arch +# @USAGE: [chost] +# @DESCRIPTION: +# export GOARCH=$(go_arch $CHOST) +go_arch() { + # By chance most portage arch names match Go + local portage_arch=$(tc-arch "${1:-${CHOST}}") + local endian=$(tc-endian "${1:-${CHOST}}") + case "${portage_arch}" in + x86) echo 386;; + x64-*) echo amd64;; + ppc64) + [[ "${endian}" = big ]] && echo ppc64 || echo ppc64le ;; + *) echo "${portage_arch}";; + esac +} + +# @FUNCTION: go_arm +# @USAGE: [chost] +# @DESCRIPTION: +# export GOARM=$(go_arm $CHOST) +go_arm() { + case "${1:-${CHOST}}" in + armv5*) echo 5;; + armv6*) echo 6;; + armv7*) echo 7;; + *) + die "unknown GOARM for ${1:-${CHOST}}" + ;; + esac +} + +# @FUNCTION: go_os +# @USAGE: [chost] +# @DESCRIPTION: +# export GOOS=$(go_os $CHOST) +go_os() { + case "${1:-${CHOST}}" in + *-linux*) echo linux;; + *-darwin*) echo darwin;; + *-freebsd*) echo freebsd;; + *-netbsd*) echo netbsd;; + *-openbsd*) echo openbsd;; + *-solaris*) echo solaris;; + *-cygwin*|*-interix*|*-winnt*) + echo windows + ;; + *) + die "unknown GOOS for ${1:-${CHOST}}" + ;; + esac +} + +# @FUNCTION: go_export +# @USAGE: [chost] +# @DESCRIPTION: +# Export GOARCH, GOOS, GOARM, CC, CXX, and CGO_* environment variables. +go_export() { + export GOARCH=$(go_arch "$@") + export GOOS=$(go_os "$@") + if [[ "${GOARCH}" == "arm" ]]; then + export GOARM=$(go_arm "$@") + fi + + # Go's 6l linker does not support PIE, disable so cgo binaries + # which use 6l+gcc for linking can be built correctly. + if gcc-specs-pie; then + append-ldflags -nopie + fi + + export CC=$(tc-getCC) + export CXX=$(tc-getCXX) + export CGO_ENABLED=${CGO_ENABLED:-1} + export CGO_CFLAGS="${CFLAGS}" + export CGO_CPPFLAGS="${CPPFLAGS}" + export CGO_CXXFLAGS="${CXXFLAGS}" + export CGO_LDFLAGS="${LDFLAGS}" +} + +# @FUNCTION: go_tuple +# @USAGE: [chost] +# @DESCRIPTION: +# The uniqe string defining a Go target, as used in directory names. +# e.g. linux_amd64 for x86_64-pc-linux-gnu +go_tuple() +{ + echo "$(go_os $@)_$(go_arch $@)" +} + +# @FUNCTION: go_cross_compile +# @USAGE: [chost] +# @DESCRIPTION: +# Check if Go consideres compiling for $CHOST as cross-compilation. +# Since Go's target tuples are smaller than GCC's Go may not consider +# itself as a cross-compiler even if the GCC it is using for cgo is. +go_cross_compile() +{ + [[ $(go_tuple ${CBUILD:-${CHOST}}) != $(go_tuple $@) ]] +} 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 12f0428d71..aa22af7077 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,26 +9,15 @@ # @DESCRIPTION: # Name of the Go package unpacked to ${S}, this is required. -[[ ${EAPI} != "5" ]] && die "${ECLASS}: Only EAPI=5 is supported" +case "${EAPI:-0}" in + 5|6) ;; + *) die "Unsupported EAPI=${EAPI} for ${ECLASS}" +esac -inherit flag-o-matic multiprocessing toolchain-funcs +inherit coreos-go-utils multiprocessing DEPEND="dev-lang/go:=" -# @FUNCTION: go_get_arch -# @USAGE: export GOARCH=$(go_get_arch) -go_get_arch() { - # By chance most portage arch names match Go - local portage_arch=$(tc-arch ${CHOST}) - case "${portage_arch}" in - x86) echo 386;; - x64-*) echo amd64;; - ppc64) - [[ "$(tc-endian)" = big ]] && echo ppc64 || echo ppc64le ;; - *) echo "${portage_arch}";; - esac -} - # @FUNCTION: go_build # @USAGE: [] go_build() { @@ -55,7 +44,7 @@ go_build() { coreos-go_src_prepare() { debug-print-function ${FUNCNAME} "$@" - export GOARCH=$(go_get_arch) + go_export export GOPATH="${WORKDIR}/gopath" export GOBIN="${GOPATH}/bin" @@ -68,19 +57,6 @@ coreos-go_src_prepare() { local package_path="${GOPATH}/src/${COREOS_GO_PACKAGE}" 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. - if gcc-specs-pie; then - append-ldflags -nopie - fi - - export CC=$(tc-getCC) - export CGO_ENABLED=${CGO_ENABLED:-1} - export CGO_CFLAGS="${CFLAGS}" - export CGO_CPPFLAGS="${CPPFLAGS}" - export CGO_CXXFLAGS="${CXXFLAGS}" - export CGO_LDFLAGS="${LDFLAGS}" } coreos-go_src_compile() { From 7b7f712298ed929cdc3cfd2e86587ca4f6be9c81 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Wed, 31 Aug 2016 14:17:18 -0700 Subject: [PATCH 2/8] coreos-go-depend: use flags to indicate what version of Go is used --- .../eclass/coreos-go-depend.eclass | 30 +++++++++++++++++++ .../coreos-overlay/eclass/coreos-go.eclass | 22 +++++++++++--- .../profiles/coreos/base/make.defaults | 4 +++ 3 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 sdk_container/src/third_party/coreos-overlay/eclass/coreos-go-depend.eclass diff --git a/sdk_container/src/third_party/coreos-overlay/eclass/coreos-go-depend.eclass b/sdk_container/src/third_party/coreos-overlay/eclass/coreos-go-depend.eclass new file mode 100644 index 0000000000..eb471b5875 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/eclass/coreos-go-depend.eclass @@ -0,0 +1,30 @@ +# Copyright 2016 CoreOS, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +# @ECLASS: coreos-go-depend.eclass +# @BLURB: Minimal Go eclass for simply depending on Go. + +# @ECLASS-VARIABLE: COREOS_GO_VERSION +# @DESCRIPTION: +# This variable specifies the version of Go to use. If ommitted the +# default value below will be used. +# +# Example: +# @CODE +# COREOS_GO_VERSION=go1.5 +# @CODE +export COREOS_GO_VERSION="${COREOS_GO_VERSION:-go1.6}" + +case "${EAPI:-0}" in + 5|6) ;; + *) die "Unsupported EAPI=${EAPI} for ${ECLASS}" +esac + +inherit coreos-go-utils + +# Set a use flag to indicate what version of Go is being used ensure +# the package gets rebuilt when the version changes. +IUSE="+go_version_${COREOS_GO_VERSION//./_}" +REQUIRED_USE="go_version_${COREOS_GO_VERSION//./_}" +DEPEND="dev-lang/go-${COREOS_GO_VERSION#go}*:=" 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 aa22af7077..ea348e80f3 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 @@ -6,17 +6,31 @@ # @BLURB: utility functions for building Go binaries # @ECLASS-VARIABLE: COREOS_GO_PACKAGE +# @REQUIRED # @DESCRIPTION: -# Name of the Go package unpacked to ${S}, this is required. +# Name of the Go package unpacked to ${S}. +# +# Example: +# @CODE +# COREOS_GO_PACKAGE="github.com/coreos/mantle" +# @CODE + +# @ECLASS-VARIABLE: COREOS_GO_VERSION +# @DESCRIPTION: +# This variable specifies the version of Go to use. If ommitted the +# default value from coreos-go-depend.eclass will be used. +# +# Example: +# @CODE +# COREOS_GO_VERSION=go1.5 +# @CODE case "${EAPI:-0}" in 5|6) ;; *) die "Unsupported EAPI=${EAPI} for ${ECLASS}" esac -inherit coreos-go-utils multiprocessing - -DEPEND="dev-lang/go:=" +inherit coreos-go-depend multiprocessing # @FUNCTION: go_build # @USAGE: [] diff --git a/sdk_container/src/third_party/coreos-overlay/profiles/coreos/base/make.defaults b/sdk_container/src/third_party/coreos-overlay/profiles/coreos/base/make.defaults index c66eb2699a..880324bd61 100644 --- a/sdk_container/src/third_party/coreos-overlay/profiles/coreos/base/make.defaults +++ b/sdk_container/src/third_party/coreos-overlay/profiles/coreos/base/make.defaults @@ -15,6 +15,10 @@ USE_EXPAND_HIDDEN="${USE_EXPAND_HIDDEN} CROS_WORKON_TREE" USE_EXPAND="${USE_EXPAND} ETCD_PROTOCOLS" ETCD_PROTOCOLS="1 2" +# Use go_version_* flags to indicate which major version was used. +# For now this is only informational and set by coreos-go.eclass +USE_EXPAND="${USE_EXPAND} GO_VERSION" + # Extra use flags for CoreOS SDK USE="${USE} cros_host expat -introspection -cups -tcpd -berkdb" From 4150be487c4ed4a2641badb805c3f26a5b06fa61 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Wed, 31 Aug 2016 15:43:05 -0700 Subject: [PATCH 3/8] app-emulation/rkt: migrate to coreos-go-depend eclass --- .../app-emulation/rkt/rkt-9999.ebuild | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/rkt/rkt-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/app-emulation/rkt/rkt-9999.ebuild index afca4a02d5..1f684c4e8e 100644 --- a/sdk_container/src/third_party/coreos-overlay/app-emulation/rkt/rkt-9999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/rkt/rkt-9999.ebuild @@ -8,7 +8,7 @@ AUTOTOOLS_AUTORECONF=yes AUTOTOOLS_IN_SOURCE_BUILD=yes inherit autotools-utils flag-o-matic systemd toolchain-funcs multilib -inherit cros-workon +inherit cros-workon coreos-go-depend CROS_WORKON_PROJECT="coreos/rkt" CROS_WORKON_LOCALNAME="rkt" @@ -47,8 +47,7 @@ REQUIRED_USE="|| ( rkt_stage1_coreos rkt_stage1_fly rkt_stage1_host rkt_stage1_s COMMON_DEPEND="sys-apps/acl tpm? ( app-crypt/trousers )" -DEPEND="|| ( ~dev-lang/go-1.4.3:= >=dev-lang/go-1.5.3:= ) - app-arch/cpio +DEPEND="app-arch/cpio sys-fs/squashfs-tools dev-perl/Capture-Tiny rkt_stage1_src? ( @@ -113,18 +112,7 @@ src_configure() { myeconfargs+=( --with-stage1-flavors="${STAGE1FLAVORS}" ) myeconfargs+=( --with-stage1-default-location="${STAGE1INSTALLDIR}/stage1-${STAGE1FIRST}.aci" ) - # Go's 6l linker does not support PIE, disable so cgo binaries - # which use 6l+gcc for linking can be built correctly. - if gcc-specs-pie; then - append-ldflags -nopie - fi - - export CC=$(tc-getCC) - export CGO_ENABLED=1 - export CGO_CFLAGS="${CFLAGS}" - export CGO_CPPFLAGS="${CPPFLAGS}" - export CGO_CXXFLAGS="${CXXFLAGS}" - export CGO_LDFLAGS="${LDFLAGS}" + go_export export BUILDDIR export V=1 From 9b831ddf4e20e3187276196da46fda1df559e9b7 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Wed, 31 Aug 2016 15:43:13 -0700 Subject: [PATCH 4/8] app-emulation/docker: migrate to coreos-go-depend eclass --- .../containerd/containerd-0.2.3.ebuild | 24 ++++++---------- .../app-emulation/docker/docker-9999.ebuild | 19 ++----------- .../runc/runc-1.0.0_rc1_p20160615-r1.ebuild | 28 ++++++------------- 3 files changed, 21 insertions(+), 50 deletions(-) diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/containerd/containerd-0.2.3.ebuild b/sdk_container/src/third_party/coreos-overlay/app-emulation/containerd/containerd-0.2.3.ebuild index 462a6c2109..9d98182cea 100644 --- a/sdk_container/src/third_party/coreos-overlay/app-emulation/containerd/containerd-0.2.3.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/containerd/containerd-0.2.3.ebuild @@ -3,17 +3,20 @@ # $Id$ EAPI=5 -EGO_PN="github.com/docker/${PN}" -COREOS_GO_PACKAGE="${EGO_PN}" + +GITHUB_URI="github.com/docker/${PN}" +COREOS_GO_PACKAGE="${GITHUB_URI}" +COREOS_GO_VERSION="go1.6" if [[ ${PV} == *9999 ]]; then - inherit golang-vcs + EGIT_REPO_URI="https://${GITHUB_URI}.git" + inherit git-r3 else MY_PV="${PV/_/-}" EGIT_COMMIT="v${MY_PV}" SRC_URI="https://${EGO_PN}/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz" KEYWORDS="amd64 arm64" - inherit golang-vcs-snapshot + inherit vcs-snapshot fi inherit coreos-go @@ -29,20 +32,11 @@ DEPEND="" RDEPEND="app-emulation/runc seccomp? ( sys-libs/libseccomp )" -S=${WORKDIR}/${P}/src/${EGO_PN} - src_compile() { - export GOARCH=$(go_arch) - export CGO_ENABLED=1 - export CC=$(tc-getCC) - export CXX=$(tc-getCXX) - - local options=( $(usex seccomp "seccomp") ) - export GOPATH="${WORKDIR}/${P}" # ${PWD}/vendor - LDFLAGS= emake GIT_COMMIT="$EGIT_COMMIT" BUILDTAGS="${options[@]}" + local options=( $(usev seccomp) ) + LDFLAGS= emake GIT_COMMIT="$EGIT_COMMIT" BUILDTAGS="${options[*]}" } src_install() { dobin bin/containerd* bin/ctr } - diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/docker/docker-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/app-emulation/docker/docker-9999.ebuild index a871ca8e7c..fb35d17e49 100644 --- a/sdk_container/src/third_party/coreos-overlay/app-emulation/docker/docker-9999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/docker/docker-9999.ebuild @@ -7,6 +7,7 @@ EAPI=5 CROS_WORKON_PROJECT="coreos/docker" CROS_WORKON_LOCALNAME="docker" CROS_WORKON_REPO="git://github.com" +COREOS_GO_VERSION="go1.6" if [[ ${PV} == *9999 ]]; then DOCKER_GITCOMMIT="unknown" @@ -17,7 +18,7 @@ else KEYWORDS="amd64 arm64" fi -inherit bash-completion-r1 eutils linux-info multilib systemd udev user cros-workon +inherit bash-completion-r1 eutils linux-info multilib systemd udev user cros-workon coreos-go-depend DESCRIPTION="Docker complements kernel namespacing with a high-level API which operates at the process level" HOMEPAGE="https://dockerproject.org" @@ -43,8 +44,6 @@ CDEPEND=" DEPEND=" ${CDEPEND} - dev-lang/go:= - btrfs? ( >=sys-fs/btrfs-progs-3.16.1 ) @@ -205,20 +204,11 @@ src_prepare() { rm --recursive --force .git } -go_get_arch() { - echo ${ARCH} -} - src_compile() { # if we treat them right, Docker's build scripts will set up a # reasonable GOPATH for us export AUTO_GOPATH=1 - # setup CFLAGS and LDFLAGS for separate build target - # see https://github.com/tianon/docker-overlay/pull/10 - export CGO_CFLAGS="-I${ROOT}/usr/include" - export CGO_LDFLAGS="-L${ROOT}/usr/$(get_libdir)" - # if we're building from a zip, we need the GITCOMMIT value [ "$DOCKER_GITCOMMIT" ] && export DOCKER_GITCOMMIT @@ -262,10 +252,7 @@ src_compile() { unset DOCKER_EXPERIMENTAL fi - export GOARCH=$(go_get_arch) - export CGO_ENABLED=1 - export CC=$(tc-getCC) - export CXX=$(tc-getCXX) + go_export # verbose building export BUILDFLAGS="-x -v" diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/runc/runc-1.0.0_rc1_p20160615-r1.ebuild b/sdk_container/src/third_party/coreos-overlay/app-emulation/runc/runc-1.0.0_rc1_p20160615-r1.ebuild index cffab21a0b..8bc6fbc74d 100644 --- a/sdk_container/src/third_party/coreos-overlay/app-emulation/runc/runc-1.0.0_rc1_p20160615-r1.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/runc/runc-1.0.0_rc1_p20160615-r1.ebuild @@ -6,11 +6,12 @@ EAPI=5 GITHUB_URI="github.com/opencontainers/runc" COREOS_GO_PACKAGE="${GITHUB_URI}" +COREOS_GO_VERSION="go1.6" # the commit of runc that docker uses. # see https://github.com/docker/docker/blob/v1.12.0/Dockerfile#L236 COMMIT_ID="cc29e3dded8e27ba8f65738f40d251c885030a28" -inherit eutils multilib coreos-go vcs-snapshot +inherit eutils flag-o-matic coreos-go-depend vcs-snapshot DESCRIPTION="runc container cli tools" HOMEPAGE="http://runc.io" @@ -30,29 +31,18 @@ RDEPEND=" src_prepare() { epatch "${FILESDIR}/0001-Makefile-do-not-install-dependencies-of-target.patch" + # Work around https://github.com/golang/go/issues/14669 + # Remove after updating to go1.7 + filter-flags -O* + + go_export } src_compile() { - # fix up cross-compiling variables - export GOARCH=$(go_arch) - export CGO_ENABLED=1 - export CC=$(tc-getCC) - export CXX=$(tc-getCXX) - - # Taken from app-emulation/docker-1.7.0-r1 - export CGO_CFLAGS="-I${ROOT}/usr/include" - export CGO_LDFLAGS="-L${ROOT}/usr/$(get_libdir)" - - # Setup GOPATH so things build - rm -rf .gopath - mkdir -p .gopath/src/"$(dirname "${GITHUB_URI}")" - ln -sf ../../../.. .gopath/src/"${GITHUB_URI}" - export GOPATH="${PWD}/.gopath:${PWD}/vendor" - # build up optional flags local options=( - $(usex apparmor 'apparmor') - $(usex seccomp 'seccomp') + $(usev apparmor) + $(usev seccomp) ) emake BUILDTAGS="${options[*]}" From c71370263967b180cc5602a8d5c5dddd9c543eb0 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Wed, 31 Aug 2016 11:15:36 -0700 Subject: [PATCH 5/8] app-eselect/eselect-go: manage multiple versions of Go --- .../app-eselect/eselect-go/Manifest | 1 + .../eselect-go/eselect-go-0.1.0.ebuild | 36 +++++++++++++++++++ .../app-eselect/eselect-go/metadata.xml | 9 +++++ 3 files changed, 46 insertions(+) create mode 100644 sdk_container/src/third_party/coreos-overlay/app-eselect/eselect-go/Manifest create mode 100644 sdk_container/src/third_party/coreos-overlay/app-eselect/eselect-go/eselect-go-0.1.0.ebuild create mode 100644 sdk_container/src/third_party/coreos-overlay/app-eselect/eselect-go/metadata.xml diff --git a/sdk_container/src/third_party/coreos-overlay/app-eselect/eselect-go/Manifest b/sdk_container/src/third_party/coreos-overlay/app-eselect/eselect-go/Manifest new file mode 100644 index 0000000000..1fed1134a7 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/app-eselect/eselect-go/Manifest @@ -0,0 +1 @@ +DIST eselect-go-0.1.0.tar.gz 104232 SHA256 541de8bc7b77d93f070f907f17760bb30dc3fa8244216d565fcdfb58ab04381b SHA512 b7e9bf07bc7026115d639ed893c54332d63cd2d7a46a6f3b2f8a6748658dfb82f09e875def8bf9abecfb1e39f054ef194b39b0c415ac9ce69ea03332125d4c1f WHIRLPOOL 77996759041eea27f169eadab48f122e55ec11886e851d583ebdd0cf667500d7ca45a62a9edfb99400cc69cbd936887ddface15e7c81d2b301ba111c53123a6a diff --git a/sdk_container/src/third_party/coreos-overlay/app-eselect/eselect-go/eselect-go-0.1.0.ebuild b/sdk_container/src/third_party/coreos-overlay/app-eselect/eselect-go/eselect-go-0.1.0.ebuild new file mode 100644 index 0000000000..b2478f5963 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/app-eselect/eselect-go/eselect-go-0.1.0.ebuild @@ -0,0 +1,36 @@ +# Copyright 2016 CoreOS, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=6 + +DESCRIPTION="Eselect module for managing multiple Go versions" +HOMEPAGE="https://github.com/coreos/eselect-go" +SRC_URI="${HOMEPAGE}/releases/download/v${PV}/${P}.tar.gz" +# Note for future releases: the tarball was generated via `make dist` and +# uploaded to GitHub so there is no need for initializing autotools here. + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="amd64 arm64" +IUSE="test" + +DEPEND="test? ( dev-libs/glib )" +RDEPEND="app-admin/eselect + !dev-lang/go:0" + +src_configure() { + # Go is installed to /usr/lib, not /usr/lib64 + econf --libdir=/usr/lib +} + +src_install() { + keepdir /etc/env.d/go + default +} + +pkg_postinst() { + if has_version 'dev-lang/go'; then + eselect go update --if-unset + fi +} diff --git a/sdk_container/src/third_party/coreos-overlay/app-eselect/eselect-go/metadata.xml b/sdk_container/src/third_party/coreos-overlay/app-eselect/eselect-go/metadata.xml new file mode 100644 index 0000000000..5b46f1713c --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/app-eselect/eselect-go/metadata.xml @@ -0,0 +1,9 @@ + + + + + This tool is intended for use in the CoreOS SDK in order to support + packages or architectures that cannot upgrade to the same Go version + all at the same time. Gentoo doesn't support this use case. + + From bf0b8b13d4d2e3c26a4b38537ccfadf245404d24 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Wed, 31 Aug 2016 17:12:06 -0700 Subject: [PATCH 6/8] dev-lang/go: remove 1.4.3 --- .../coreos-overlay/dev-lang/go/Manifest | 1 - .../dev-lang/go/go-1.4.3.ebuild | 121 ------------------ 2 files changed, 122 deletions(-) delete mode 100644 sdk_container/src/third_party/coreos-overlay/dev-lang/go/go-1.4.3.ebuild diff --git a/sdk_container/src/third_party/coreos-overlay/dev-lang/go/Manifest b/sdk_container/src/third_party/coreos-overlay/dev-lang/go/Manifest index 9ea13baa97..2376583c91 100644 --- a/sdk_container/src/third_party/coreos-overlay/dev-lang/go/Manifest +++ b/sdk_container/src/third_party/coreos-overlay/dev-lang/go/Manifest @@ -1,3 +1,2 @@ -DIST go1.4.3.src.tar.gz 10875170 SHA256 9947fc705b0b841b5938c48b22dc33e9647ec0752bae66e50278df4f23f64959 SHA512 12bade4bce9aa4b34e2b9495ae65a1fc6a2449b3a43bc4de85c8b87ba223c2f999b2f37c1e2fe1188d8521118b5e5357d27afb8b85c0b8ebb4503d4125d25273 WHIRLPOOL 1a869385e63343bc54a950ca965a4d11ca072e6551d1189ef4e2e4da2a488a1ef70b59296d65af0c061f63606b78f73399f25040e02132e56a00189f1aae20e3 DIST go1.5.4.src.tar.gz 12059752 SHA256 002acabce7ddc140d0d55891f9d4fcfbdd806b9332fb8b110c91bc91afb0bc93 SHA512 bff8ad4e792fb92c382327d080f2383e623d39d474317d9b3132167707ced99b7b4866c9ab315b6479eb75891d146b3d71dc0f5a4e81a509090b3205684409ed WHIRLPOOL cd14fc92e513a1ef0882c0dfb28526fa5f8044b99935c7e022b9ca0c10190c8f8a8fb3cb251db280168cfbc00a2a2f25761dfac9b274aa37d2d66bb03360da6f DIST go1.6.3.src.tar.gz 12617426 SHA256 6326aeed5f86cf18f16d6dc831405614f855e2d416a91fd3fdc334f772345b00 SHA512 43e9b01220788112a185500bd53f091e7a0023a790092f428e2f40fc1a334dd148558b99d2a1c871b8cc79ad7d2d87a092b93eee7b5a27c2ee675c494de35306 WHIRLPOOL 0a22dc08b89ddfaccf1e871037e7ad6cdbf36f914de527011813d57a2d857478278202314b185e26aa905cb135d13cbea490d03337b42148c6fc2ef93a8cd9fe diff --git a/sdk_container/src/third_party/coreos-overlay/dev-lang/go/go-1.4.3.ebuild b/sdk_container/src/third_party/coreos-overlay/dev-lang/go/go-1.4.3.ebuild deleted file mode 100644 index cf5950be65..0000000000 --- a/sdk_container/src/third_party/coreos-overlay/dev-lang/go/go-1.4.3.ebuild +++ /dev/null @@ -1,121 +0,0 @@ -# Copyright 1999-2015 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/go/go-1.4.2.ebuild,v 1.3 2015/04/08 12:57:46 zlogene Exp $ - -EAPI=5 - -export CTARGET=${CTARGET:-${CHOST}} - -inherit eutils toolchain-funcs - -if [[ ${PV} = 9999 ]]; then - EGIT_REPO_URI="git://github.com/golang/go.git" - inherit git-r3 -else - SRC_URI="https://storage.googleapis.com/golang/go${PV}.src.tar.gz" - # Upstream only supports go on amd64, arm and x86 architectures. - KEYWORDS="-* amd64 ~arm x86 ~amd64-fbsd ~x86-fbsd ~x64-macos ~x86-macos" -fi - -DESCRIPTION="A concurrent garbage collected and typesafe programming language" -HOMEPAGE="http://www.golang.org" - -LICENSE="BSD" -SLOT="0" -IUSE="" - -DEPEND="" -RDEPEND="" - -# The tools in /usr/lib/go should not cause the multilib-strict check to fail. -QA_MULTILIB_PATHS="usr/lib/go/pkg/tool/.*/.*" - -# The go language uses *.a files which are _NOT_ libraries and should not be -# stripped. -STRIP_MASK="/usr/lib/go/pkg/linux*/*.a /usr/lib/go/pkg/freebsd*/*.a /usr/lib/go/pkg/darwin*/*.a" - -if [[ ${PV} != 9999 ]]; then - S="${WORKDIR}"/go -fi - -src_prepare() -{ - if [[ ${PV} != 9999 ]]; then - sed -i -e 's#"-Werror",##g' src/cmd/dist/build.c || - die "sed failed" - fi - epatch_user -} - -src_compile() -{ - export GOROOT_FINAL="${EPREFIX}"/usr/lib/go - export GOROOT="$(pwd)" - export GOBIN="${GOROOT}/bin" - if [[ $CTARGET = armv5* ]] - then - export GOARM=5 - fi - tc-export CC - - cd src - ./make.bash || die "build failed" -} - -src_test() -{ - cd src - PATH="${GOBIN}:${PATH}" \ - ./run.bash --no-rebuild --banner || die "tests failed" -} - -src_install() -{ - dobin bin/* - dodoc AUTHORS CONTRIBUTORS PATENTS README - - dodir /usr/lib/go - insinto /usr/lib/go - - # There is a known issue which requires the source tree to be installed [1]. - # Once this is fixed, we can consider using the doc use flag to control - # installing the doc and src directories. - # [1] https://golang.org/issue/2775 - doins -r doc include lib pkg src - fperms -R +x /usr/lib/go/pkg/tool -} - -pkg_preinst() -{ - has_version ' Date: Wed, 31 Aug 2016 10:46:35 -0700 Subject: [PATCH 7/8] dev-lang/go: support installing multiple Go versions in parallel --- ...ld => hard-host-depends-0.0.1-r179.ebuild} | 0 .../hard-host-depends-0.0.1.ebuild | 2 +- .../dev-lang/go/go-1.5.4-r1.ebuild | 227 ------------------ .../dev-lang/go/go-1.5.4-r2.ebuild | 9 + .../dev-lang/go/go-1.6.3-r1.ebuild | 9 + .../dev-lang/go/go-1.6.3.ebuild | 1 - .../coreos-overlay/dev-lang/go/go-9999.ebuild | 227 ------------------ .../eclass/coreos-go-depend.eclass | 2 +- .../eclass/coreos-go-lang.eclass | 123 ++++++++++ .../eclass/coreos-go-utils.eclass | 3 + .../coreos-overlay/eclass/coreos-go.eclass | 6 +- 11 files changed, 149 insertions(+), 460 deletions(-) rename sdk_container/src/third_party/coreos-overlay/coreos-base/hard-host-depends/{hard-host-depends-0.0.1-r178.ebuild => hard-host-depends-0.0.1-r179.ebuild} (100%) delete mode 100644 sdk_container/src/third_party/coreos-overlay/dev-lang/go/go-1.5.4-r1.ebuild create mode 100644 sdk_container/src/third_party/coreos-overlay/dev-lang/go/go-1.5.4-r2.ebuild create mode 100644 sdk_container/src/third_party/coreos-overlay/dev-lang/go/go-1.6.3-r1.ebuild delete mode 120000 sdk_container/src/third_party/coreos-overlay/dev-lang/go/go-1.6.3.ebuild delete mode 100644 sdk_container/src/third_party/coreos-overlay/dev-lang/go/go-9999.ebuild create mode 100644 sdk_container/src/third_party/coreos-overlay/eclass/coreos-go-lang.eclass diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/hard-host-depends/hard-host-depends-0.0.1-r178.ebuild b/sdk_container/src/third_party/coreos-overlay/coreos-base/hard-host-depends/hard-host-depends-0.0.1-r179.ebuild similarity index 100% rename from sdk_container/src/third_party/coreos-overlay/coreos-base/hard-host-depends/hard-host-depends-0.0.1-r178.ebuild rename to sdk_container/src/third_party/coreos-overlay/coreos-base/hard-host-depends/hard-host-depends-0.0.1-r179.ebuild diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/hard-host-depends/hard-host-depends-0.0.1.ebuild b/sdk_container/src/third_party/coreos-overlay/coreos-base/hard-host-depends/hard-host-depends-0.0.1.ebuild index bccb396356..43ea52f54e 100644 --- a/sdk_container/src/third_party/coreos-overlay/coreos-base/hard-host-depends/hard-host-depends-0.0.1.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/hard-host-depends/hard-host-depends-0.0.1.ebuild @@ -43,7 +43,7 @@ RDEPEND="${RDEPEND} dev-lang/nasm dev-lang/swig dev-lang/yasm - dev-lang/go + dev-lang/go:1.6 dev-lang/go-bootstrap dev-libs/dbus-glib >=dev-libs/glib-2.26.1 diff --git a/sdk_container/src/third_party/coreos-overlay/dev-lang/go/go-1.5.4-r1.ebuild b/sdk_container/src/third_party/coreos-overlay/dev-lang/go/go-1.5.4-r1.ebuild deleted file mode 100644 index 17054a4e26..0000000000 --- a/sdk_container/src/third_party/coreos-overlay/dev-lang/go/go-1.5.4-r1.ebuild +++ /dev/null @@ -1,227 +0,0 @@ -# Copyright 1999-2015 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -EAPI=5 - -export CBUILD=${CBUILD:-${CHOST}} -export CTARGET=${CTARGET:-${CHOST}} - -inherit eutils toolchain-funcs - -if [[ ${PV} = 9999 ]]; then - EGIT_REPO_URI="git://github.com/golang/go.git" - inherit git-r3 -else - SRC_URI="https://storage.googleapis.com/golang/go${PV}.src.tar.gz" - # arm64 only works when cross-compiling in the SDK - KEYWORDS="-* amd64 ~arm arm64 ~x86 ~amd64-fbsd ~x86-fbsd ~x64-macos ~x86-macos" -fi - -DESCRIPTION="A concurrent garbage collected and typesafe programming language" -HOMEPAGE="http://www.golang.org" - -LICENSE="BSD" -SLOT="0/${PV}" -IUSE="cros_host arm64-extras" - -# can't build go without go -DEPEND=">=dev-lang/go-bootstrap-1.5.3" -RDEPEND="" - -# These test data objects have writable/executable stacks. -QA_EXECSTACK="usr/lib/go/src/debug/elf/testdata/*.obj" - -# The tools in /usr/lib/go should not cause the multilib-strict check to fail. -QA_MULTILIB_PATHS="usr/lib/go/pkg/tool/.*/.*" - -# The go language uses *.a files which are _NOT_ libraries and should not be -# stripped. The test data objects should also be left alone and unstripped. -STRIP_MASK="/usr/lib/go/pkg/*.a - /usr/lib/go/src/debug/elf/testdata/* - /usr/lib/go/src/debug/dwarf/testdata/* - /usr/lib/go/src/runtime/race/*.syso" - -if use cros_host && use arm64-extras; then - STRIP_MASK+="/usr/lib/go/pkg/tool/linux_arm64/*" -fi - -if [[ ${PV} != 9999 ]]; then - S="${WORKDIR}"/go -fi - -go_arch() -{ - # By chance most portage arch names match Go - local portage_arch=$(tc-arch $@) - case "${portage_arch}" in - x86) echo 386;; - x64-*) echo amd64;; - *) echo "${portage_arch}";; - esac -} - -go_arm() -{ - case "${1:-${CHOST}}" in - armv5*) echo 5;; - armv6*) echo 6;; - armv7*) echo 7;; - *) - die "unknown GOARM for ${1:-${CHOST}}" - ;; - esac -} - -go_os() -{ - case "${1:-${CHOST}}" in - *-linux*) echo linux;; - *-darwin*) echo darwin;; - *-freebsd*) echo freebsd;; - *-netbsd*) echo netbsd;; - *-openbsd*) echo openbsd;; - *-solaris*) echo solaris;; - *-cygwin*|*-interix*|*-winnt*) - echo windows - ;; - *) - die "unknown GOOS for ${1:-${CHOST}}" - ;; - esac -} - -go_tuple() -{ - echo "$(go_os $@)_$(go_arch $@)" -} - -go_cross_compile() -{ - [[ $(go_tuple ${CBUILD}) != $(go_tuple) ]] -} - -pkg_pretend() -{ - # make.bash does not understand cross-compiling a cross-compiler - if [[ $(go_tuple) != $(go_tuple ${CTARGET}) ]]; then - die "CHOST CTARGET pair unsupported: CHOST=${CHOST} CTARGET=${CTARGET}" - fi -} - -src_prepare() -{ - epatch_user -} - -src_compile() -{ - export GOROOT_BOOTSTRAP="${EPREFIX}"/usr/lib/go-bootstrap - export GOROOT_FINAL="${EPREFIX}"/usr/lib/go - export GOROOT="$(pwd)" - export GOBIN="${GOROOT}/bin" - - # Go's build script does not use BUILD/HOST/TARGET consistently. :( - export GOHOSTARCH=$(go_arch ${CBUILD}) - export GOHOSTOS=$(go_os ${CBUILD}) - export CC=$(tc-getBUILD_CC) - export GOOS=$(go_os) - - cd src - - # Build the target support first. - if use cros_host && use arm64-extras; then - export GOARCH="arm64" - export CC_FOR_TARGET="aarch64-cros-linux-gnu-gcc" - export CXX_FOR_TARGET="aarch64-cros-linux-gnu-g++" - ebegin "Building for GOARCH=${GOARCH}..." - ./make.bash --no-clean --no-test - eend $? "Build for GOARCH=${GOARCH} failed." || die - fi - - # Build the host last to get the correct settings in the go environment. - export GOARCH=$(go_arch) - export CC_FOR_TARGET=$(tc-getCC) - export CXX_FOR_TARGET=$(tc-getCXX) - if [[ ${ARCH} == arm ]]; then - export GOARM=$(go_arm) - fi - ebegin "Building for GOARCH=${GOARCH}..." - ./make.bash --no-clean --no-test - eend $? "Build for GOARCH=${GOARCH} failed." || die -} - -src_test() -{ - go_cross_compile && return 0 - - cd src - PATH="${GOBIN}:${PATH}" \ - ./run.bash -no-rebuild || die "tests failed" -} - -src_install() -{ - local bin_path="${GOBIN}" - if go_cross_compile; then - bin_path="${GOBIN}/$(go_tuple)" - fi - dobin "${bin_path}"/go "${bin_path}"/gofmt - dodoc AUTHORS CONTRIBUTORS PATENTS README.md - - dodir /usr/lib/go /usr/lib/go/pkg /usr/lib/go/pkg/tool - insinto /usr/lib/go - - # There is a known issue which requires the source tree to be installed [1]. - # Once this is fixed, we can consider using the doc use flag to control - # installing the doc and src directories. - # [1] https://golang.org/issue/2775 - doins -r doc lib src - - # Selectively install pkg directory to exclude the bootstrap build - insinto /usr/lib/go/pkg - doins -r pkg/include "pkg/$(go_tuple)" - insinto /usr/lib/go/pkg/tool - doins -r "pkg/tool/$(go_tuple)" - fperms -R +x /usr/lib/go/pkg/tool - - if use cros_host && use arm64-extras; then - insinto /usr/lib/go/pkg - doins -r pkg/linux_arm64 - fi -} - -pkg_preinst() -{ - has_version ' Date: Wed, 31 Aug 2016 11:56:03 -0700 Subject: [PATCH 8/8] dev-lang/go: add 1.7, marked ~arch for now --- .../src/third_party/coreos-overlay/dev-lang/go/Manifest | 1 + .../third_party/coreos-overlay/dev-lang/go/go-1.7.ebuild | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 sdk_container/src/third_party/coreos-overlay/dev-lang/go/go-1.7.ebuild diff --git a/sdk_container/src/third_party/coreos-overlay/dev-lang/go/Manifest b/sdk_container/src/third_party/coreos-overlay/dev-lang/go/Manifest index 2376583c91..969b5423b8 100644 --- a/sdk_container/src/third_party/coreos-overlay/dev-lang/go/Manifest +++ b/sdk_container/src/third_party/coreos-overlay/dev-lang/go/Manifest @@ -1,2 +1,3 @@ DIST go1.5.4.src.tar.gz 12059752 SHA256 002acabce7ddc140d0d55891f9d4fcfbdd806b9332fb8b110c91bc91afb0bc93 SHA512 bff8ad4e792fb92c382327d080f2383e623d39d474317d9b3132167707ced99b7b4866c9ab315b6479eb75891d146b3d71dc0f5a4e81a509090b3205684409ed WHIRLPOOL cd14fc92e513a1ef0882c0dfb28526fa5f8044b99935c7e022b9ca0c10190c8f8a8fb3cb251db280168cfbc00a2a2f25761dfac9b274aa37d2d66bb03360da6f DIST go1.6.3.src.tar.gz 12617426 SHA256 6326aeed5f86cf18f16d6dc831405614f855e2d416a91fd3fdc334f772345b00 SHA512 43e9b01220788112a185500bd53f091e7a0023a790092f428e2f40fc1a334dd148558b99d2a1c871b8cc79ad7d2d87a092b93eee7b5a27c2ee675c494de35306 WHIRLPOOL 0a22dc08b89ddfaccf1e871037e7ad6cdbf36f914de527011813d57a2d857478278202314b185e26aa905cb135d13cbea490d03337b42148c6fc2ef93a8cd9fe +DIST go1.7.src.tar.gz 14091954 SHA256 72680c16ba0891fcf2ccf46d0f809e4ecf47bbf889f5d884ccb54c5e9a17e1c0 SHA512 a9cd1279927ca50e083dcf6d5a4bcb3bff6a156b3555608334a41be9613b5002dd71caafa472aae6210b01a6cdbd6aa6a55b8882a8e4bda68a5ffd10a3ae1d14 WHIRLPOOL 77121f84e04e7266f46934c9350f7fe216aa8376fb9ac06602a4b7bf16ed6b3595dbbffc7289b5223e47a9e52980f381183bdeddf34b858d21bb0918a94d7e4e diff --git a/sdk_container/src/third_party/coreos-overlay/dev-lang/go/go-1.7.ebuild b/sdk_container/src/third_party/coreos-overlay/dev-lang/go/go-1.7.ebuild new file mode 100644 index 0000000000..7252b0aaa3 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/dev-lang/go/go-1.7.ebuild @@ -0,0 +1,9 @@ +# Copyright 2016 CoreOS, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=6 + +inherit coreos-go-lang + +KEYWORDS="-* ~amd64 ~arm64"