Skip to content
This repository has been archived by the owner on Jan 8, 2019. It is now read-only.

Commit

Permalink
dev-db/redis-3.0.0: uses its own LUA, enables us to upgrade to 5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-kubacki committed Jun 3, 2015
1 parent c91340e commit 2701200
Show file tree
Hide file tree
Showing 9 changed files with 331 additions and 0 deletions.
9 changes: 9 additions & 0 deletions dev-db/redis/Manifest
@@ -0,0 +1,9 @@
AUX configure.ac-2.2 1522 SHA256 349b9f826578a886930bf395b59e6bdf1802c453ffd4cadbfcc3cca49c07313f SHA512 7a67bbd2f5fcfd7e1bfe18b739438342d40484c3f178ef5e2ddb617480715626e7f5a47d58660761489867ae460a58457a85a14bb2af90fe2e2ab3b8bd940b34 WHIRLPOOL a78a56a8e5963fee703b90d4eba112591693ded8ff8b780b049864be4fe712815ef0743d32b120edadca4e5909982d841cfa4ed1483b9eb91bc030ecdf3d7c70
AUX redis-2.8.17-config.patch 1660 SHA256 2fe9ddae4bd1198850eabd1c2c34258cf0e089aa79575124a72e2333b634392a SHA512 4b7f88361ca33fb676d47e6e5e364cd33731031cf83d0cec34d6542e6e832a6b7187b847fde7c65b8c838b309feec7033e0d44f5a5690d6ed0e6694773d4195e WHIRLPOOL 9dde5a6b75a3d91d5ff785c4d4fa96ee0ccbc6c4d853e41073d957b11176265f1ded151f3a62a23228e28f1da604c9c64a5b0ae6b718b2f8d0e84221b048be74
AUX redis-2.8.3-shared.patch 909 SHA256 fe95148b87d4fe70b655638a3355865fdb5f52d344d07dfd60ae2350d04b7862 SHA512 1070d9d22654a0ee00ecb2536dd2644cc59917650aa56af10689302c3ac962c172bc24a0c493c17f78aa2632bfd3d924ceef221340622d46fd6bf7346e69f49d WHIRLPOOL eeedadd088bf9a2449406d62bfd386b2c8bf484d6b835948d879d6441e35ee20e80c489fc8d81b4c9cb23dd4ebfe1dc07217fed058bd4e5be44f9c6f17a9ac81
AUX redis.confd 450 SHA256 8c68e29dc88c8ad99b9212a448d313d1406ef02c7638398b2e48ea1ca8aa937b SHA512 c6347cc6e17e9ce93fd081608b19c4977c3e1ffd58d2a417804ca3e647967800ac11859bd05d5437c36310dcd7552c11f35965e4521c5266c3414387d4796a6b WHIRLPOOL 72fb07431293f0e382af98c5a0b7eeca146cab84153befdd808328aa27404cd74d55d524b5442ad10de5989917351299bc7610e0be75d11d2e31fb5353beb45a
AUX redis.initd-4 795 SHA256 48e7fbbe5b088cff98d4ca9b3fb38503ae1210e2cf6e10d5f17fb1938769dfaf SHA512 4f561a3a9f5b166bd5644e0ed3e6f46b7145273dca47c8ee30866c56edd711ad58ef5c1df6434896fbbb293bcdaa2298cae86bd3b60ccceacc9f0f224d91f12b WHIRLPOOL 04587ef02d09f27cb04ffcc50b7a276e87d2899cd7fc73c0593cadca34b02816eee438dcc82a1effa3fcd90a561f57bfba1843c0b7429bad1003140814d79822
AUX redis.service 254 SHA256 e4b1b282612bf496f92a9287c171227802d79a9aa7e58e77f1cdbefd5b13551b SHA512 a8735fb3d2fff552f0f0dc982224ac73a8b9ca3a5c633d64c5fc528dc1f5a965f693d7aa19801eebaf663992e3d4ef96aa65bdefab47fef98c94aeab2b165b87 WHIRLPOOL c39a75713dca525ff1c1fec9a8972184f19204e08054b3dc62ec265c42abca69d5cfa90fd19097e2e4a35b1829c0c3743f19301a6ba5c7765320a91ee68eb1b9
AUX redis.tmpfiles 61 SHA256 68e4c7e3159068400cbc7d07e84b5618f9d829dc7a4f18253783c6256a53031a SHA512 741ff5a4df5b04e7af4e81357812bf5b6cf992bc18b6052074aef134401d0a92703a2e41f52966012c05ea80fac5636435c8d3e6ed55e62a5711526ba67ee738 WHIRLPOOL 2c6f4d9e5382c43e935db16bf120b24cd8de517bc067dcab91b3230a8ddced7ecc5ed37626464d3f1a7880d2d41efdf3cecfd1029a38aaa2edf3d20de74489b4
DIST redis-3.0.0.tar.gz 1358081 SHA256 654c95c6236692dcb916fccba9a34d0877cc91338c8b6a372511e6eb080e34bf SHA512 c7403eaa58dcdb8c85d53531b262a07099fc38ecb5e4e41622ad9355d356ecd269d691f15ef65da9fb9241395c2a3cb72eea27325d632b7cd8eaf3c4d2e3fe72 WHIRLPOOL 29e96f06b6a11fe98ea9112de61f01641dec2f45e98e925298ffbae515564a9e7ab07f9bd105bfe62206b4ecee6a65193a54bc04ffe19ec1873830d98c35837a
EBUILD redis-3.0.0.ebuild 3109 SHA256 cd10d210be22b6887167092579e6dd72629e096348fa78feba1db325d0c9eb8b SHA512 41510633b4fa0682a12ede179ed2fec6b07b7f25def8a0ac3fec750fa05a2f8f991b3d823f43de669ce4ef5462fcd2d7f20f1db94ebbaa60ea2e37032ed03b3d WHIRLPOOL 6d73409325efda06c0f29c488bfe4454e5c87428c5ffe2913a1e1647ea547a4d27034d558530d27aad6f040bfc01a236cd333ae1c3d9217c5737ed4064a6772f
58 changes: 58 additions & 0 deletions dev-db/redis/files/configure.ac-2.2
@@ -0,0 +1,58 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.63)
AC_INIT(redis, 2.0.0, antirez@gmail.com)
AM_CFLAGS="-std=c99 -pedantic -Wall -W -D__EXTENSIONS__ -D_XPG6"
if test x"$CFLAGS" = x""; then
AM_CFLAGS="$AM_CFLAGS -O2"
else
AM_CFLAGS="$AM_CFLAGS $CFLAGS"
fi

