Skip to content

Commit

Permalink
redis 2.0 rc4
Browse files Browse the repository at this point in the history
  • Loading branch information
tmacedo committed Aug 15, 2010
1 parent dd05c52 commit 04db94a
Show file tree
Hide file tree
Showing 5 changed files with 241 additions and 0 deletions.
5 changes: 5 additions & 0 deletions dev-db/redis/Manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
AUX configure.ac-1.02 1496 RMD160 41e3f453f993020ce6477392fed18261c199a9a5 SHA1 bbf22e3d8aff6cb9745d6316c6ba6c64bca96865 SHA256 16d546fc036e2ef8a020e3b042ff2c49b13a0dcddc6de1046c9dac039af0e877
AUX redis.confd 450 RMD160 237a72f30b3ba5c77e7dd31d2dfebc2db2cea2ad SHA1 4c298810900f0e627cd3f7bf480feb639b6cc2d5 SHA256 8c68e29dc88c8ad99b9212a448d313d1406ef02c7638398b2e48ea1ca8aa937b
AUX redis.initd 859 RMD160 a5718f3b4eab11450223c21bc98ab75d408e932e SHA1 ba3237364dba1da920ec4f14c13ff2cd45062144 SHA256 8b25b60bca695a8393e381078b2a42330c1b6cc2953bbe3c1b7cbd41ca36fe5d
DIST redis-2.0.0-rc4.tar.gz 346479 RMD160 9cfa812a49eb383576d45058b18fee9c49c75ee3 SHA1 b2fda3b2a073c537c324b962ba0c7c81be8baef3 SHA256 6096278a2ea64b7b6f75606f620cbf3df5b1de06e7a3a7dc4b34a97485fc3e22
EBUILD redis-2.0.0_rc4.ebuild 3371 RMD160 dfd7341e3666576f58ffd5c2bd83f1dae1000274 SHA1 222278aa4ced1d718196a7b88c27044992187441 SHA256 997d53851fd592da76f42fe6638864be8d2273d2b1d9b49e2f31a5c19d299a3c
58 changes: 58 additions & 0 deletions dev-db/redis/files/configure.ac-1.02
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.63)
AC_INIT(redis, 1.02, antirez@gmail.com)
AM_CFLAGS="-std=c99 -pedantic -Wall -W"
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
20 changes: 20 additions & 0 deletions dev-db/redis/files/redis.confd
Original file line number Diff line number Diff line change
@@ -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}"
37 changes: 37 additions & 0 deletions dev-db/redis/files/redis.initd
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/sbin/runscript
# $Header: /var/cvsroot/gentoo-x86/dev-db/redis/files/redis.initd,v 1.1 2010/03/25 07:36:04 robbat2 Exp $

REDIS_EXEC=/usr/sbin/redis-server
REDIS_PID=${REDIS_PID:-/var/run/redis/redis.pid}
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}

opts="start stop restart"

depend() {
use net localmount logger
after keepalived
}

start() {
ebegin "Starting Redis server"
cd "${REDIS_DIR}"
start-stop-daemon --start \
--chuid ${REDIS_USER}:${REDIS_GROUP} \
--pidfile "${REDIS_PID}" \
--exec "${REDIS_EXEC}" \
-- ${REDIS_OPTS}
ret=$?
eend ${ret}
}

stop() {
ebegin "Stopping Redis server"
start-stop-daemon --stop --quiet --pidfile "${REDIS_PID}"
ret=$?
rm -f "${REDIS_PID}"
eend ${ret}
}
121 changes: 121 additions & 0 deletions dev-db/redis/redis-2.0.0_rc4.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-db/redis/redis-1.2.6.ebuild,v 1.1 2010/05/17 21:32:23 lu_zero Exp $

EAPI=2

inherit autotools eutils

#MY_P="redis-2.0.0-rc4"
MY_P=${P/_/-}
S=${WORKDIR}/${MY_P}

DESCRIPTION="Persistent distributed key-value data caching system."
HOMEPAGE="http://code.google.com/p/redis/"
SRC_URI="http://redis.googlecode.com/files/${MY_P}.tar.gz"

LICENSE="BSD"
KEYWORDS="~amd64 ~x86"
IUSE="test"
SLOT="0"

