summaryrefslogtreecommitdiff
path: root/community/rethinkdb
diff options
context:
space:
mode:
Diffstat (limited to 'community/rethinkdb')
-rw-r--r--community/rethinkdb/PKGBUILD64
-rw-r--r--community/rethinkdb/build.diff20
-rw-r--r--community/rethinkdb/rethinkdb-tmpfile.conf1
-rw-r--r--community/rethinkdb/rethinkdb.install47
-rw-r--r--community/rethinkdb/rethinkdb.service12
5 files changed, 144 insertions, 0 deletions
diff --git a/community/rethinkdb/PKGBUILD b/community/rethinkdb/PKGBUILD
new file mode 100644
index 000000000..9c69e0a37
--- /dev/null
+++ b/community/rethinkdb/PKGBUILD
@@ -0,0 +1,64 @@
+# $Id: PKGBUILD 106066 2014-02-21 22:10:06Z anatolik $
+# Maintainer: Anatol Pomozov <anatol.pomozov@gmail.com>
+# Contributor: Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
+# Contributor: Sigmund Lahn <sigmund@lahn.no>
+
+pkgname=rethinkdb
+pkgver=1.11.3
+pkgrel=1
+pkgdesc='An open-source distributed database built with love.'
+arch=(i686 x86_64)
+url='http://www.rethinkdb.com/'
+license=(AGPL)
+depends=(protobuf ncurses gperftools)
+makedepends=(boost python python2 subversion) # subversion is for checking out V8 sources
+backup=(etc/rethinkdb/instances.d/default.conf)
+install=rethinkdb.install
+options=(!emptydirs)
+source=(
+ http://download.rethinkdb.com/dist/rethinkdb-$pkgver.tgz
+ rethinkdb-tmpfile.conf
+ rethinkdb.service
+ build.diff
+)
+sha256sums=('ab59ebe40f4a6a499b27e4ce85818f8ebe88d919d832f22384ba2cdacf0ba267'
+ '656d3a42e75d087e723f71aa320fdd91cbbb82071ef72eb11fd3e4a619b429a4'
+ 'e56bffa2b9ebc3a00ef566ab2be0719a633c89d961a2461dfa2d9ffdb258c1a2'
+ 'd2330ac0d2fd0a8f14daa4993eb49b55b0de544496e15345502fcdea2a6aaf88')
+
+prepare() {
+ cd rethinkdb-$pkgver
+ patch -p1 < "$srcdir/build.diff"
+}
+
+build() {
+ cd rethinkdb-$pkgver
+ ./configure --fetch v8 --disable-drivers --dynamic all --enable-precompiled-web --prefix=/usr --sysconfdir=/etc
+ make
+}
+
+check() {
+ cd rethinkdb-$pkgver
+ make build/release/rethinkdb-unittest
+ # skip some failing tests (should be fixed in 1.12)
+ # https://github.com/rethinkdb/rethinkdb/issues/1059
+ # https://github.com/rethinkdb/rethinkdb/issues/549
+ ./build/release/rethinkdb-unittest --gtest_filter=-TimerTest.TestApproximateWaitTimes:RDBProtocol.OvershardedSindexCreateDrop:RDBProtocol.OvershardedMissingAttr:RDBProtocol.OvershardedOverSizedKeys:RDBBtree.SindexInterruptionViaDrop:RDBBtree.SindexPostConstruct
+}
+
+package() {
+ cd rethinkdb-$pkgver
+ make DESTDIR="$pkgdir" install
+
+ install -Dm644 "$srcdir"/rethinkdb-tmpfile.conf "$pkgdir"/usr/lib/tmpfiles.d/rethinkdb.conf
+ install -Dm644 "$srcdir"/rethinkdb.service "$pkgdir"/usr/lib/systemd/system/rethinkdb@.service
+
+ # create 'default' database instance
+ cp "$pkgdir"/etc/rethinkdb/default.conf.sample "$pkgdir"/etc/rethinkdb/instances.d/default.conf
+ sed -e 's|# directory=/var/lib/rethinkdb|directory=/var/lib/rethinkdb|' \
+ -e 's|# pid-file=/var/run/rethinkdb/rethinkdb.pid|pid-file=/var/run/rethinkdb/default.pid|' \
+ -i "$pkgdir"/etc/rethinkdb/instances.d/default.conf
+
+ # Arch uses systemd, no need for init.d scripts
+ rm -r "$pkgdir"/etc/init.d
+}
diff --git a/community/rethinkdb/build.diff b/community/rethinkdb/build.diff
new file mode 100644
index 000000000..cb271712e
--- /dev/null
+++ b/community/rethinkdb/build.diff
@@ -0,0 +1,20 @@
+diff --git a/mk/support.mk b/mk/support.mk
+index 821695c..7f8f857 100644
+--- a/mk/support.mk
++++ b/mk/support.mk
+@@ -185,9 +185,13 @@ $(V8_SRC_DIR):
+ $P MAKE v8 dependencies
+ $(EXTERN_MAKE) -C $(V8_SRC_DIR) dependencies $(SUPPORT_LOG_REDIRECT)
+
+-$(V8_INT_LIB): $(V8_INT_DIR)
++ ( cd $(TC_SRC_DIR) && \
++ find v8 -type f -exec sed -e 's_^#!/usr/bin/env python$$_&2_; s_^#!/usr/bin/python$$_&2_' -i {} \; && \
++ sed 's/\bpython\b/python2/' -i v8/Makefile v8/build/gyp/gyp ) $(SUPPORT_LOG_REDIRECT)
++
++$(V8_INT_LIB): | $(V8_INT_DIR)
+ $P MAKE v8
+- $(EXTERN_MAKE) -C $(V8_INT_DIR) native CXXFLAGS=-Wno-array-bounds $(SUPPORT_LOG_REDIRECT)
++ $(EXTERN_MAKE) -C $(V8_INT_DIR) native CXXFLAGS='-Wno-error' $(SUPPORT_LOG_REDIRECT)
+ $P AR $@
+ find $(V8_INT_DIR) -iname "*.o" | grep -v '\/preparser_lib\/' | xargs ar cqs $(V8_INT_LIB);
+
diff --git a/community/rethinkdb/rethinkdb-tmpfile.conf b/community/rethinkdb/rethinkdb-tmpfile.conf
new file mode 100644
index 000000000..694501e8a
--- /dev/null
+++ b/community/rethinkdb/rethinkdb-tmpfile.conf
@@ -0,0 +1 @@
+d /run/rethinkdb 0755 rethinkdb rethinkdb - \ No newline at end of file
diff --git a/community/rethinkdb/rethinkdb.install b/community/rethinkdb/rethinkdb.install
new file mode 100644
index 000000000..8c74c4f0b
--- /dev/null
+++ b/community/rethinkdb/rethinkdb.install
@@ -0,0 +1,47 @@
+post_install() {
+ groupadd rethinkdb &>/dev/null
+ useradd -g rethinkdb -d /var/lib/rethinkdb -s /bin/false rethinkdb &>/dev/null
+
+ /usr/bin/systemd-tmpfiles --create rethinkdb.conf
+
+ if [ -d /var/lib/rethinkdb ]; then
+ echo "Database directory '/var/lib/rethinkdb' already exists. If you want to recreate default database then delete the directory and run 'rethinkdb create -d /var/lib/rethinkdb/default'."
+ fi
+
+ if [ ! -d /var/lib/rethinkdb/default ]; then
+ mkdir -p /var/lib/rethinkdb
+ /usr/bin/rethinkdb create -d /var/lib/rethinkdb/default
+ fi
+ chown -R rethinkdb:rethinkdb /var/lib/rethinkdb
+}
+
+post_upgrade() {
+ IFS='.' read -a new_version <<< "$1"
+ IFS='.' read -a old_version <<< "$2"
+
+ # previously data diecotry was /var/lib/rethinkdb/
+ # now we moved to multi-instance location: /var/lib/rethinkdb/default
+ # convert from previous location, remove this check Q3'13
+ if [ -e /var/lib/rethinkdb/metadata -a ! -d /var/lib/rethinkdb/default ]; then
+ echo "You store rethinkdb data in /var/lib/rethinkdb. Moving this data to per-instance location /var/lib/rethinkdb/default."
+ mkdir /var/lib/rethinkdb/default
+ mv /var/lib/rethinkdb/* /var/lib/rethinkdb/default
+ chown -R rethinkdb:rethinkdb /var/lib/rethinkdb
+ fi
+
+ if [ "${old_version[0]}" != "${new_version[0]}" -o "${old_version[1]}" != "${new_version[1]}" ]; then
+ echo "This release changed data storage format. Please upgrade your data using following information https://github.com/rethinkdb/rethinkdb/tree/next/scripts/migration"
+ fi
+
+ getent group rethinkdb >/dev/null 2>&1 || groupadd rethinkdb &>/dev/null
+ getent passwd rethinkdb >/dev/null 2>&1 || useradd -g rethinkdb -d /var/lib/rethinkdb -s /bin/false rethinkdb &>/dev/null
+}
+
+post_remove() {
+ #/usr/bin/systemctl stop rethinkdb@default.service
+
+ getent passwd rethinkdb >/dev/null && userdel rethinkdb
+ getent group rethinkdb >/dev/null && groupdel rethinkdb
+
+ echo "RethinkDB data directory '/var/lib/rethinkdb' is left untouched. Remove it if you really sure you won't need your data in the future."
+}
diff --git a/community/rethinkdb/rethinkdb.service b/community/rethinkdb/rethinkdb.service
new file mode 100644
index 000000000..9c9bbedd4
--- /dev/null
+++ b/community/rethinkdb/rethinkdb.service
@@ -0,0 +1,12 @@
+[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