# options
AC_MSG_CHECKING([whether to build with debug information])
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],
[enable debug data generation (def=no)])],
[debugit="$enableval"],
[debugit=no])
AC_MSG_RESULT([$debugit])

if test x"$debugit" = x"yes"; then
AC_DEFINE([DEBUG],[],[Debug Mode])
AM_CFLAGS="$AM_CFLAGS -g -rdynamic -ggdb"
else
AC_DEFINE([NDEBUG],[],[No-debug Mode])
fi
AC_SUBST([AM_CFLAGS])

# Checks for programs.
AC_PROG_CC

# Checks for libraries.

# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h limits.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T

# Checks for library functions.
AC_FUNC_ERROR_AT_LINE
AC_FUNC_FORK
AC_FUNC_STRCOLL
AC_FUNC_STRTOD
AC_CHECK_FUNCS([dup2 gethostbyname gettimeofday inet_ntoa memchr memmove memset select socket strcasecmp strchr strerror strstr strtol])

AC_CONFIG_FILES([Makefile])
AC_OUTPUT
46 changes: 46 additions & 0 deletions dev-db/redis/files/redis-2.8.17-config.patch
@@ -0,0 +1,46 @@
--- a/redis.conf 2014-12-02 16:22:38.722433643 +0100
+++ b/redis.conf 2014-12-02 16:22:16.252249350 +0100
@@ -38,7 +38,7 @@

# When running daemonized, Redis writes a pid file in /var/run/redis.pid by
# default. You can specify a custom pid file location here.
-pidfile /var/run/redis.pid
+pidfile /run/redis/redis.pid

# Accept connections on the specified port, default is 6379.
# If port 0 is specified Redis will not listen on a TCP socket.
@@ -61,7 +61,7 @@
# Examples:
#
# bind 192.168.1.100 10.0.0.1
-# bind 127.0.0.1
+bind 127.0.0.1

# Specify the path for the Unix socket that will be used to listen for
# incoming connections. There is no default, so Redis will not listen
@@ -100,7 +100,7 @@
# Specify the log file name. Also the empty string can be used to force
# Redis to log on the standard output. Note that if you use standard
# output for logging but daemonize, logs will be sent to /dev/null
-logfile ""
+logfile /var/log/redis/redis.log

# To enable logging to the system logger, just set 'syslog-enabled' to yes,
# and optionally update the other syslog parameters to suit your needs.
@@ -184,7 +184,7 @@
# The Append Only File will also be created inside this directory.
#
# Note that you must specify a directory here, not a file name.
-dir ./
+dir /var/lib/redis/

