Merge pull request #1127 from marineam/etcd-2

etcd: add 2.0.4 and make which versions to install selectable at build-time
This commit is contained in:
Michael Marineau 2015-03-03 21:11:25 -08:00
commit bf6aabc230
6 changed files with 92 additions and 12 deletions

View File

@ -9,7 +9,7 @@ HOMEPAGE="http://coreos.com"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 arm x86"
IUSE=""
IUSE="etcd_protocols_1 etcd_protocols_2"
################################################################################
@ -76,8 +76,16 @@ RDEPEND="${RDEPEND}
app-editors/vim
"
# TODO(ifup):
# coreos-base/crash-reporter
# Select between versions of etcd
# If protocol 1 is installed it must be configured to provide the default
# implementation based on whether protocol 2 is enabled or not.
RDEPEND="${RDEPEND}
etcd_protocols_1? (
dev-db/etcd:1[etcd_protocols_2=]
!etcd_protocols_2? ( dev-db/etcdctl )
)
etcd_protocols_2? ( dev-db/etcd:2 )
"
RDEPEND="${RDEPEND}
app-emulation/xenstore
@ -139,8 +147,6 @@ RDEPEND="${RDEPEND}
app-misc/ca-certificates
app-crypt/gnupg
virtual/udev
dev-db/etcd
dev-db/etcdctl
net-fs/nfs-utils
net-misc/iputils
dev-vcs/git

View File

@ -0,0 +1,54 @@
#
# Copyright (c) 2014 CoreOS, Inc.. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
# $Header:$
#
EAPI=4
CROS_WORKON_PROJECT="coreos/etcd"
CROS_WORKON_LOCALNAME="etcd"
CROS_WORKON_REPO="git://github.com"
inherit coreos-doc toolchain-funcs cros-workon systemd
if [[ "${PV}" == 9999 ]]; then
KEYWORDS="~amd64"
else
CROS_WORKON_COMMIT="d6523fe4638100c72f40cb282cd1232db13f7336" # v0.4.7
KEYWORDS="amd64"
fi
DESCRIPTION="etcd"
HOMEPAGE="https://github.com/coreos/etcd"
SRC_URI=""
LICENSE="Apache-2.0"
SLOT="1"
IUSE="etcd_protocols_1 etcd_protocols_2"
# Sanity check that this version is indeed wanted!
REQUIRED_USE="etcd_protocols_${SLOT}"
DEPEND=">=dev-lang/go-1.2"
RDEPEND="!dev-db/etcd:0
!etcd_protocols_2? ( !dev-db/etcd:2 )"
src_compile() {
./build
}
src_install() {
local libexec="libexec/${PN}/internal_versions"
exeinto "/usr/${libexec}"
newexe "${S}/bin/${PN}" ${SLOT}
# protocol1 is default if protocol2 is disabled
if ! use etcd_protocols_2; then
dosym "../${libexec}/${SLOT}" /usr/bin/${PN}
systemd_dounit "${FILESDIR}"/${PN}.service
systemd_dotmpfilesd "${FILESDIR}"/${PN}.conf
coreos-dodoc -r Documentation/*
fi
}

View File

@ -1,19 +1,20 @@
#
# Copyright (c) 2014 CoreOS, Inc.. All rights reserved.
# Copyright (c) 2015 CoreOS, Inc.. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
# $Header:$
#
EAPI=4
EAPI=5
CROS_WORKON_PROJECT="coreos/etcd"
CROS_WORKON_LOCALNAME="etcd"
CROS_WORKON_REPO="git://github.com"
inherit coreos-doc toolchain-funcs cros-workon systemd
COREOS_GO_PACKAGE="github.com/coreos/etcd"
inherit coreos-doc coreos-go toolchain-funcs cros-workon systemd
if [[ "${PV}" == 9999 ]]; then
KEYWORDS="~amd64"
else
CROS_WORKON_COMMIT="d6523fe4638100c72f40cb282cd1232db13f7336" # v0.4.7
CROS_WORKON_COMMIT="1a2c6d3f2fbcb047712bfa3234bff5b9d07bdc57" # v2.0.4
KEYWORDS="amd64"
fi
@ -22,17 +23,30 @@ HOMEPAGE="https://github.com/coreos/etcd"
SRC_URI=""
LICENSE="Apache-2.0"
SLOT="0"
SLOT="2"
IUSE=""
DEPEND=">=dev-lang/go-1.2"
RDEPEND="!dev-db/etcd:0
!dev-db/etcdctl"
src_compile() {
./build
go_build "${COREOS_GO_PACKAGE}"
go_build "${COREOS_GO_PACKAGE}/etcdctl"
go_build "${COREOS_GO_PACKAGE}/tools/etcd-migrate"
go_build "${COREOS_GO_PACKAGE}/tools/etcd-dump-logs"
}
src_install() {
dobin ${S}/bin/${PN}
local libexec="libexec/${PN}/internal_versions"
dobin ${WORKDIR}/gopath/bin/etcdctl
dobin ${WORKDIR}/gopath/bin/etcd-migrate
dobin ${WORKDIR}/gopath/bin/etcd-dump-logs
exeinto "/usr/${libexec}"
newexe "${WORKDIR}/gopath/bin/${PN}" ${SLOT}
dosym "../${libexec}/${SLOT}" /usr/bin/${PN}
systemd_dounit "${FILESDIR}"/${PN}.service
systemd_dotmpfilesd "${FILESDIR}"/${PN}.conf

View File

@ -9,6 +9,12 @@
USE_EXPAND="${USE_EXPAND} BOARD_USE CROS_WORKON_TREE TESTS U_BOOT_CONFIG_USE U_BOOT_FDT_USE"
USE_EXPAND_HIDDEN="${USE_EXPAND_HIDDEN} CROS_WORKON_TREE"
# Support selecting between different etcd versions. This must be done
# via use flags because if two versions are installed one must provide
# the "default" /usr/bin/etcd binary and systemd services.
USE_EXPAND="${USE_EXPAND} ETCD_PROTOCOLS"
ETCD_PROTOCOLS="1"
# Extra use flags for CoreOS SDK
USE="${USE} cros_host expat -introspection -cups -tcpd -pcre -berkdb"