commit: ec82ed4b6f46718748dd6881c4217f40c791ff4c
Author: Ultrabug <ultrabug <AT> gentoo <DOT> org>
AuthorDate: Thu May 26 08:42:39 2016 +0000
Commit: Alexys Jacob <ultrabug <AT> gentoo <DOT> org>
CommitDate: Thu May 26 08:42:54 2016 +0000
URL: https://gitweb.gentoo.org/dev/ultrabug.git/commit/?id=ec82ed4b
improved rethinkdb ebuild with enhanced config from bgo overlay
dev-db/rethinkdb/Manifest | 6 ++-
dev-db/rethinkdb/files/rethinkdb.initd | 13 ++---
dev-db/rethinkdb/files/rethinkdb.service | 13 +++++
dev-db/rethinkdb/files/rethinkdb.tmpfilesd | 1 +
dev-db/rethinkdb/rethinkdb-2.3.2.ebuild | 80 ++++++++++++++++++++++--------
5 files changed, 85 insertions(+), 28 deletions(-)
diff --git a/dev-db/rethinkdb/Manifest b/dev-db/rethinkdb/Manifest
index 9a67776..eacf098 100644
--- a/dev-db/rethinkdb/Manifest
+++ b/dev-db/rethinkdb/Manifest
@@ -1,5 +1,7 @@
AUX rethinkdb.confd 606 SHA256
5d659a409a7b1a502a6362b818b01c1eb5f12e1bed273e9e876cc43758464659 SHA512
3a07f9c78ef96b2ca37fca508ee14a644d3c08612f662ba5260182fbfcceba064d20253f1261f56dc0a2c28d1a4d5e2320872c3c4e7595cb7ab4e202eb28ad42
WHIRLPOOL
2598d32113314f60b9e64048ba148c6fb3653ab92f833da13cc58b080996b988a20a61b8821634889c735628421609cee36c88dede66d89d5de071011a7afc57
-AUX rethinkdb.initd 1593 SHA256
9583d3acc484ed0ecf169b6b9c397bbfac0307c0cedc078c354db8aaecc8d7ff SHA512
d28c056076b180344bbd5751ff233e6de9a0c8fe4631297f5968806aa7ce46113702393600454f3b59bda48af7dd84679466cc0934b7773b601287c6ab7ce8b0
WHIRLPOOL
106d5d0785b87310515400e86d680ce7421ce2e999508a6fe04ed2f45dc0e317dda8d2ffabd2d44b92b673cd9730e044a2802b267cb53422cde7aad9a25616b7
+AUX rethinkdb.initd 1651 SHA256
3203f6ea1bfa5a124bdb8ef9ea282de69c82402b5875cf8ab987f9810fa69699 SHA512
6f232b05539dde1a8aef86837d4a2df1b1d5152f4c1cb7dd88f6b9d6c4f1f40c37f908e2d01aade5fe296b389db9b5a4b409a147caa6223a98b35e419bb36dd5
WHIRLPOOL
0001a9933b15c0b7d87ce8f6c190695cd855a6c99a2cee92e70745aed2fdef41415c277a78d400d2457e54cf38a61501cc9ffb836db6740b6aa3a1288375aa65
+AUX rethinkdb.service 261 SHA256
c831f179b0973ea5abb205a5aae3f4597d09bc7575f3a75fa6db5c32fce5f5ee SHA512
70389797ae79481b7d47b45f1676bd0531bc830a2f2daf7baec87533a7a6a0e67177572bab7d42324fe719f8a056899babc5ab2358a679c6a59899ed1272374b
WHIRLPOOL
7e0259a1678a216a44ee1b64df65ad8c3d653887a392ed371b027f17fa91cc9cb1f315fdce4071e8c1403e9af7891d772089f85fb9291981fdbca08ed3e46b6a
+AUX rethinkdb.tmpfilesd 43 SHA256
656d3a42e75d087e723f71aa320fdd91cbbb82071ef72eb11fd3e4a619b429a4 SHA512
5996f72b8e08aac80285373e8e1b5a664177e9d0e8d13e5638c6b821fe5b7a0368001fbfa9ef3f6709dabf0616abcabea40adc4808d176572f8f99b7a3255bae
WHIRLPOOL
84ff192ff84922155cfacb26e8f9255d506c0733472d5b674ea61e1c2f805a0293da0f69622d52bd21b2822dcaaf3a641c2ec39321283af0b3f00b0fb37ba2c9
DIST rethinkdb-2.3.2.tgz 76823279 SHA256
af8760271c63496fdeaa8de8bae834febd4b6c09a57743570b30134e9837eaac SHA512
da10c2fdcdb25a8af1dff9c42892b68e31a26f412b3af94d15da1532aec6a747a1f7044d4f42ea1f03334ebb48d1e7ef597a975d5bb96c65294b30018ff27e07
WHIRLPOOL
3ee3c6247d479cbaf0ee303d3ae8c8d4de2cf831db50e0fb8c2276844b0b8b75933a90b83cef95854cfddd00614f2660727bce1e2221077b0dccff56c84a4044
-EBUILD rethinkdb-2.3.2.ebuild 2038 SHA256
d8c491c0d550731aa0719db6254657e337898429fb771f50a77bbf6081eeba4c SHA512
cea5bb6081e73c1115ba490e561bd8d6070538ddf61c6b60ebbec42f350cffc099510782480c93a1677819ce53fed3316f2f1cd1621ef159ddb1155a84dd90fd
WHIRLPOOL
65047f36384b57cc21a3583cd6d002ef23ff453155d4a55835a2698ac477294b56617d3f7a7a995962946205b6bf10ca9a4e9db2773176f18be370f6286c0896
+EBUILD rethinkdb-2.3.2.ebuild 3552 SHA256
8042c3f9edf9099b01129313c643825a94967ad7aab1af7110f37ac190307347 SHA512
eef329014252903ad23da08fbd288361b3dd430834f403ccd4084c6079dd8f0b305eefedb6635d63dc25ad39e1901ceec6db9e58ac416fc15e91e4ef743e8efd
WHIRLPOOL
bacc0c204aded02440baff9be7277985232db7ef242b8ed046a47932d6133f33be77032dfd21461f4b680c4fc367c0b64f4088bed400b36a90e2d18604b39619
MISC metadata.xml 471 SHA256
65cad98fab9a780924012debe5906d7bab5831317aa4af2b37862a861b3f5bfa SHA512
1fa850b4f60828a41d5a752813a78008f90771041e033f0bc74e899f9e23e61710f500fcb2cd4f34c8f10905d6d660b7dc75c1eb9b95892966a3b45f5b21f517
WHIRLPOOL
59d2b047291daf85464529164a1e41e1fd70d14282488d53a91a57ff43913293c75d1253119a7000d7f1cd19fee9925d0755acd9e617dac770722bfa51c31994
diff --git a/dev-db/rethinkdb/files/rethinkdb.initd
b/dev-db/rethinkdb/files/rethinkdb.initd
index 4073181..429f041 100644
--- a/dev-db/rethinkdb/files/rethinkdb.initd
+++ b/dev-db/rethinkdb/files/rethinkdb.initd
@@ -1,15 +1,16 @@
#!/sbin/runscript
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
-config_file=${config_file:-/etc/rethinkdb/instances.d/${SVCNAME}.conf}
+instance_name=${SVCNAME/*.}
+config_file=${config_file:-/etc/rethinkdb/instances.d/${instance_name}.conf}
run_dir=${run_dir:-/run/rethinkdb}
command="/usr/bin/rethinkdb"
command_args="--config-file ${config_file}"
command_background="true"
-pidfile=${run_dir}/${SVCNAME}.pid
+pidfile=${run_dir}/${instance_name}.pid
user=${user:-rethinkdb}
group=${group:-rethinkdb}
start_stop_daemon_args="--user ${user} --group ${group} --wait 2000"
@@ -20,7 +21,7 @@ depend() {
start_pre() {
checkpath -d -m 0750 -o "${user}":"${group}" "${run_dir}"
- if [ "${SVCNAME}" == "rethinkdb" ]; then
+ if [ "${instance_name}" == "rethinkdb" ]; then
eerror "You should not run this default init script directly"
eerror "Create a symlink to an instance name"
eerror "and create a configuration file in
/etc/rethinkdb/instances.d/"
@@ -34,7 +35,7 @@ start_pre() {
# respect configured directory or set a default
directory=$(egrep -e '^directory=' "${config_file}" | cut -d'='
-f2)
if [ -z "${directory}" ]; then
- directory=/var/lib/rethinkdb/instances.d/"${SVCNAME}"
+
directory=/var/lib/rethinkdb/instances.d/"${instance_name}"
fi
checkpath -d -m 0750 -o "${user}":"${group}" "${directory}"
command_args="${command_args} --directory ${directory}"
@@ -42,7 +43,7 @@ start_pre() {
# respect configured log-file or set a default
log_file=$(egrep -e '^log_file=' "${config_file}" | cut -d'='
-f2)
if [ -z "${log_file}" ]; then
- log_file=/var/log/rethinkdb/"${SVCNAME}".log
+ log_file=/var/log/rethinkdb/"${instance_name}".log
fi
command_args="${command_args} --log-file ${log_file}"
fi
diff --git a/dev-db/rethinkdb/files/rethinkdb.service
b/dev-db/rethinkdb/files/rethinkdb.service
new file mode 100644
index 0000000..09645c2
--- /dev/null
+++ b/dev-db/rethinkdb/files/rethinkdb.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=RethinkDB database server for instance '%i'
+
+[Service]
+User=rethinkdb
+Group=rethinkdb
+ExecStart=/usr/bin/rethinkdb serve --config-file
/etc/rethinkdb/instances.d/%i.conf
+KillMode=process
+PrivateTmp=true
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/dev-db/rethinkdb/files/rethinkdb.tmpfilesd
b/dev-db/rethinkdb/files/rethinkdb.tmpfilesd
new file mode 100644
index 0000000..694501e
--- /dev/null
+++ b/dev-db/rethinkdb/files/rethinkdb.tmpfilesd
@@ -0,0 +1 @@
+d /run/rethinkdb 0755 rethinkdb rethinkdb -
\ No newline at end of file
diff --git a/dev-db/rethinkdb/rethinkdb-2.3.2.ebuild
b/dev-db/rethinkdb/rethinkdb-2.3.2.ebuild
index fc02aed..fe03609 100644
--- a/dev-db/rethinkdb/rethinkdb-2.3.2.ebuild
+++ b/dev-db/rethinkdb/rethinkdb-2.3.2.ebuild
@@ -1,10 +1,10 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
-EAPI="5"
+EAPI="6"
-inherit user
+inherit systemd user
DESCRIPTION="The open-source database for the realtime web."
HOMEPAGE="http://www.rethinkdb.com"
@@ -33,13 +33,12 @@ pkg_setup() {
}
src_prepare() {
- # fix doc auto installation
- sed -e 's/ install-docs / /g' -i mk/install.mk || die
+ eapply_user
- # fix init script auto installation
- sed -e 's/ install-init / /g' -i mk/install.mk || die
+ # fix doc and init script auto installation
+ sed -e 's/ install-docs / /g' -e 's/ install-init / /g' -i
mk/install.mk || die
- # default config
+ # default config for Gentoo
# fix default pid-file path
# fix default directory path
# fix default log-file path
@@ -50,24 +49,27 @@ src_prepare() {
# fix termcap detection
#sed -e 's/termcap:termcap tinfo ncurses/termcap:ncurses termcap
tinfo/g' -i configure || die
-
- # v8 has to be bundled
- # use dynamic libs
- local myopts="--fetch v8 --dynamic all --dynamic gtest --dynamic re2"
- if use tcmalloc ; then
- myopts+=" --with-tcmalloc"
- else
- myopts+=" --with-jemalloc"
- fi
- echo "${myopts}" > configure.default
}
src_configure() {
- ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
+ local conf_opts=(
+ --prefix="/usr"
+ --sysconfdir="/etc"
+ --localstatedir="/var"
+ --static=none
+ )
+ if use jemalloc; then
+ conf_opts+=(--with-jemalloc)
+ elif use tcmalloc; then
+ conf_opts+=(--with-tcmalloc)
+ else
+ conf_opts+=(--with-system-malloc)
+ fi
+ ./configure "${conf_opts[@]}"
}
src_install() {
- emake DESTDIR="${D}" install
+ emake DESTDIR="${D}" VERBOSE=1 install
for x in /var/{lib,log}/${PN}; do
keepdir "${x}"
@@ -77,5 +79,43 @@ src_install() {
newconfd "${FILESDIR}/rethinkdb.confd" rethinkdb
newinitd "${FILESDIR}/rethinkdb.initd" rethinkdb
+ systemd_newunit "${FILESDIR}/"${PN}.service "[email protected]"
+ systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfilesd "rethinkdb.conf"
+
use doc && dodoc COPYRIGHT NOTES.md README.md
}
+
+pkg_config() {
+ einfo "This will prepare a new RethinkDB instance. Press Control-C to
abort."
+
+ einfo "Enter the name for the new instance: "
+ read instance_name
+ [[ -z "${instance_name}" ]] && die "Invalid instance name"
+
+ local instance_data="/var/lib/rethinkdb/instances.d/${instance_name}"
+ local instance_config="/etc/rethinkdb/instances.d/${instance_name}.conf"
+ if [[ -e "${instance_data}" || -e "${instance_config}" ]]; then
+ eerror "An instance with the same name already exists:"
+ eerror "Check ${instance_data} or ${instance_config}."
+ die "Instance already exists"
+ fi
+
+ /usr/bin/rethinkdb create -d "${instance_data}" &>/dev/null \
+ || die "Creating instance failed"
+ chown -R rethinkdb:rethinkdb "${instance_data}" \
+ || die "Correcting permissions for instance failed"
+ cp /etc/rethinkdb/default.conf.sample "${instance_config}" \
+ || die "Creating configuration file failed"
+ sed -e "s:^# \(directory=\).*$:\1${instance_data}:" \
+ -i "${instance_config}" \
+ || die "Modifying configuration file failed"
+ ln -s /etc/init.d/rethinkdb "/etc/init.d/rethinkdb.${instance_name}" \
+ || die "Creating init script symlink failed"
+
+ einfo "Successfully created the instance at ${instance_data}."
+ einfo "To change the default settings edit the configuration file:"
+ einfo "${instance_config}"
+ einfo " "
+ einfo "To start your instance, run:"
+ einfo "/etc/init.d/rethinkdb.${instance_name}"
+}