################################# REPLICATION #################################

@@ -403,6 +403,7 @@
# output buffers (but this is not needed if the policy is 'noeviction').
#
# maxmemory <bytes>
+maxmemory 67108864

# MAXMEMORY POLICY: how Redis will select what to remove when maxmemory
# is reached. You can select among five behaviors:
36 changes: 36 additions & 0 deletions dev-db/redis/files/redis-2.8.3-shared.patch
@@ -0,0 +1,36 @@
commit 388a76f24c96767c831ee7682234fd9f2bc5b9ac
Author: Johan Bergström <bugs@bergstroem.nu>
Date: Mon Nov 25 09:17:14 2013 +1100

Use shared jemalloc

diff --git src/Makefile src/Makefile
index c37549d..77e6255 100644
--- src/Makefile
+++ src/Makefile
@@ -26,12 +26,7 @@ PREFIX?=/usr/local
INSTALL_BIN=$(PREFIX)/bin
INSTALL=install

-# Default allocator
-ifeq ($(uname_S),Linux)
- MALLOC=jemalloc
-else
- MALLOC=libc
-endif
+MALLOC?=jemalloc

# Backwards compatibility for selecting an allocator
ifeq ($(USE_TCMALLOC),yes)
@@ -79,9 +74,8 @@ ifeq ($(MALLOC),tcmalloc_minimal)
endif

ifeq ($(MALLOC),jemalloc)
- DEPENDENCY_TARGETS+= jemalloc
- FINAL_CFLAGS+= -DUSE_JEMALLOC -I../deps/jemalloc/include
- FINAL_LIBS+= ../deps/jemalloc/lib/libjemalloc.a -ldl
+ FINAL_CFLAGS+= -DUSE_JEMALLOC -DJEMALLOC_NO_DEMANGLE
+ FINAL_LIBS+= -ljemalloc -ldl
endif

REDIS_CC=$(QUIET_CC)$(CC) $(FINAL_CFLAGS)
20 changes: 20 additions & 0 deletions dev-db/redis/files/redis.confd
@@ -0,0 +1,20 @@
# Redis user.
REDIS_USER="redis"

# Redis group.
REDIS_GROUP="redis"

# Redis configuration file.
REDIS_CONF="/etc/redis.conf"

# Redis dump directory.
REDIS_DIR="/var/lib/redis"

# Redis pid file.
# (Be sure to change the main redis configuration file as well if you change
# this from the default.)
REDIS_PID="/var/run/redis/redis.pid"

# Redis options.
# (Redis expects the first argument to be the configuration file.)
REDIS_OPTS="${REDIS_CONF}"
32 changes: 32 additions & 0 deletions dev-db/redis/files/redis.initd-4
@@ -0,0 +1,32 @@
#!/sbin/runscript

REDIS_DIR=${REDIS_DIR:-/var/lib/redis}
REDIS_CONF=${REDIS_CONF:-/etc/redis.conf}
REDIS_OPTS=${REDIS_OPTS:-"${REDIS_CONF}"}
REDIS_USER=${REDIS_USER:-redis}
REDIS_GROUP=${REDIS_GROUP:-redis}
REDIS_TIMEOUT=${REDIS_TIMEOUT:-30}

command=/usr/sbin/redis-server
pidfile=${REDIS_PID:-/run/redis/redis.pid}
start_stop_daemon_args="--background --make-pidfile --pidfile ${pidfile}
--chdir \"${REDIS_DIR}\" --user ${REDIS_USER} --group ${REDIS_GROUP}"
command_args="${REDIS_OPTS}"

depend() {
use net localmount logger
after keepalived
}

start_pre() {
checkpath -d -m 0775 -o ${REDIS_USER}:${REDIS_GROUP} $(dirname ${REDIS_PID})
}

stop() {
ebegin "Stopping ${SVCNAME}"
start-stop-daemon --stop \
--exec ${command} \
--retry ${REDIS_TIMEOUT} \
--pidfile ${pidfile}
eend
}
14 changes: 14 additions & 0 deletions dev-db/redis/files/redis.service
@@ -0,0 +1,14 @@
[Unit]
Description=A persistent key-value database
After=syslog.target network.target

[Service]
Type=forking
PIDFile=/var/run/redis/redis.pid
ExecStart=/usr/sbin/redis-server /etc/redis.conf
User=redis
Group=redis

[Install]
WantedBy=multi-user.target