RDEPEND=""
DEPEND="test? ( dev-lang/tcl )"

REDIS_PIDDIR=/var/run/redis/
REDIS_PIDFILE=${REDIS_PIDDIR}/redis.pid
REDIS_DATAPATH=/var/lib/redis
REDIS_LOGPATH=/var/log/redis
REDIS_LOGFILE=${REDIS_LOGPATH}/redis.log

pkg_setup() {
enewgroup redis 75 || die "problem adding 'redis' group"
enewuser redis 75 -1 ${REDIS_DATAPATH} redis || die "problem adding 'redis' user"
}

src_prepare() {
# Now autotoolize this
cp "${FILESDIR}"/configure.ac-1.02 configure.ac
mv Makefile Makefile.in
sed -i \
-e 's:$(CC):@CC@:g' \
-e 's:$(CFLAGS):@AM_CFLAGS@:g' \
-e 's: $(DEBUG)::g' \
-e 's:ARCH:GCC_ARCH_FLAG:g' \
-e 's:PROF:GCC_PROF_FLAG:g' \
Makefile.in \
|| die "sed failed!"

eautoreconf
}

src_install() {
# configuration file rewrites
insinto /etc/
sed -r \
-e "/^pidfile\>/s,/var.*,${REDIS_PIDFILE}," \
-e '/^daemonize\>/s,no,yes,' \
-e '/^# bind/s,^# ,,' \
-e '/^# maxmemory\>/s,^# ,,' \
-e '/^maxmemory\>/s,<bytes>,67108864,' \
-e "/^dbfilename\>/s,dump.rdb,${REDIS_DATAPATH}/dump.rdb," \
-e "/^dir\>/s, .*, ${REDIS_DATAPATH}/," \
-e '/^loglevel\>/s:debug:notice:' \
-e "/^logfile\>/s:stdout:${REDIS_LOGFILE}:" \
<redis.conf \
>redis.conf.gentoo
newins redis.conf.gentoo redis.conf
fowners root:redis /etc/redis.conf
fperms 0640 /etc/redis.conf

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

dodoc 00-RELEASENOTES BETATESTING.txt BUGS Changelog README TODO
newdoc client-libraries/README README.client-libraries
dohtml doc/*

dobin redis-benchmark redis-cli
dosbin redis-server

diropts -m0750 -o redis -g redis
keepdir ${REDIS_DATAPATH} ${REDIS_LOGPATH} ${REDIS_PIDDIR}
}

src_test() {
local PORT=$(((RANDOM % 32767)+32768))
local PIDFILE=redis-test.pid
einfo "Preparing redis test config"
# The port number is hardcoded in lots of places
sed -r <redis.conf >redis-test.conf \
-e "/^pidfile/s~ .*~ ${PIDFILE}~" \
-e '/^daemonize/s~ no~ yes~' \
-e "/^port/s~ [0-9]+~ ${PORT}~" \
-e '/^(# )?bind/s,^,#,g' \
-e '/\<bind\>/abind 127.0.0.1' \
|| die "Failed to build test server config"
# The port number is hardcoded in lots of places
for i in test-redis.tcl redis.tcl ; do
sed -r <$i >${i/.tcl/-${PORT}.tcl} \
-e "/^source redis.tcl/s,redis.tcl,redis-${PORT}.tcl,g" \
-e "/6379/s~6379~${PORT}~" \
|| die "Failed to build test client config ($i)"
done
einfo "Starting test server"
./redis-server redis-test.conf
rc1=$?
sleep 2
[[ $rc1 -ne 0 ]] && die "Failed to start redis server!"
pidof redis-server | fgrep -f ${PIDFILE}
rc1=$?
[[ $rc1 -ne 0 ]] && die "Could not find started redis server!"
unset rc1

einfo "Starting redis tests"
tclsh test-redis-$PORT.tcl
rc1=$?
kill -9 $(<${PIDFILE})
rc2=$?
[[ $rc1 -ne 0 ]] && die "Failed testsuite"
[[ $rc2 -ne 0 ]] && die "Failed to shut down redis server"
}

0 comments on commit 04db94a

Please sign in to comment.