diff options
Diffstat (limited to 'community/rethinkdb')
-rw-r--r-- | community/rethinkdb/APKBUILD | 73 | ||||
-rw-r--r-- | community/rethinkdb/libressl.patch | 158 | ||||
-rw-r--r-- | community/rethinkdb/musl-fixes.patch | 95 | ||||
-rw-r--r-- | community/rethinkdb/rethinkdb.confd | 12 | ||||
-rw-r--r-- | community/rethinkdb/rethinkdb.initd | 50 | ||||
-rw-r--r-- | community/rethinkdb/rethinkdb.pre-install | 7 |
6 files changed, 395 insertions, 0 deletions
diff --git a/community/rethinkdb/APKBUILD b/community/rethinkdb/APKBUILD new file mode 100644 index 0000000000..6f4c72d389 --- /dev/null +++ b/community/rethinkdb/APKBUILD @@ -0,0 +1,73 @@ +# Contributor: Carlo Landmeter <clandmeter@gmail.com> +# Maintainer: Daniel Treadwell <daniel@djt.id.au> +pkgname=rethinkdb +pkgver=2.3.5 +pkgrel=7 +pkgdesc="Distributed powerful and scalable NoSQL database" +url="http://www.rethinkdb.com" +arch="x86_64" +license="ASL 2.0" +depends="" +makedepends="bash python2 linux-headers bsd-compat-headers m4 paxmark + protobuf-dev icu-dev libressl-dev curl-dev boost-dev libexecinfo-dev" +install="$pkgname.pre-install" +pkgusers=rethinkdb +pkggroups=rethinkdb +subpackages="$pkgname-doc" +source="http://download.rethinkdb.com/dist/$pkgname-$pkgver.tgz + libressl.patch + rethinkdb.initd + rethinkdb.confd + " +builddir="$srcdir/rethinkdb-$pkgver" + +build() { + cd "$builddir" + ./configure \ + --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --dynamic all \ + --with-system-malloc \ + || return 1 + + local _arch + case $CARCH in + x86) _arch=ia32 ;; + x86_64) _arch=x64 ;; + esac + + export LDFLAGS="$LDFLAGS -lexecinfo" + make CXXFLAGS="$CXXFLAGS -fno-delete-null-pointer-checks" \ + || paxmark -m \ + build/external/v8_3.30.33.16/build/out/${_arch}.release/mksnapshot + make CXXFLAGS="$CXXFLAGS -fno-delete-null-pointer-checks" || return 1 +} + +package() { + cd "$builddir" + make DESTDIR="$pkgdir" install || return 1 + install -Dm 644 "$pkgdir"/etc/$pkgname/default.conf.sample \ + "$pkgdir"/etc/$pkgname/default.conf || return 1 + 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.pid|' \ + -e 's|# runuser=rethinkdb|runuser=rethinkdb|' \ + -e 's|# rungroup=rethinkdb|rungroup=rethinkdb|' \ + -i "$pkgdir"/etc/$pkgname/default.conf || return 1 + install -d -o $pkgname -g $pkgname "$pkgdir"/var/lib/$pkgname || return 1 + install -Dm755 "$srcdir"/$pkgname.initd \ + "$pkgdir"/etc/init.d/$pkgname || return 1 + install -Dm644 "$srcdir"/$pkgname.confd \ + "$pkgdir"/etc/conf.d/$pkgname || return 1 + paxmark -m "$pkgdir"/usr/bin/rethinkdb || return 1 +} + +doc() { + default_doc || return 1 + mv "$pkgdir"/etc/$pkgname/*.sample "$subpkgdir"/usr/share/doc/$pkgname +} + +sha512sums="ac71656fd2451fd36432fa0f7d2c16c2be53888f748d88f0bfc2fb9ad7cd3c704b56551bc35eda72eb08fffdd799727a3cbe83830337cf71e17c159588d33c94 rethinkdb-2.3.5.tgz +9ff727feedc7a9f58e7bf8554dc26e32ebca259b2d5d75ff0d064f5aea7a54c9c94fab16b83a3bc4039d4ae6d6d805d7b129ab9d5f762186d0388adeeff6e67c libressl.patch +c27e21073048bd5e8e2ec91303b43ce873748573e2b44ba28ee57ca1b3080afb67e56880b6a6da7a0abf4f2967dce45aa27fe8d6dd44b70d874d776e876ef132 rethinkdb.initd +3a07f9c78ef96b2ca37fca508ee14a644d3c08612f662ba5260182fbfcceba064d20253f1261f56dc0a2c28d1a4d5e2320872c3c4e7595cb7ab4e202eb28ad42 rethinkdb.confd" diff --git a/community/rethinkdb/libressl.patch b/community/rethinkdb/libressl.patch new file mode 100644 index 0000000000..6f273a0258 --- /dev/null +++ b/community/rethinkdb/libressl.patch @@ -0,0 +1,158 @@ +From d52a694a806c1a8b6dd4d7d17d0671a96240449a Mon Sep 17 00:00:00 2001 +From: Natanael Copa <ncopa@alpinelinux.org> +Date: Wed, 4 Jan 2017 15:31:40 +0100 +Subject: [PATCH] Improve OpenSSL compatibility + +Refactor the conditionals for openssl 1.1 support so we avoid multiple +if/else and add a check for LibreSSL as well. +--- + src/crypto/hash.cc | 13 +++++-------- + src/crypto/hmac.cc | 34 ++++++++++++++++++---------------- + src/crypto/initialization_guard.cc | 15 ++++++--------- + 3 files changed, 29 insertions(+), 33 deletions(-) + +diff --git a/src/crypto/hash.cc b/src/crypto/hash.cc +index 4427dfddeb..e035f695fc 100644 +--- a/src/crypto/hash.cc ++++ b/src/crypto/hash.cc +@@ -8,27 +8,24 @@ + + #include "crypto/error.hpp" + ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) ++#define EVP_MD_CTX_new EVP_MD_CTX_create ++#define EVP_MD_CTX_free EVP_MD_CTX_destroy ++#endif ++ + namespace crypto { + + class evp_md_ctx_wrapper_t { + public: + evp_md_ctx_wrapper_t() { +-#if OPENSSL_VERSION_NUMBER < 0x10100000L +- m_evp_md_ctx = EVP_MD_CTX_create(); +-#else + m_evp_md_ctx = EVP_MD_CTX_new(); +-#endif + if (m_evp_md_ctx == nullptr) { + throw openssl_error_t(ERR_get_error()); + } + } + + ~evp_md_ctx_wrapper_t() { +-#if OPENSSL_VERSION_NUMBER < 0x10100000L +- EVP_MD_CTX_destroy(m_evp_md_ctx); +-#else + EVP_MD_CTX_free(m_evp_md_ctx); +-#endif + } + + EVP_MD_CTX *get() { +diff --git a/src/crypto/hmac.cc b/src/crypto/hmac.cc +index 2ac4314e24..0e3f91a0c1 100644 +--- a/src/crypto/hmac.cc ++++ b/src/crypto/hmac.cc +@@ -7,43 +7,45 @@ + + #include "crypto/error.hpp" + ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) ++ ++inline HMAC_CTX *HMAC_CTX_new() { ++ HMAC_CTX *tmp = (HMAC_CTX *)OPENSSL_malloc(sizeof(HMAC_CTX)); ++ if (tmp) ++ HMAC_CTX_init(tmp); ++ return tmp; ++} ++ ++inline void HMAC_CTX_free(HMAC_CTX *ctx) { ++ if (ctx) { ++ HMAC_CTX_cleanup(ctx); ++ OPENSSL_free(ctx); ++ } ++} ++ ++#endif ++ + namespace crypto { + + class hmac_ctx_wrapper_t { + public: + hmac_ctx_wrapper_t() { +-#if OPENSSL_VERSION_NUMBER < 0x10100000L +- HMAC_CTX_init(&m_hmac_ctx); +-#else + m_hmac_ctx = HMAC_CTX_new(); + if (m_hmac_ctx == nullptr) { + throw openssl_error_t(ERR_get_error()); + } +-#endif + } + + ~hmac_ctx_wrapper_t() { +-#if OPENSSL_VERSION_NUMBER < 0x10100000L +- HMAC_CTX_cleanup(&m_hmac_ctx); +-#else + HMAC_CTX_free(m_hmac_ctx); +-#endif + } + + HMAC_CTX *get() { +-#if OPENSSL_VERSION_NUMBER < 0x10100000L +- return &m_hmac_ctx; +-#else + return m_hmac_ctx; +-#endif + } + + private: +-#if OPENSSL_VERSION_NUMBER < 0x10100000L +- HMAC_CTX m_hmac_ctx; +-#else + HMAC_CTX *m_hmac_ctx; +-#endif + }; + + std::array<unsigned char, SHA256_DIGEST_LENGTH> detail::hmac_sha256( +diff --git a/src/crypto/initialization_guard.cc b/src/crypto/initialization_guard.cc +index ba0503efc6..f76ffd96da 100644 +--- a/src/crypto/initialization_guard.cc ++++ b/src/crypto/initialization_guard.cc +@@ -14,16 +14,17 @@ + #include "arch/io/concurrency.hpp" + #include "arch/runtime/runtime.hpp" + ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) ++#define OPENSSL_init_ssl(x, y) SSL_library_init() ++#define OPENSSL_init_crypto(x, y) SSL_load_error_strings() ++#define OPENSSL_cleanup ERR_free_strings ++#endif ++ + namespace crypto { + + initialization_guard_t::initialization_guard_t() { +-#if OPENSSL_VERSION_NUMBER < 0x10100000L +- SSL_library_init(); +- SSL_load_error_strings(); +-#else + OPENSSL_init_ssl(0, nullptr); + OPENSSL_init_crypto(0, nullptr); +-#endif + + // Make OpenSSL thread-safe by registering the required callbacks + CRYPTO_THREADID_set_callback([](CRYPTO_THREADID *thread_out) { +@@ -49,11 +50,7 @@ initialization_guard_t::initialization_guard_t() { + } + + initialization_guard_t::~initialization_guard_t() { +-#if OPENSSL_VERSION_NUMBER < 0x10100000L +- ERR_free_strings(); +-#else + OPENSSL_cleanup(); +-#endif + } + + } // namespace crypto +-- +2.11.0 + diff --git a/community/rethinkdb/musl-fixes.patch b/community/rethinkdb/musl-fixes.patch new file mode 100644 index 0000000000..7828f7fd0b --- /dev/null +++ b/community/rethinkdb/musl-fixes.patch @@ -0,0 +1,95 @@ +--- ./src/rdb_protocol/geo/s2/util/math/exactfloat/exactfloat.cc.orig ++++ ./src/rdb_protocol/geo/s2/util/math/exactfloat/exactfloat.cc +@@ -104,9 +104,9 @@ + ExactFloat::ExactFloat(double v) { + BN_init(&bn_); + sign_ = signbit(v) ? -1 : 1; +- if (isnan(v)) { ++ if (std::isnan(v)) { + set_nan(); +- } else if (isinf(v)) { ++ } else if (std::isinf(v)) { + set_inf(sign_); + } else { + // The following code is much simpler than messing about with bit masks, +--- ./src/rdb_protocol/geo/s2/util/math/mathlimits.h.orig ++++ ./src/rdb_protocol/geo/s2/util/math/mathlimits.h +@@ -195,11 +195,11 @@ + static bool IsNegInf(const Type x) { return _fpclass(x) == _FPCLASS_NINF; } + #else + #define DECL_FP_LIMIT_FUNCS \ +- static bool IsFinite(const Type x) { return !isinf(x) && !isnan(x); } \ +- static bool IsNaN(const Type x) { return isnan(x); } \ +- static bool IsInf(const Type x) { return isinf(x); } \ +- static bool IsPosInf(const Type x) { return isinf(x) && x > 0; } \ +- static bool IsNegInf(const Type x) { return isinf(x) && x < 0; } ++ static bool IsFinite(const Type x) { return !std::isinf(x) && !std::isnan(x); } \ ++ static bool IsNaN(const Type x) { return std::isnan(x); } \ ++ static bool IsInf(const Type x) { return std::isinf(x); } \ ++ static bool IsPosInf(const Type x) { return std::isinf(x) && x > 0; } \ ++ static bool IsNegInf(const Type x) { return std::isinf(x) && x < 0; } + #endif + + // We can't put floating-point constant values in the header here because +--- ./src/rdb_protocol/geo/s2/util/math/mathlimits.h.orig ++++ ./src/rdb_protocol/geo/s2/util/math/mathlimits.h +@@ -14,7 +14,7 @@ + #define UTIL_MATH_MATHLIMITS_H__ + + #include <string.h> +-#include <math.h> ++#include <cmath> + #include <cfloat> + + #include "rdb_protocol/geo/s2/base/basictypes.h" +--- ./src/threading.hpp.orig ++++ ./src/threading.hpp +@@ -1,6 +1,7 @@ + #ifndef THREADING_HPP_ + #define THREADING_HPP_ + ++#include <unistd.h> + #include "errors.hpp" + + // A thread number as used by the thread pool. +--- ./src/threading.hpp.orig ++++ ./src/threading.hpp +@@ -2,6 +2,7 @@ + #define THREADING_HPP_ + + #include <unistd.h> ++#include <sys/types.h> + #include "errors.hpp" + + // A thread number as used by the thread pool. +--- ./src/containers/printf_buffer.hpp.orig ++++ ./src/containers/printf_buffer.hpp +@@ -5,6 +5,7 @@ + #include <stdarg.h> + #include <stdio.h> + #include <string.h> ++#include <sys/types.h> + + // Cannot include utils.hpp, we are included by utils.hpp. + #include "errors.hpp" +--- ./src/containers/buffer_group.hpp.orig ++++ ./src/containers/buffer_group.hpp +@@ -4,6 +4,7 @@ + + #include <stdlib.h> + #include <vector> ++#include <sys/types.h> + + #include "errors.hpp" + +--- ./src/errors.cc.orig ++++ ./src/errors.cc +@@ -87,7 +87,7 @@ + } + + const char *errno_string_maybe_using_buffer(int errsv, char *buf, size_t buflen) { +-#ifdef _GNU_SOURCE ++#ifdef __GLIBC__ + return strerror_r(errsv, buf, buflen); + #else + // The result is either 0 or ERANGE (if the buffer is too small) or EINVAL (if the error number diff --git a/community/rethinkdb/rethinkdb.confd b/community/rethinkdb/rethinkdb.confd new file mode 100644 index 0000000000..af65794a44 --- /dev/null +++ b/community/rethinkdb/rethinkdb.confd @@ -0,0 +1,12 @@ +# !! IMPORTANT !! +# +# This file is ONLY used to override some of the init script configuration. +# +# You should NOT use this file to configure your rethinkdb instance, +# see the /etc/rethinkdb/default.conf.sample file instead. +# +# Available init script modifiers : +# - config_file : the configuration file to use (default : /etc/rethinkdb/instance.d/<instance-name>.conf) +# - user : the user used to run your rethinkdb instance (default : rethinkdb) +# - group : the group used to run your rethinkdb instance (default : rethinkdb) +# - run_dir : the run directory for your PID files (default : /run/rethinkdb)
\ No newline at end of file diff --git a/community/rethinkdb/rethinkdb.initd b/community/rethinkdb/rethinkdb.initd new file mode 100644 index 0000000000..c9e5a2b7eb --- /dev/null +++ b/community/rethinkdb/rethinkdb.initd @@ -0,0 +1,50 @@ +#!/sbin/openrc-run +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +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}/${instance_name}.pid +user=${user:-rethinkdb} +group=${group:-rethinkdb} +start_stop_daemon_args="--user ${user} --group ${group} --wait 2000" + +depend() { + use net logger dns + after firewall +} + +start_pre() { + checkpath -d -m 0750 -o "${user}":"${group}" "${run_dir}" + 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/" + eerror "then run this instance init script instead." + return 1 + fi + if [ ! -f ${config_file} ]; then + eerror "Missing configuration file ${config_file}" + return 1 + else + # 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/"${instance_name}" + fi + checkpath -d -m 0750 -o "${user}":"${group}" "${directory}" + command_args="${command_args} --directory ${directory}" + + # 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/"${instance_name}".log + fi + command_args="${command_args} --log-file ${log_file}" + fi +} diff --git a/community/rethinkdb/rethinkdb.pre-install b/community/rethinkdb/rethinkdb.pre-install new file mode 100644 index 0000000000..8c48f8c9c3 --- /dev/null +++ b/community/rethinkdb/rethinkdb.pre-install @@ -0,0 +1,7 @@ +#!/bin/sh + +addgroup -S rethinkdb 2>/dev/null +adduser -S -D -h /var/lib/rethinkdb -s /sbin/nologin -G rethinkdb \ + -g rethinkdb rethinkdb 2>/dev/null + +exit 0 |