Gentoo Archives: gentoo-commits

From: Patrick Lauer <patrick@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-misc/kafka-bin/, net-misc/kafka-bin/files/
Date: Sun, 27 Aug 2017 14:28:40
Message-Id: 1503844110.5936105745bb3683b77b7f45a6732d4cc2c76146.patrick@gentoo
1 commit: 5936105745bb3683b77b7f45a6732d4cc2c76146
2 Author: Patrick Lauer <patrick <AT> gentoo <DOT> org>
3 AuthorDate: Sun Aug 27 14:28:05 2017 +0000
4 Commit: Patrick Lauer <patrick <AT> gentoo <DOT> org>
5 CommitDate: Sun Aug 27 14:28:30 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=59361057
7
8 net-misc/kafka-bin: Improve init script
9
10 Package-Manager: Portage-2.3.6, Repoman-2.3.3
11
12 net-misc/kafka-bin/files/kafka.init.d.2 | 22 +++++++++
13 net-misc/kafka-bin/kafka-bin-0.10.2.1-r1.ebuild | 62 +++++++++++++++++++++++++
14 net-misc/kafka-bin/kafka-bin-0.11.0.0-r1.ebuild | 62 +++++++++++++++++++++++++
15 3 files changed, 146 insertions(+)
16
17 diff --git a/net-misc/kafka-bin/files/kafka.init.d.2 b/net-misc/kafka-bin/files/kafka.init.d.2
18 new file mode 100755
19 index 00000000000..87b4b47a446
20 --- /dev/null
21 +++ b/net-misc/kafka-bin/files/kafka.init.d.2
22 @@ -0,0 +1,22 @@
23 +#!/sbin/openrc-run
24 +# Copyright 1999-2017 Gentoo Foundation
25 +# Distributed under the terms of the GNU General Public License v2
26 +
27 +description="Kafka distributed messaging system"
28 +
29 +logfile="/var/log/kafka/kafka.log"
30 +
31 +command="/opt/kafka/bin/kafka-server-start.sh"
32 +command_args="/etc/kafka/server.properties"
33 +
34 +command_background=yes
35 +pidfile=/run/kafka.pid
36 +
37 +start() {
38 + start-stop-daemon --start --background --user kafka --chdir /opt/kafka --stdout $logfile --stderr $logfile \
39 + --env KAFKA_HEAP_OPTS="${KAFKA_HEAP_OPTS}" \
40 + --pidfile $pidfile --exec /opt/kafka/bin/kafka-server-start.sh -- /etc/kafka/server.properties
41 +}
42 +depend() {
43 + after zookeeper kafka-zookeeper
44 +}
45
46 diff --git a/net-misc/kafka-bin/kafka-bin-0.10.2.1-r1.ebuild b/net-misc/kafka-bin/kafka-bin-0.10.2.1-r1.ebuild
47 new file mode 100644
48 index 00000000000..36e9ed9e938
49 --- /dev/null
50 +++ b/net-misc/kafka-bin/kafka-bin-0.10.2.1-r1.ebuild
51 @@ -0,0 +1,62 @@
52 +# Copyright 1999-2017 Gentoo Foundation
53 +# Distributed under the terms of the GNU General Public License v2
54 +
55 +EAPI=5
56 +
57 +inherit eutils user
58 +
59 +DESCRIPTION="A high-throughput distributed messaging system"
60 +HOMEPAGE="http://kafka.apache.org/"
61 +
62 +# pick recommended scala version
63 +SCALA_VERSION=2.12
64 +MY_PN="kafka"
65 +MY_P="${MY_PN}_${SCALA_VERSION}-${PV}"
66 +SRC_URI="mirror://apache/kafka/${PV}/${MY_P}.tgz"
67 +
68 +RESTRICT="mirror"
69 +
70 +LICENSE="Apache-2.0"
71 +SLOT="0"
72 +KEYWORDS="~amd64 ~x86"
73 +IUSE="internal-zookeeper"
74 +
75 +RDEPEND="
76 + || ( virtual/jre:1.8 virtual/jre:1.7 )
77 +"
78 +DEPEND="${RDEPEND}"
79 +
80 +S="${WORKDIR}/${MY_P}"
81 +INSTALL_DIR="/opt/${MY_PN}"
82 +
83 +pkg_setup() {
84 + enewgroup kafka
85 + enewuser kafka -1 /bin/sh /var/lib/kafka kafka
86 +}
87 +
88 +src_prepare() {
89 + sed -i -e 's:/tmp/zookeeper:/var/lib/kafka/zookeeper:' "config/zookeeper.properties" || die
90 + sed -i -e 's:/tmp/kafka-logs:/var/lib/kafka/logs:' "config/server.properties" || die
91 +}
92 +
93 +src_install() {
94 + insinto /etc/kafka
95 + doins config/zookeeper.properties config/server.properties
96 + if use "internal-zookeeper"; then
97 + keepdir /var/lib/kafka/zookeeper
98 + newinitd "${FILESDIR}/${MY_PN}-zookeeper.init.d" "${MY_PN}-zookeeper"
99 + fi
100 +
101 + keepdir /var/lib/kafka
102 + fowners -R kafka:kafka /var/lib/kafka
103 +
104 + keepdir /var/log/kafka
105 + fowners -R kafka:kafka /var/log/kafka
106 +
107 + newinitd "${FILESDIR}/${MY_PN}.init.d.2" "${MY_PN}"
108 +
109 + dodir "${INSTALL_DIR}"
110 + cp -pRP bin config libs "${ED}/${INSTALL_DIR}" || die
111 + keepdir "${INSTALL_DIR}/logs"
112 + fowners -R kafka:kafka "${INSTALL_DIR}"
113 +}
114
115 diff --git a/net-misc/kafka-bin/kafka-bin-0.11.0.0-r1.ebuild b/net-misc/kafka-bin/kafka-bin-0.11.0.0-r1.ebuild
116 new file mode 100644
117 index 00000000000..36e9ed9e938
118 --- /dev/null
119 +++ b/net-misc/kafka-bin/kafka-bin-0.11.0.0-r1.ebuild
120 @@ -0,0 +1,62 @@
121 +# Copyright 1999-2017 Gentoo Foundation
122 +# Distributed under the terms of the GNU General Public License v2
123 +
124 +EAPI=5
125 +
126 +inherit eutils user
127 +
128 +DESCRIPTION="A high-throughput distributed messaging system"
129 +HOMEPAGE="http://kafka.apache.org/"
130 +
131 +# pick recommended scala version
132 +SCALA_VERSION=2.12
133 +MY_PN="kafka"
134 +MY_P="${MY_PN}_${SCALA_VERSION}-${PV}"
135 +SRC_URI="mirror://apache/kafka/${PV}/${MY_P}.tgz"
136 +
137 +RESTRICT="mirror"
138 +
139 +LICENSE="Apache-2.0"
140 +SLOT="0"
141 +KEYWORDS="~amd64 ~x86"
142 +IUSE="internal-zookeeper"
143 +
144 +RDEPEND="
145 + || ( virtual/jre:1.8 virtual/jre:1.7 )
146 +"
147 +DEPEND="${RDEPEND}"
148 +
149 +S="${WORKDIR}/${MY_P}"
150 +INSTALL_DIR="/opt/${MY_PN}"
151 +
152 +pkg_setup() {
153 + enewgroup kafka
154 + enewuser kafka -1 /bin/sh /var/lib/kafka kafka
155 +}
156 +
157 +src_prepare() {
158 + sed -i -e 's:/tmp/zookeeper:/var/lib/kafka/zookeeper:' "config/zookeeper.properties" || die
159 + sed -i -e 's:/tmp/kafka-logs:/var/lib/kafka/logs:' "config/server.properties" || die
160 +}
161 +
162 +src_install() {
163 + insinto /etc/kafka
164 + doins config/zookeeper.properties config/server.properties
165 + if use "internal-zookeeper"; then
166 + keepdir /var/lib/kafka/zookeeper
167 + newinitd "${FILESDIR}/${MY_PN}-zookeeper.init.d" "${MY_PN}-zookeeper"
168 + fi
169 +
170 + keepdir /var/lib/kafka
171 + fowners -R kafka:kafka /var/lib/kafka
172 +
173 + keepdir /var/log/kafka
174 + fowners -R kafka:kafka /var/log/kafka
175 +
176 + newinitd "${FILESDIR}/${MY_PN}.init.d.2" "${MY_PN}"
177 +
178 + dodir "${INSTALL_DIR}"
179 + cp -pRP bin config libs "${ED}/${INSTALL_DIR}" || die
180 + keepdir "${INSTALL_DIR}/logs"
181 + fowners -R kafka:kafka "${INSTALL_DIR}"
182 +}