2 changes: 2 additions & 0 deletions dev-db/redis/files/redis.tmpfiles
@@ -0,0 +1,2 @@
# redis runtime directory
d /var/run/redis 0755 redis root -
114 changes: 114 additions & 0 deletions dev-db/redis/redis-3.0.0.ebuild
@@ -0,0 +1,114 @@
# Copyright 2010-2012 W-Mark Kubacki, Mao Pu
# Distributed under the terms of the OSI Reciprocal Public License

EAPI=5

inherit autotools eutils flag-o-matic systemd toolchain-funcs user

DESCRIPTION="A persistent caching system, key-value and data structures database"
HOMEPAGE="http://redis.io/"
SRC_URI="http://download.redis.io/releases/${P}.tar.gz"

LICENSE="BSD"
KEYWORDS="amd64 ~hppa ~ppc64 ~x86 amd64-linux x86-linux ~x86-macos ~x86-solaris"
IUSE="+jemalloc tcmalloc test"
SLOT="0"

RDEPEND="
tcmalloc? ( dev-util/google-perftools )
jemalloc? ( >=dev-libs/jemalloc-3.2 )"
DEPEND="virtual/pkgconfig
>=sys-devel/autoconf-2.63
test? ( dev-lang/tcl:0= )
${RDEPEND}"
REQUIRED_USE="?? ( tcmalloc jemalloc )"

S="${WORKDIR}/${PN}-${PV/_/-}"

pkg_setup() {
enewgroup redis 75
enewuser redis 75 -1 /var/lib/redis redis
}

src_prepare() {
epatch "${FILESDIR}"/${PN}-2.8.3-shared.patch
epatch "${FILESDIR}"/${PN}-2.8.17-config.patch

# don't compile everything, just what we need
sed -i \
-e '/cd lua\/src/{s:all:liblua.a:}' \
deps/Makefile

# You'll notice Gentoo's authors have stolen this ebuild and removed
# attribution when looking through these lines:
# now we will rewrite present Makefiles
local makefiles=""
for MKF in $(find -name 'Makefile' | cut -b 3-); do
mv "${MKF}" "${MKF}.in"
sed -i -e 's:$(CC):@CC@:g' \
-e 's:$(CFLAGS):@AM_CFLAGS@:g' \
-e 's: $(DEBUG)::g' \
-e 's:$(OBJARCH)::g' \
-e 's:ARCH:TARCH:g' \
-e '/^CCOPT=/s:$: $(LDFLAGS):g' \
"${MKF}.in" \
|| die "Sed failed for ${MKF}"
makefiles+=" ${MKF}"
done
# autodetection of compiler and settings; generates the modified Makefiles
cp "${FILESDIR}"/configure.ac-2.2 configure.ac
sed -i -e "s:AC_CONFIG_FILES(\[Makefile\]):AC_CONFIG_FILES([${makefiles}]):g" \
configure.ac || die "Sed failed for configure.ac"
eautoconf
}

src_configure() {
econf

# Linenoise can't be built with -std=c99, see https://bugs.gentoo.org/451164
# also, don't define ANSI/c99 for lua twice
sed -i -e "s:-std=c99::g" deps/linenoise/Makefile deps/Makefile || die
}

src_compile() {
tc-export CC AR RANLIB

local myconf=""

if use tcmalloc ; then
myconf="${myconf} USE_TCMALLOC=yes"
elif use jemalloc ; then
myconf="${myconf} JEMALLOC_SHARED=yes"
else
myconf="${myconf} MALLOC=yes"
fi

emake ${myconf} V=1 CC="${CC}" AR="${AR}" RANLIB="${RANLIB}"
}

src_install() {
insinto /etc/
doins redis.conf sentinel.conf
use prefix || fowners redis:redis /etc/{redis,sentinel}.conf
fperms 0644 /etc/{redis,sentinel}.conf

newconfd "${FILESDIR}/redis.confd" redis
newinitd "${FILESDIR}/redis.initd-4" redis

systemd_dounit "${FILESDIR}/redis.service"
systemd_newtmpfilesd "${FILESDIR}/redis.tmpfiles" redis.conf

nonfatal dodoc 00-RELEASENOTES BUGS CONTRIBUTING MANIFESTO README

dobin src/redis-cli
dosbin src/redis-benchmark src/redis-server src/redis-check-aof src/redis-check-dump
fperms 0750 /usr/sbin/redis-benchmark
dosym /usr/sbin/redis-server /usr/sbin/redis-sentinel

if use prefix; then
diropts -m0750
else
diropts -m0750 -o redis -g redis
fi
keepdir /var/{log,lib}/redis
}

0 comments on commit 2701200

Please sign in to comment.