blob: 8f6e4bd484fb66b95e51ef526d03909bb249fee2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=5
PYTHON_COMPAT=( python2_7 )
inherit distutils-r1 eutils java-utils-2 user
MY_P="zookeeper"
MY_PN=${MY_P}-${PV}
DESCRIPTION="A high-performance coordination service for distributed applications."
HOMEPAGE="http://zookeeper.apache.org/"
SRC_URI="mirror://apache/${MY_P}/${MY_PN}/${MY_PN}.tar.gz"
LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~amd64 ~x86"
RESTRICT="mirror binchecks"
IUSE=""
DEPEND=""
RDEPEND=">=virtual/jre-1.7"
S=${WORKDIR}/${MY_PN}
INSTALL_DIR=/opt/${PN}
export CONFIG_PROTECT="${CONFIG_PROTECT} ${INSTALL_DIR}/conf"
pkg_setup() {
enewgroup zookeeper
enewuser zookeeper -1 /bin/sh /var/lib/zookeeper zookeeper
}
src_prepare() {
# python
sed -e "s|src/c/zookeeper.c|zookeeper.c|g" \
-e "s|../../../|${S}|g" \
-i contrib/zkpython/src/python/setup.py || die
}
src_configure() {
cd "${S}"/src/c || die
econf
}
src_compile() {
cd "${S}"/src/c || die
emake
}
src_install() {
local DATA_DIR=/var/lib/${MY_P}
# python
cd "${S}"/contrib/zkpython/ || die
mv src/python/setup.py .
mv src/c/* .
python_foreach_impl distutils-r1_src_install
cd "${S}" || die
# cleanup sources
rm -rf src/ || die
rm bin/*.cmd || die
keepdir "${DATA_DIR}"
sed "s:^dataDir=.*:dataDir=${DATA_DIR}:" conf/zoo_sample.cfg > conf/zoo.cfg || die "sed failed"
cp "${FILESDIR}"/log4j.properties conf/ || die "cp log4j conf failed"
dodir "${INSTALL_DIR}"
cp -a "${S}"/* "${D}${INSTALL_DIR}" || die "install failed"
# data dir perms
fowners zookeeper:zookeeper "${DATA_DIR}"
# log dir
keepdir /var/log/zookeeper
fowners zookeeper:zookeeper /var/log/zookeeper
# init script
newinitd "${FILESDIR}"/zookeeper.initd zookeeper
newconfd "${FILESDIR}"/zookeeper.confd zookeeper
# env file
cat > 99"${PN}" <<-EOF
PATH=${INSTALL_DIR}/bin
CONFIG_PROTECT=${INSTALL_DIR}/conf
EOF
doenvd 99"${PN}"
}
|