Gentoo Archives: gentoo-commits

From: Alexys Jacob <ultrabug@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] dev/ultrabug:master commit in: dev-db/rethinkdb/files/, dev-db/rethinkdb/
Date: Thu, 26 May 2016 08:43:17
Message-Id: 1464252174.ec82ed4b6f46718748dd6881c4217f40c791ff4c.ultrabug@gentoo
1 commit: ec82ed4b6f46718748dd6881c4217f40c791ff4c
2 Author: Ultrabug <ultrabug <AT> gentoo <DOT> org>
3 AuthorDate: Thu May 26 08:42:39 2016 +0000
4 Commit: Alexys Jacob <ultrabug <AT> gentoo <DOT> org>
5 CommitDate: Thu May 26 08:42:54 2016 +0000
6 URL: https://gitweb.gentoo.org/dev/ultrabug.git/commit/?id=ec82ed4b
7
8 improved rethinkdb ebuild with enhanced config from bgo overlay
9
10 dev-db/rethinkdb/Manifest | 6 ++-
11 dev-db/rethinkdb/files/rethinkdb.initd | 13 ++---
12 dev-db/rethinkdb/files/rethinkdb.service | 13 +++++
13 dev-db/rethinkdb/files/rethinkdb.tmpfilesd | 1 +
14 dev-db/rethinkdb/rethinkdb-2.3.2.ebuild | 80 ++++++++++++++++++++++--------
15 5 files changed, 85 insertions(+), 28 deletions(-)
16
17 diff --git a/dev-db/rethinkdb/Manifest b/dev-db/rethinkdb/Manifest
18 index 9a67776..eacf098 100644
19 --- a/dev-db/rethinkdb/Manifest
20 +++ b/dev-db/rethinkdb/Manifest
21 @@ -1,5 +1,7 @@
22 AUX rethinkdb.confd 606 SHA256 5d659a409a7b1a502a6362b818b01c1eb5f12e1bed273e9e876cc43758464659 SHA512 3a07f9c78ef96b2ca37fca508ee14a644d3c08612f662ba5260182fbfcceba064d20253f1261f56dc0a2c28d1a4d5e2320872c3c4e7595cb7ab4e202eb28ad42 WHIRLPOOL 2598d32113314f60b9e64048ba148c6fb3653ab92f833da13cc58b080996b988a20a61b8821634889c735628421609cee36c88dede66d89d5de071011a7afc57
23 -AUX rethinkdb.initd 1593 SHA256 9583d3acc484ed0ecf169b6b9c397bbfac0307c0cedc078c354db8aaecc8d7ff SHA512 d28c056076b180344bbd5751ff233e6de9a0c8fe4631297f5968806aa7ce46113702393600454f3b59bda48af7dd84679466cc0934b7773b601287c6ab7ce8b0 WHIRLPOOL 106d5d0785b87310515400e86d680ce7421ce2e999508a6fe04ed2f45dc0e317dda8d2ffabd2d44b92b673cd9730e044a2802b267cb53422cde7aad9a25616b7
24 +AUX rethinkdb.initd 1651 SHA256 3203f6ea1bfa5a124bdb8ef9ea282de69c82402b5875cf8ab987f9810fa69699 SHA512 6f232b05539dde1a8aef86837d4a2df1b1d5152f4c1cb7dd88f6b9d6c4f1f40c37f908e2d01aade5fe296b389db9b5a4b409a147caa6223a98b35e419bb36dd5 WHIRLPOOL 0001a9933b15c0b7d87ce8f6c190695cd855a6c99a2cee92e70745aed2fdef41415c277a78d400d2457e54cf38a61501cc9ffb836db6740b6aa3a1288375aa65
25 +AUX rethinkdb.service 261 SHA256 c831f179b0973ea5abb205a5aae3f4597d09bc7575f3a75fa6db5c32fce5f5ee SHA512 70389797ae79481b7d47b45f1676bd0531bc830a2f2daf7baec87533a7a6a0e67177572bab7d42324fe719f8a056899babc5ab2358a679c6a59899ed1272374b WHIRLPOOL 7e0259a1678a216a44ee1b64df65ad8c3d653887a392ed371b027f17fa91cc9cb1f315fdce4071e8c1403e9af7891d772089f85fb9291981fdbca08ed3e46b6a
26 +AUX rethinkdb.tmpfilesd 43 SHA256 656d3a42e75d087e723f71aa320fdd91cbbb82071ef72eb11fd3e4a619b429a4 SHA512 5996f72b8e08aac80285373e8e1b5a664177e9d0e8d13e5638c6b821fe5b7a0368001fbfa9ef3f6709dabf0616abcabea40adc4808d176572f8f99b7a3255bae WHIRLPOOL 84ff192ff84922155cfacb26e8f9255d506c0733472d5b674ea61e1c2f805a0293da0f69622d52bd21b2822dcaaf3a641c2ec39321283af0b3f00b0fb37ba2c9
27 DIST rethinkdb-2.3.2.tgz 76823279 SHA256 af8760271c63496fdeaa8de8bae834febd4b6c09a57743570b30134e9837eaac SHA512 da10c2fdcdb25a8af1dff9c42892b68e31a26f412b3af94d15da1532aec6a747a1f7044d4f42ea1f03334ebb48d1e7ef597a975d5bb96c65294b30018ff27e07 WHIRLPOOL 3ee3c6247d479cbaf0ee303d3ae8c8d4de2cf831db50e0fb8c2276844b0b8b75933a90b83cef95854cfddd00614f2660727bce1e2221077b0dccff56c84a4044
28 -EBUILD rethinkdb-2.3.2.ebuild 2038 SHA256 d8c491c0d550731aa0719db6254657e337898429fb771f50a77bbf6081eeba4c SHA512 cea5bb6081e73c1115ba490e561bd8d6070538ddf61c6b60ebbec42f350cffc099510782480c93a1677819ce53fed3316f2f1cd1621ef159ddb1155a84dd90fd WHIRLPOOL 65047f36384b57cc21a3583cd6d002ef23ff453155d4a55835a2698ac477294b56617d3f7a7a995962946205b6bf10ca9a4e9db2773176f18be370f6286c0896
29 +EBUILD rethinkdb-2.3.2.ebuild 3552 SHA256 8042c3f9edf9099b01129313c643825a94967ad7aab1af7110f37ac190307347 SHA512 eef329014252903ad23da08fbd288361b3dd430834f403ccd4084c6079dd8f0b305eefedb6635d63dc25ad39e1901ceec6db9e58ac416fc15e91e4ef743e8efd WHIRLPOOL bacc0c204aded02440baff9be7277985232db7ef242b8ed046a47932d6133f33be77032dfd21461f4b680c4fc367c0b64f4088bed400b36a90e2d18604b39619
30 MISC metadata.xml 471 SHA256 65cad98fab9a780924012debe5906d7bab5831317aa4af2b37862a861b3f5bfa SHA512 1fa850b4f60828a41d5a752813a78008f90771041e033f0bc74e899f9e23e61710f500fcb2cd4f34c8f10905d6d660b7dc75c1eb9b95892966a3b45f5b21f517 WHIRLPOOL 59d2b047291daf85464529164a1e41e1fd70d14282488d53a91a57ff43913293c75d1253119a7000d7f1cd19fee9925d0755acd9e617dac770722bfa51c31994
31
32 diff --git a/dev-db/rethinkdb/files/rethinkdb.initd b/dev-db/rethinkdb/files/rethinkdb.initd
33 index 4073181..429f041 100644
34 --- a/dev-db/rethinkdb/files/rethinkdb.initd
35 +++ b/dev-db/rethinkdb/files/rethinkdb.initd
36 @@ -1,15 +1,16 @@
37 #!/sbin/runscript
38 -# Copyright 1999-2015 Gentoo Foundation
39 +# Copyright 1999-2016 Gentoo Foundation
40 # Distributed under the terms of the GNU General Public License v2
41 # $Id$
42
43 -config_file=${config_file:-/etc/rethinkdb/instances.d/${SVCNAME}.conf}
44 +instance_name=${SVCNAME/*.}
45 +config_file=${config_file:-/etc/rethinkdb/instances.d/${instance_name}.conf}
46 run_dir=${run_dir:-/run/rethinkdb}
47
48 command="/usr/bin/rethinkdb"
49 command_args="--config-file ${config_file}"
50 command_background="true"
51 -pidfile=${run_dir}/${SVCNAME}.pid
52 +pidfile=${run_dir}/${instance_name}.pid
53 user=${user:-rethinkdb}
54 group=${group:-rethinkdb}
55 start_stop_daemon_args="--user ${user} --group ${group} --wait 2000"
56 @@ -20,7 +21,7 @@ depend() {
57
58 start_pre() {
59 checkpath -d -m 0750 -o "${user}":"${group}" "${run_dir}"
60 - if [ "${SVCNAME}" == "rethinkdb" ]; then
61 + if [ "${instance_name}" == "rethinkdb" ]; then
62 eerror "You should not run this default init script directly"
63 eerror "Create a symlink to an instance name"
64 eerror "and create a configuration file in /etc/rethinkdb/instances.d/"
65 @@ -34,7 +35,7 @@ start_pre() {
66 # respect configured directory or set a default
67 directory=$(egrep -e '^directory=' "${config_file}" | cut -d'=' -f2)
68 if [ -z "${directory}" ]; then
69 - directory=/var/lib/rethinkdb/instances.d/"${SVCNAME}"
70 + directory=/var/lib/rethinkdb/instances.d/"${instance_name}"
71 fi
72 checkpath -d -m 0750 -o "${user}":"${group}" "${directory}"
73 command_args="${command_args} --directory ${directory}"
74 @@ -42,7 +43,7 @@ start_pre() {
75 # respect configured log-file or set a default
76 log_file=$(egrep -e '^log_file=' "${config_file}" | cut -d'=' -f2)
77 if [ -z "${log_file}" ]; then
78 - log_file=/var/log/rethinkdb/"${SVCNAME}".log
79 + log_file=/var/log/rethinkdb/"${instance_name}".log
80 fi
81 command_args="${command_args} --log-file ${log_file}"
82 fi
83
84 diff --git a/dev-db/rethinkdb/files/rethinkdb.service b/dev-db/rethinkdb/files/rethinkdb.service
85 new file mode 100644
86 index 0000000..09645c2
87 --- /dev/null
88 +++ b/dev-db/rethinkdb/files/rethinkdb.service
89 @@ -0,0 +1,13 @@
90 +[Unit]
91 +Description=RethinkDB database server for instance '%i'
92 +
93 +[Service]
94 +User=rethinkdb
95 +Group=rethinkdb
96 +ExecStart=/usr/bin/rethinkdb serve --config-file /etc/rethinkdb/instances.d/%i.conf
97 +KillMode=process
98 +PrivateTmp=true
99 +
100 +[Install]
101 +WantedBy=multi-user.target
102 +
103
104 diff --git a/dev-db/rethinkdb/files/rethinkdb.tmpfilesd b/dev-db/rethinkdb/files/rethinkdb.tmpfilesd
105 new file mode 100644
106 index 0000000..694501e
107 --- /dev/null
108 +++ b/dev-db/rethinkdb/files/rethinkdb.tmpfilesd
109 @@ -0,0 +1 @@
110 +d /run/rethinkdb 0755 rethinkdb rethinkdb -
111 \ No newline at end of file
112
113 diff --git a/dev-db/rethinkdb/rethinkdb-2.3.2.ebuild b/dev-db/rethinkdb/rethinkdb-2.3.2.ebuild
114 index fc02aed..fe03609 100644
115 --- a/dev-db/rethinkdb/rethinkdb-2.3.2.ebuild
116 +++ b/dev-db/rethinkdb/rethinkdb-2.3.2.ebuild
117 @@ -1,10 +1,10 @@
118 -# Copyright 1999-2015 Gentoo Foundation
119 +# Copyright 1999-2016 Gentoo Foundation
120 # Distributed under the terms of the GNU General Public License v2
121 # $Id$
122
123 -EAPI="5"
124 +EAPI="6"
125
126 -inherit user
127 +inherit systemd user
128
129 DESCRIPTION="The open-source database for the realtime web."
130 HOMEPAGE="http://www.rethinkdb.com"
131 @@ -33,13 +33,12 @@ pkg_setup() {
132 }
133
134 src_prepare() {
135 - # fix doc auto installation
136 - sed -e 's/ install-docs / /g' -i mk/install.mk || die
137 + eapply_user
138
139 - # fix init script auto installation
140 - sed -e 's/ install-init / /g' -i mk/install.mk || die
141 + # fix doc and init script auto installation
142 + sed -e 's/ install-docs / /g' -e 's/ install-init / /g' -i mk/install.mk || die
143
144 - # default config
145 + # default config for Gentoo
146 # fix default pid-file path
147 # fix default directory path
148 # fix default log-file path
149 @@ -50,24 +49,27 @@ src_prepare() {
150
151 # fix termcap detection
152 #sed -e 's/termcap:termcap tinfo ncurses/termcap:ncurses termcap tinfo/g' -i configure || die
153 -
154 - # v8 has to be bundled
155 - # use dynamic libs
156 - local myopts="--fetch v8 --dynamic all --dynamic gtest --dynamic re2"
157 - if use tcmalloc ; then
158 - myopts+=" --with-tcmalloc"
159 - else
160 - myopts+=" --with-jemalloc"
161 - fi
162 - echo "${myopts}" > configure.default
163 }
164
165 src_configure() {
166 - ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
167 + local conf_opts=(
168 + --prefix="/usr"
169 + --sysconfdir="/etc"
170 + --localstatedir="/var"
171 + --static=none
172 + )
173 + if use jemalloc; then
174 + conf_opts+=(--with-jemalloc)
175 + elif use tcmalloc; then
176 + conf_opts+=(--with-tcmalloc)
177 + else
178 + conf_opts+=(--with-system-malloc)
179 + fi
180 + ./configure "${conf_opts[@]}"
181 }
182
183 src_install() {
184 - emake DESTDIR="${D}" install
185 + emake DESTDIR="${D}" VERBOSE=1 install
186
187 for x in /var/{lib,log}/${PN}; do
188 keepdir "${x}"
189 @@ -77,5 +79,43 @@ src_install() {
190 newconfd "${FILESDIR}/rethinkdb.confd" rethinkdb
191 newinitd "${FILESDIR}/rethinkdb.initd" rethinkdb
192
193 + systemd_newunit "${FILESDIR}/"${PN}.service "rethinkdb@.service"
194 + systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfilesd "rethinkdb.conf"
195 +
196 use doc && dodoc COPYRIGHT NOTES.md README.md
197 }
198 +
199 +pkg_config() {
200 + einfo "This will prepare a new RethinkDB instance. Press Control-C to abort."
201 +
202 + einfo "Enter the name for the new instance: "
203 + read instance_name
204 + [[ -z "${instance_name}" ]] && die "Invalid instance name"
205 +
206 + local instance_data="/var/lib/rethinkdb/instances.d/${instance_name}"
207 + local instance_config="/etc/rethinkdb/instances.d/${instance_name}.conf"
208 + if [[ -e "${instance_data}" || -e "${instance_config}" ]]; then
209 + eerror "An instance with the same name already exists:"
210 + eerror "Check ${instance_data} or ${instance_config}."
211 + die "Instance already exists"
212 + fi
213 +
214 + /usr/bin/rethinkdb create -d "${instance_data}" &>/dev/null \
215 + || die "Creating instance failed"
216 + chown -R rethinkdb:rethinkdb "${instance_data}" \
217 + || die "Correcting permissions for instance failed"
218 + cp /etc/rethinkdb/default.conf.sample "${instance_config}" \
219 + || die "Creating configuration file failed"
220 + sed -e "s:^# \(directory=\).*$:\1${instance_data}:" \
221 + -i "${instance_config}" \
222 + || die "Modifying configuration file failed"
223 + ln -s /etc/init.d/rethinkdb "/etc/init.d/rethinkdb.${instance_name}" \
224 + || die "Creating init script symlink failed"
225 +
226 + einfo "Successfully created the instance at ${instance_data}."
227 + einfo "To change the default settings edit the configuration file:"
228 + einfo "${instance_config}"
229 + einfo " "
230 + einfo "To start your instance, run:"
231 + einfo "/etc/init.d/rethinkdb.${instance_name}"
232 +}