From 7a1914d05394704b33ea05a0dd21234d4ca78f23 Mon Sep 17 00:00:00 2001 From: zegeek Date: Thu, 2 May 2024 15:23:44 +0200 Subject: [PATCH] redis: add redis 6.2.5 --- dev-db/redis/Manifest | 1 + dev-db/redis/files/configure.ac-3.2 | 66 ++++++ dev-db/redis/files/configure.ac-7.0 | 58 ++++++ dev-db/redis/files/redis-6.2.1-config.patch | 40 ++++ .../redis/files/redis-6.2.1-sharedlua.patch | 60 ++++++ .../redis/files/redis-6.2.3-ppc-atomic.patch | 19 ++ dev-db/redis/files/redis-7.0.4-no-which.patch | 66 ++++++ .../files/redis-7.2.0-system-jemalloc.patch | 33 +++ .../files/redis-sentinel-5.0-config.patch | 19 ++ .../files/redis-sentinel-7.2.0-config.patch | 27 +++ dev-db/redis/files/redis-sentinel.confd-r1 | 16 ++ dev-db/redis/files/redis-sentinel.initd-r1 | 22 ++ dev-db/redis/files/redis.confd-r2 | 20 ++ dev-db/redis/files/redis.initd-6 | 25 +++ dev-db/redis/files/redis.logrotate | 6 + dev-db/redis/files/redis.service-4 | 14 ++ dev-db/redis/files/redis.tmpfiles-2 | 2 + dev-db/redis/metadata.xml | 20 ++ dev-db/redis/redis-6.2.5.ebuild | 188 ++++++++++++++++++ 19 files changed, 702 insertions(+) create mode 100644 dev-db/redis/Manifest create mode 100644 dev-db/redis/files/configure.ac-3.2 create mode 100644 dev-db/redis/files/configure.ac-7.0 create mode 100644 dev-db/redis/files/redis-6.2.1-config.patch create mode 100644 dev-db/redis/files/redis-6.2.1-sharedlua.patch create mode 100644 dev-db/redis/files/redis-6.2.3-ppc-atomic.patch create mode 100644 dev-db/redis/files/redis-7.0.4-no-which.patch create mode 100644 dev-db/redis/files/redis-7.2.0-system-jemalloc.patch create mode 100644 dev-db/redis/files/redis-sentinel-5.0-config.patch create mode 100644 dev-db/redis/files/redis-sentinel-7.2.0-config.patch create mode 100644 dev-db/redis/files/redis-sentinel.confd-r1 create mode 100644 dev-db/redis/files/redis-sentinel.initd-r1 create mode 100644 dev-db/redis/files/redis.confd-r2 create mode 100644 dev-db/redis/files/redis.initd-6 create mode 100644 dev-db/redis/files/redis.logrotate create mode 100644 dev-db/redis/files/redis.service-4 create mode 100644 dev-db/redis/files/redis.tmpfiles-2 create mode 100644 dev-db/redis/metadata.xml create mode 100644 dev-db/redis/redis-6.2.5.ebuild diff --git a/dev-db/redis/Manifest b/dev-db/redis/Manifest new file mode 100644 index 00000000..7128bbd8 --- /dev/null +++ b/dev-db/redis/Manifest @@ -0,0 +1 @@ +DIST redis-6.2.5.tar.gz 2465302 BLAKE2B 51cc672ab432bb87560151521289d04e8fefb8e4df820f58a9b742131a0f1960c0019dec42a601bad827ec2a172375b88b6cf32a19aef42964e18f5a7a911c40 SHA512 8c54451032cbb627ec2827251556cba2010e56544baca7ea117b5afd2c2add484acbedd3baf21bdb8fd10672602cf52294a4e26b135c1406d7a723c048275e3a diff --git a/dev-db/redis/files/configure.ac-3.2 b/dev-db/redis/files/configure.ac-3.2 new file mode 100644 index 00000000..3e2cf926 --- /dev/null +++ b/dev-db/redis/files/configure.ac-3.2 @@ -0,0 +1,66 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.63) +AC_INIT(redis, 3.2.3, 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]) + +# Check for lua-5.1 or luajit +AC_ARG_WITH([luajit], + AS_HELP_STRING([--with-luajit], [Use luajit instead of lua])) + +AS_IF([test "x$with_luajit" = "xyes"], + [PKG_CHECK_MODULES([LUA], [luajit >= 2], [], [AC_MSG_ERROR([luajit requested but not found])])], + [PKG_CHECK_MODULES([LUA], [lua5.1], [], [AC_MSG_ERROR([lua-5.1 required but not found])])]) + +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT diff --git a/dev-db/redis/files/configure.ac-7.0 b/dev-db/redis/files/configure.ac-7.0 new file mode 100644 index 00000000..45397b33 --- /dev/null +++ b/dev-db/redis/files/configure.ac-7.0 @@ -0,0 +1,58 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.63) +AC_INIT(redis, __PV__, 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 diff --git a/dev-db/redis/files/redis-6.2.1-config.patch b/dev-db/redis/files/redis-6.2.1-config.patch new file mode 100644 index 00000000..6db49913 --- /dev/null +++ b/dev-db/redis/files/redis-6.2.1-config.patch @@ -0,0 +1,40 @@ +diff --git a/redis.conf b/redis.conf +index 465d56f..ef56037 100644 +--- a/redis.conf ++++ b/redis.conf +@@ -276,7 +276,7 @@ daemonize no + # + # Note that on modern Linux systems "/run/redis.pid" is more conforming + # and should be used instead. +-pidfile /var/run/redis_6379.pid ++pidfile /run/redis/redis.pid + + # Specify the server verbosity level. + # This can be one of: +@@ -289,7 +289,7 @@ loglevel notice + # 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. +@@ -441,7 +441,7 @@ rdb-del-sync-files no + # 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 ################################# + +@@ -967,7 +967,7 @@ acllog-max-len 128 + # limit for maxmemory so that there is some free RAM on the system for replica + # output buffers (but this is not needed if the policy is 'noeviction'). + # +-# maxmemory ++maxmemory 64MB + + # MAXMEMORY POLICY: how Redis will select what to remove when maxmemory + # is reached. You can select one from the following behaviors: diff --git a/dev-db/redis/files/redis-6.2.1-sharedlua.patch b/dev-db/redis/files/redis-6.2.1-sharedlua.patch new file mode 100644 index 00000000..cf8aa853 --- /dev/null +++ b/dev-db/redis/files/redis-6.2.1-sharedlua.patch @@ -0,0 +1,60 @@ +diff --git a/deps/lua/src/lua_cjson.c b/deps/lua/src/lua_cjson.c +index c26c0d7..fa50c41 100644 +--- a/deps/lua/src/lua_cjson.c ++++ b/deps/lua/src/lua_cjson.c +@@ -46,7 +46,7 @@ + #include "strbuf.h" + #include "fpconv.h" + +-#include "../../../src/solarisfixes.h" ++#include "solarisfixes.h" + + #ifndef CJSON_MODNAME + #define CJSON_MODNAME "cjson" +diff --git a/src/Makefile b/src/Makefile +index 6f0fd84..6546b5d 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -16,7 +16,7 @@ release_hdr := $(shell sh -c './mkreleasehdr.sh') + uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') + uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not') + OPTIMIZATION?=-O2 +-DEPENDENCY_TARGETS=hiredis linenoise lua hdr_histogram ++DEPENDENCY_TARGETS=hiredis linenoise hdr_histogram + NODEPS:=clean distclean + + # Default settings +@@ -84,6 +84,7 @@ endif + FINAL_CFLAGS=$(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS) $(REDIS_CFLAGS) + FINAL_LDFLAGS=$(LDFLAGS) $(REDIS_LDFLAGS) $(DEBUG) + FINAL_LIBS=-lm ++FINAL_LIBS+=@LUA_LIBS@ + DEBUG=-g -ggdb + + # Linux ARM needs -latomic at linking time +@@ -186,7 +187,7 @@ endif + endif + endif + # Include paths to dependencies +-FINAL_CFLAGS+= -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src -I../deps/hdr_histogram ++FINAL_CFLAGS+= -I../deps/hiredis -I../deps/linenoise @LUA_CFLAGS@ -I../deps/hdr_histogram + + # Determine systemd support and/or build preference (defaulting to auto-detection) + BUILD_WITH_SYSTEMD=no +@@ -268,6 +269,7 @@ endif + REDIS_SERVER_NAME=redis-server$(PROG_SUFFIX) + REDIS_SENTINEL_NAME=redis-sentinel$(PROG_SUFFIX) + REDIS_SERVER_OBJ=adlist.o quicklist.o ae.o anet.o dict.o server.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o zipmap.o sha1.o ziplist.o release.o networking.o util.o object.o db.o replication.o rdb.o t_string.o t_list.o t_set.o t_zset.o t_hash.o config.o aof.o pubsub.o multi.o debug.o sort.o intset.o syncio.o cluster.o crc16.o endianconv.o slowlog.o scripting.o bio.o rio.o rand.o memtest.o crcspeed.o crc64.o bitops.o sentinel.o notify.o setproctitle.o blocked.o hyperloglog.o latency.o sparkline.o redis-check-rdb.o redis-check-aof.o geo.o lazyfree.o module.o evict.o expire.o geohash.o geohash_helper.o childinfo.o defrag.o siphash.o rax.o t_stream.o listpack.o localtime.o lolwut.o lolwut5.o lolwut6.o acl.o gopher.o tracking.o connection.o tls.o sha256.o timeout.o setcpuaffinity.o monotonic.o mt19937-64.o ++REDIS_SERVER_OBJ+=fpconv.o strbuf.o lua_bit.o lua_cjson.o lua_cmsgpack.o lua_struct.o + REDIS_CLI_NAME=redis-cli$(PROG_SUFFIX) + REDIS_CLI_OBJ=anet.o adlist.o dict.o redis-cli.o zmalloc.o release.o ae.o crcspeed.o crc64.o siphash.o crc16.o monotonic.o cli_common.o mt19937-64.o + REDIS_BENCHMARK_NAME=redis-benchmark$(PROG_SUFFIX) +@@ -321,7 +323,7 @@ endif + + # redis-server + $(REDIS_SERVER_NAME): $(REDIS_SERVER_OBJ) +- $(REDIS_LD) -o $@ $^ ../deps/hiredis/libhiredis.a ../deps/lua/src/liblua.a $(FINAL_LIBS) ++ $(REDIS_LD) -o $@ $^ ../deps/hiredis/libhiredis.a $(FINAL_LIBS) + + # redis-sentinel + $(REDIS_SENTINEL_NAME): $(REDIS_SERVER_NAME) diff --git a/dev-db/redis/files/redis-6.2.3-ppc-atomic.patch b/dev-db/redis/files/redis-6.2.3-ppc-atomic.patch new file mode 100644 index 00000000..8990b00c --- /dev/null +++ b/dev-db/redis/files/redis-6.2.3-ppc-atomic.patch @@ -0,0 +1,19 @@ +diff --git a/src/Makefile b/src/Makefile +index 5b2cf1c..9e1239d 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -87,6 +87,14 @@ FINAL_LIBS=-lm + FINAL_LIBS+=@LUA_LIBS@ + DEBUG=-g -ggdb + ++ifneq (,$(filter powerpc ppc,$(uname_M))) ++ FINAL_LIBS+=-latomic ++else ++ifneq (,$(findstring ppc,$(uname_M))) ++ FINAL_LIBS+=-latomic ++endif ++endif ++ + # Linux ARM32 needs -latomic at linking time + ifneq (,$(findstring armv,$(uname_M))) + FINAL_LIBS+=-latomic diff --git a/dev-db/redis/files/redis-7.0.4-no-which.patch b/dev-db/redis/files/redis-7.0.4-no-which.patch new file mode 100644 index 00000000..e8c775d8 --- /dev/null +++ b/dev-db/redis/files/redis-7.0.4-no-which.patch @@ -0,0 +1,66 @@ +--- a/runtest ++++ b/runtest +@@ -3,7 +3,7 @@ TCL_VERSIONS="8.5 8.6 8.7" + TCLSH="" + + for VERSION in $TCL_VERSIONS; do +- TCL=`which tclsh$VERSION 2>/dev/null` && TCLSH=$TCL ++ TCL=`command -v tclsh$VERSION 2>/dev/null` && TCLSH=$TCL + done + + if [ -z $TCLSH ] +--- a/runtest-cluster ++++ b/runtest-cluster +@@ -3,7 +3,7 @@ TCL_VERSIONS="8.5 8.6 8.7" + TCLSH="" + + for VERSION in $TCL_VERSIONS; do +- TCL=`which tclsh$VERSION 2>/dev/null` && TCLSH=$TCL ++ TCL=`command -v tclsh$VERSION 2>/dev/null` && TCLSH=$TCL + done + + if [ -z $TCLSH ] +--- a/runtest-moduleapi ++++ b/runtest-moduleapi +@@ -4,7 +4,7 @@ TCLSH="" + [ -z "$MAKE" ] && MAKE=make + + for VERSION in $TCL_VERSIONS; do +- TCL=`which tclsh$VERSION 2>/dev/null` && TCLSH=$TCL ++ TCL=`command -v tclsh$VERSION 2>/dev/null` && TCLSH=$TCL + done + + if [ -z $TCLSH ] +--- a/runtest-sentinel ++++ b/runtest-sentinel +@@ -3,7 +3,7 @@ TCL_VERSIONS="8.5 8.6 8.7" + TCLSH="" + + for VERSION in $TCL_VERSIONS; do +- TCL=`which tclsh$VERSION 2>/dev/null` && TCLSH=$TCL ++ TCL=`command -v tclsh$VERSION 2>/dev/null` && TCLSH=$TCL + done + + if [ -z $TCLSH ] +--- a/utils/generate-module-api-doc.rb ++++ b/utils/generate-module-api-doc.rb +@@ -164,7 +164,7 @@ end + # Populate the 'since' map (name => version) if we're in a git repo. + $since = {} + git_dir = File.dirname(__FILE__) ++ "/../.git" +-if File.directory?(git_dir) && `which git` != "" ++if File.directory?(git_dir) && `comamnd -v git` != "" + `git --git-dir="#{git_dir}" tag --sort=v:refname`.each_line do |version| + next if version !~ /^(\d+)\.\d+\.\d+?$/ || $1.to_i < 4 + version.chomp! +--- a/src/Makefile ++++ b/src/Makefile +@@ -52,7 +52,7 @@ INSTALL=install + PKG_CONFIG?=pkg-config + + ifndef PYTHON +-PYTHON := $(shell which python3 || which python) ++PYTHON := $(shell command -v python3 || command -v python) + endif + + # Default allocator defaults to Jemalloc if it's not an ARM diff --git a/dev-db/redis/files/redis-7.2.0-system-jemalloc.patch b/dev-db/redis/files/redis-7.2.0-system-jemalloc.patch new file mode 100644 index 00000000..cc2c51a5 --- /dev/null +++ b/dev-db/redis/files/redis-7.2.0-system-jemalloc.patch @@ -0,0 +1,33 @@ +Rebased from original redis-5.0-shared.patch + +diff --git a/src/Makefile b/src/Makefile +index ecbd2753d..275446338 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -65,10 +65,7 @@ PYTHON := $(shell which python3 || which python) + endif + + # Default allocator defaults to Jemalloc on Linux and libc otherwise +-MALLOC=libc +-ifeq ($(uname_S),Linux) +- MALLOC=jemalloc +-endif ++MALLOC?=jemalloc + + # To get ARM stack traces if Redis crashes we need a special C flag. + ifneq (,$(filter aarch64 armv%,$(uname_M))) +@@ -266,9 +263,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 $(FINAL_LIBS) ++ FINAL_CFLAGS+= -DUSE_JEMALLOC -DJEMALLOC_NO_DEMANGLE ++ FINAL_LIBS+= -ljemalloc -ldl + endif + + # LIBSSL & LIBCRYPTO +-- +2.41.0 + diff --git a/dev-db/redis/files/redis-sentinel-5.0-config.patch b/dev-db/redis/files/redis-sentinel-5.0-config.patch new file mode 100644 index 00000000..099b4eef --- /dev/null +++ b/dev-db/redis/files/redis-sentinel-5.0-config.patch @@ -0,0 +1,19 @@ +diff --git a/sentinel.conf b/sentinel.conf +index bc9a705..05e58d3 100644 +--- a/sentinel.conf ++++ b/sentinel.conf +@@ -28,12 +28,12 @@ daemonize no + # When running daemonized, Redis Sentinel writes a pid file in + # /var/run/redis-sentinel.pid by default. You can specify a custom pid file + # location here. +-pidfile /var/run/redis-sentinel.pid ++pidfile /run/redis-sentinel.pid + + # Specify the log file name. Also the empty string can be used to force + # Sentinel 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/sentinel.log" + + # sentinel announce-ip + # sentinel announce-port diff --git a/dev-db/redis/files/redis-sentinel-7.2.0-config.patch b/dev-db/redis/files/redis-sentinel-7.2.0-config.patch new file mode 100644 index 00000000..db9df678 --- /dev/null +++ b/dev-db/redis/files/redis-sentinel-7.2.0-config.patch @@ -0,0 +1,27 @@ +Rebased from original redis-sentinel-5.0-config.patch + +diff --git a/sentinel.conf b/sentinel.conf +index b7b3604f0..a1d7bfea9 100644 +--- a/sentinel.conf ++++ b/sentinel.conf +@@ -17,7 +17,7 @@ daemonize no + # When running daemonized, Redis Sentinel writes a pid file in + # /var/run/redis-sentinel.pid by default. You can specify a custom pid file + # location here. +-pidfile /var/run/redis-sentinel.pid ++pidfile /run/redis-sentinel.pid + + # Specify the server verbosity level. + # This can be one of: +@@ -31,7 +31,7 @@ loglevel notice + # Specify the log file name. Also the empty string can be used to force + # Sentinel 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/sentinel.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. +-- +2.41.0 + diff --git a/dev-db/redis/files/redis-sentinel.confd-r1 b/dev-db/redis/files/redis-sentinel.confd-r1 new file mode 100644 index 00000000..5198fc87 --- /dev/null +++ b/dev-db/redis/files/redis-sentinel.confd-r1 @@ -0,0 +1,16 @@ +# Redis-sentinel user. +REDIS_SENTINEL_USER="redis" + +# Redis-sentinel group. +REDIS_SENTINEL_GROUP="redis" + +# Redis-sentinel configuration file. +REDIS_SENTINEL_CONF="/etc/redis/sentinel.conf" + +# Redis-sentinel working directory. +REDIS_SENTINEL_DIR="/tmp" + +# Specify the network service that corresponds to the "bind" setting +# in your sentinel.conf. For example, if you bind to 127.0.0.1, this should +# be set to "net.lo" which provides the loopback interface. +rc_need="net.lo" diff --git a/dev-db/redis/files/redis-sentinel.initd-r1 b/dev-db/redis/files/redis-sentinel.initd-r1 new file mode 100644 index 00000000..1680b180 --- /dev/null +++ b/dev-db/redis/files/redis-sentinel.initd-r1 @@ -0,0 +1,22 @@ +#!/sbin/openrc-run +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +: ${REDIS_SENTINEL_DIR:=/tmp} +: ${REDIS_SENTINEL_CONF:=/etc/redis/sentinel.conf} +: ${REDIS_SENTINEL_USER:=redis} +: ${REDIS_SENTINEL_GROUP:=redis} +: ${REDIS_SENTINEL_TIMEOUT:=30} + +command="/usr/sbin/redis-sentinel" +command_args="${REDIS_SENTINEL_CONF}" +command_background="true" +command_user="${REDIS_SENTINEL_USER}:${REDIS_SENTINEL_GROUP}" +pidfile="/run/${RC_SVCNAME}.pid" +retry="${REDIS_SENTINEL_TIMEOUT}" +start_stop_daemon_args="--chdir \"${REDIS_SENTINEL_DIR}\"" + +depend() { + use localmount logger + after keepalived redis +} diff --git a/dev-db/redis/files/redis.confd-r2 b/dev-db/redis/files/redis.confd-r2 new file mode 100644 index 00000000..07fdc380 --- /dev/null +++ b/dev-db/redis/files/redis.confd-r2 @@ -0,0 +1,20 @@ +# Redis user. +REDIS_USER="redis" + +# Redis group. +REDIS_GROUP="redis" + +# Redis configuration file. +REDIS_CONF="/etc/redis/redis.conf" + +# Redis dump directory. +REDIS_DIR="/var/lib/redis" + +# Redis options. +# (Redis expects the first argument to be the configuration file.) +REDIS_OPTS="${REDIS_CONF}" + +# Specify the network service that corresponds to the "bind" setting +# in your redis.conf. For example, if you bind to 127.0.0.1, this should +# be set to "net.lo" which provides the loopback interface. +rc_need="net.lo" diff --git a/dev-db/redis/files/redis.initd-6 b/dev-db/redis/files/redis.initd-6 new file mode 100644 index 00000000..a31669b3 --- /dev/null +++ b/dev-db/redis/files/redis.initd-6 @@ -0,0 +1,25 @@ +#!/sbin/openrc-run +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +: ${REDIS_DIR:=/var/lib/redis} +: ${REDIS_CONF:=/etc/redis/redis.conf} +: ${REDIS_OPTS:="${REDIS_CONF}"} +: ${REDIS_USER:=redis} +: ${REDIS_GROUP:=redis} +: ${REDIS_TIMEOUT:=30} + +# https://bugs.gentoo.org/631002#c10 +# Force '--daemonize no' to override the config file +command="/usr/sbin/redis-server" +command_args="${REDIS_OPTS} --daemonize no" +command_background="true" +command_user="${REDIS_USER}:${REDIS_GROUP}" +pidfile="/run/${RC_SVCNAME}.pid" +retry="${REDIS_TIMEOUT}" +start_stop_daemon_args="--chdir \"${REDIS_DIR}\"" + +depend() { + use localmount logger + after keepalived +} diff --git a/dev-db/redis/files/redis.logrotate b/dev-db/redis/files/redis.logrotate new file mode 100644 index 00000000..2df390c2 --- /dev/null +++ b/dev-db/redis/files/redis.logrotate @@ -0,0 +1,6 @@ +/var/log/redis/redis.log /var/log/redis/sentinel.log { + compress + delaycompress + notifempty + missingok +} diff --git a/dev-db/redis/files/redis.service-4 b/dev-db/redis/files/redis.service-4 new file mode 100644 index 00000000..059f505d --- /dev/null +++ b/dev-db/redis/files/redis.service-4 @@ -0,0 +1,14 @@ +[Unit] +Description=A persistent key-value database +After=syslog.target network.target + +[Service] +Type=simple +PIDFile=/run/redis/redis.pid +ExecStart=/usr/sbin/redis-server /etc/redis/redis.conf +User=redis +Group=redis + +[Install] +WantedBy=multi-user.target + diff --git a/dev-db/redis/files/redis.tmpfiles-2 b/dev-db/redis/files/redis.tmpfiles-2 new file mode 100644 index 00000000..87087d2b --- /dev/null +++ b/dev-db/redis/files/redis.tmpfiles-2 @@ -0,0 +1,2 @@ +# redis runtime directory +d /run/redis 0755 redis root - diff --git a/dev-db/redis/metadata.xml b/dev-db/redis/metadata.xml new file mode 100644 index 00000000..74cc4cf9 --- /dev/null +++ b/dev-db/redis/metadata.xml @@ -0,0 +1,20 @@ + + + + + arkamar@gentoo.org + Petr Vaněk + + + sam@gentoo.org + Sam James + + + + Use tcmalloc from dev-util/google-perftools for allocations. + + + + redis/redis + + diff --git a/dev-db/redis/redis-6.2.5.ebuild b/dev-db/redis/redis-6.2.5.ebuild new file mode 100644 index 00000000..8d646d34 --- /dev/null +++ b/dev-db/redis/redis-6.2.5.ebuild @@ -0,0 +1,188 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +# Redis does NOT build with Lua 5.2 or newer at this time: +# - 5.3 and 5.4 give: +# lua_bit.c:83:2: error: #error "Unknown number type, check LUA_NUMBER_* in luaconf.h" +# - 5.2 fails with: +# scripting.c:(.text+0x1f9b): undefined reference to `lua_open' +# because lua_open became lua_newstate in 5.2 +LUA_COMPAT=( lua5-1 luajit ) + +inherit autotools flag-o-matic lua-single systemd toolchain-funcs tmpfiles + +DESCRIPTION="A persistent caching system, key-value and data structures database" +HOMEPAGE="https://redis.io" +SRC_URI="https://download.redis.io/releases/${P}.tar.gz" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="amd64 arm arm64 ~hppa ppc ppc64 ~riscv sparc x86 ~amd64-linux ~x86-linux ~x86-solaris" +IUSE="+jemalloc ssl systemd tcmalloc test" +RESTRICT="!test? ( test )" + +COMMON_DEPEND=" + ${LUA_DEPS} + jemalloc? ( >=dev-libs/jemalloc-5.1:= ) + ssl? ( dev-libs/openssl:0= ) + systemd? ( sys-apps/systemd:= ) + tcmalloc? ( dev-util/google-perftools ) +" + +RDEPEND=" + ${COMMON_DEPEND} + acct-group/redis + acct-user/redis +" + +BDEPEND=" + ${COMMON_DEPEND} + virtual/pkgconfig +" + +# Tcl is only needed in the CHOST test env +DEPEND=" + ${COMMON_DEPEND} + test? ( + dev-lang/tcl:0= + ssl? ( dev-tcltk/tls ) + )" + +REQUIRED_USE="?? ( jemalloc tcmalloc ) + ${LUA_REQUIRED_USE}" + +PATCHES=( + "${FILESDIR}"/${PN}-6.2.1-config.patch + "${FILESDIR}"/${PN}-6.2.1-sharedlua.patch + "${FILESDIR}"/${PN}-6.2.3-ppc-atomic.patch + "${FILESDIR}"/${PN}-sentinel-5.0-config.patch +) + +src_prepare() { + default + + # unstable on jemalloc + > tests/unit/memefficiency.tcl || die + + # Copy lua modules into build dir + cp "${S}"/deps/lua/src/{fpconv,lua_bit,lua_cjson,lua_cmsgpack,lua_struct,strbuf}.c "${S}"/src || die + cp "${S}"/deps/lua/src/{fpconv,strbuf}.h "${S}"/src || die + # Append cflag for lua_cjson + # https://github.com/antirez/redis/commit/4fdcd213#diff-3ba529ae517f6b57803af0502f52a40bL61 + append-cflags "-DENABLE_CJSON_GLOBAL" + + # now we will rewrite present Makefiles + local makefiles="" MKF + 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-3.2 configure.ac || die + + # Use the correct pkgconfig name for Lua. + # The upstream configure script handles luajit specially, and is not + # effected by these changes. + sed -i \ + -e "/^AC_INIT/s|, [0-9].+, |, $PV, |" \ + -e "s:AC_CONFIG_FILES(\[Makefile\]):AC_CONFIG_FILES([${makefiles}]):g" \ + -e "/PKG_CHECK_MODULES.*\/s,lua5.1,${ELUA},g" \ + configure.ac || die "Sed failed for configure.ac" + eautoreconf +} + +src_configure() { + econf $(use_with lua_single_target_luajit luajit) + + # 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() { + local myconf="" + + if use jemalloc; then + myconf+="MALLOC=jemalloc" + elif use tcmalloc; then + myconf+="MALLOC=tcmalloc" + else + myconf+="MALLOC=libc" + fi + + if use ssl; then + myconf+=" BUILD_TLS=yes" + fi + + export USE_SYSTEMD=$(usex systemd) + + tc-export AR CC RANLIB + emake V=1 ${myconf} AR="${AR}" CC="${CC}" RANLIB="${RANLIB}" +} + +src_test() { + # Known to fail with FEATURES=usersandbox + if has usersandbox ${FEATURES}; then + ewarn "You are emerging ${P} with 'usersandbox' enabled." \ + "Expect some test failures or emerge with 'FEATURES=-usersandbox'!" + fi + + if use ssl; then + ./utils/gen-test-certs.sh + ./runtest --tls + else + ./runtest + fi +} + +src_install() { + insinto /etc/redis + doins redis.conf sentinel.conf + use prefix || fowners -R redis:redis /etc/redis /etc/redis/{redis,sentinel}.conf + fperms 0750 /etc/redis + fperms 0644 /etc/redis/{redis,sentinel}.conf + + newconfd "${FILESDIR}/redis.confd-r2" redis + newinitd "${FILESDIR}/redis.initd-6" redis + + systemd_newunit "${FILESDIR}/redis.service-4" redis.service + newtmpfiles "${FILESDIR}/redis.tmpfiles-2" redis.conf + + newconfd "${FILESDIR}/redis-sentinel.confd-r1" redis-sentinel + newinitd "${FILESDIR}/redis-sentinel.initd-r1" redis-sentinel + + insinto /etc/logrotate.d/ + newins "${FILESDIR}/${PN}.logrotate" ${PN} + + dodoc 00-RELEASENOTES BUGS CONTRIBUTING MANIFESTO README.md + + dobin src/redis-cli + dosbin src/redis-benchmark src/redis-server src/redis-check-aof src/redis-check-rdb + fperms 0750 /usr/sbin/redis-benchmark + dosym 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 +} + +pkg_postinst() { + tmpfiles_process redis.conf + + ewarn "The default redis configuration file location changed to:" + ewarn " /etc/redis/{redis,sentinel}.conf" + ewarn "Please apply your changes to the new configuration files." +}