diff options
author | Anna (navi) Figueiredo Gomes <navi@vlhl.dev> | 2024-04-18 01:52:18 +0200 |
---|---|---|
committer | Petr Vaněk <arkamar@gentoo.org> | 2024-04-23 16:31:23 +0200 |
commit | 2b352f5973ac3936330344ab66a6b5da776d542d (patch) | |
tree | a48bdae84b2c82665675caecc29a3805e4944250 /dev-db/redict | |
parent | acct-user/redict: new package, add 0 (diff) | |
download | gentoo-2b352f5973ac3936330344ab66a6b5da776d542d.tar.gz gentoo-2b352f5973ac3936330344ab66a6b5da776d542d.tar.bz2 gentoo-2b352f5973ac3936330344ab66a6b5da776d542d.zip |
dev-db/redict: new package, add 7.3.0
Based on the redis 7.2.4-r1 ebuild. Without use of a custom
configure.ac, and with aditional patches to make use of system
packages for jemalloc and hiredict.
Closes: https://bugs.gentoo.org/928119
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
Closes: https://github.com/gentoo/gentoo/pull/36176
Signed-off-by: Petr Vaněk <arkamar@gentoo.org>
Diffstat (limited to 'dev-db/redict')
-rw-r--r-- | dev-db/redict/Manifest | 1 | ||||
-rw-r--r-- | dev-db/redict/files/redict-7.3.0-config.patch | 40 | ||||
-rw-r--r-- | dev-db/redict/files/redict-7.3.0-system-hiredict.patch | 240 | ||||
-rw-r--r-- | dev-db/redict/files/redict-7.3.0-system-jemalloc.patch | 173 | ||||
-rw-r--r-- | dev-db/redict/files/redict-sentinel-7.3.0-config.patch | 27 | ||||
-rw-r--r-- | dev-db/redict/files/redict-sentinel.confd | 16 | ||||
-rw-r--r-- | dev-db/redict/files/redict-sentinel.initd | 22 | ||||
-rw-r--r-- | dev-db/redict/files/redict.confd | 20 | ||||
-rw-r--r-- | dev-db/redict/files/redict.initd | 25 | ||||
-rw-r--r-- | dev-db/redict/files/redict.logrotate | 6 | ||||
-rw-r--r-- | dev-db/redict/files/redict.service | 14 | ||||
-rw-r--r-- | dev-db/redict/files/redict.tmpfiles | 2 | ||||
-rw-r--r-- | dev-db/redict/metadata.xml | 20 | ||||
-rw-r--r-- | dev-db/redict/redict-7.3.0.ebuild | 159 |
14 files changed, 765 insertions, 0 deletions
diff --git a/dev-db/redict/Manifest b/dev-db/redict/Manifest new file mode 100644 index 000000000000..a15faf344ca6 --- /dev/null +++ b/dev-db/redict/Manifest @@ -0,0 +1 @@ +DIST redict-7.3.0.tar.gz 3414514 BLAKE2B dd2ce2fdd8fbede33ddea9fee34e81535b0948a8963fb0d3391aac32ddf786e5cce996d1d405d81182ef6098ab8389b3c71b95ff9d8cbc68637746538e36999d SHA512 d33f4dfaf728f5a22abe7a6223f3192c39dc41a32e7bcb0f453caaa859f35b512534979c26ced9f4458c19611debd282f37955e930151c0f827035f349647226 diff --git a/dev-db/redict/files/redict-7.3.0-config.patch b/dev-db/redict/files/redict-7.3.0-config.patch new file mode 100644 index 000000000000..aab0df2e1a45 --- /dev/null +++ b/dev-db/redict/files/redict-7.3.0-config.patch @@ -0,0 +1,40 @@ +diff --git a/redict.conf b/redict.conf +index 465d56f..ef56037 100644 +--- a/redict.conf ++++ b/redict.conf +@@ -276,7 +276,7 @@ daemonize no + # + # Note that on modern Linux systems "/run/redict.pid" is more conforming + # and should be used instead. +-pidfile /var/run/redict_6379.pid ++pidfile /run/redict/redict.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 + # redict 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/redict/redict.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/redict/ + + ################################# 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 <bytes> ++maxmemory 64MB + + # MAXMEMORY POLICY: how redict will select what to remove when maxmemory + # is reached. You can select one from the following behaviors: diff --git a/dev-db/redict/files/redict-7.3.0-system-hiredict.patch b/dev-db/redict/files/redict-7.3.0-system-hiredict.patch new file mode 100644 index 000000000000..53b9d93087d4 --- /dev/null +++ b/dev-db/redict/files/redict-7.3.0-system-hiredict.patch @@ -0,0 +1,240 @@ +# Patch from https://codeberg.org/redict/redict/pulls/44 +# and https://salsa.debian.org/redict-team/redict/-/blob/1d2b9f08f3dcc7ba4f03ddd9066545d0fd6b716e/debian/patches/0005-Fix-hiredict-imports.patch +# The first patch got upstreamed, the second will be soon + +From ffb9f03106de48a2a09d60f691a8852a0cf917ad Mon Sep 17 00:00:00 2001 +From: Maytham Alsudany <maytha8thedev@gmail.com> +Date: Sun, 14 Apr 2024 11:52:21 +0300 +Subject: [PATCH 1/2] Add ability to use system hiredict + +Co-authored-by: Chris Lamb <lamby@debian.org> +Signed-off-by: Maytham Alsudany <maytha8thedev@gmail.com> +--- + deps/Makefile | 2 ++ + src/Makefile | 27 ++++++++++++++++++++++----- + 2 files changed, 24 insertions(+), 5 deletions(-) + +diff --git a/deps/Makefile b/deps/Makefile +index 345e1f703..e071cfa03 100644 +--- a/deps/Makefile ++++ b/deps/Makefile +@@ -36,7 +36,9 @@ ifneq ($(shell sh -c '[ -f .make-ldflags ] && cat .make-ldflags || echo none'), + endif + + distclean: ++ifneq ($(USE_SYSTEM_HIREDICT),yes) + -(cd hiredict && $(MAKE) clean) > /dev/null || true ++endif + -(cd linenoise && $(MAKE) clean) > /dev/null || true + -(cd lua && $(MAKE) clean) > /dev/null || true + ifneq ($(USE_SYSTEM_JEMALLOC),yes) +diff --git a/src/Makefile b/src/Makefile +index fbcc20f02..8ca30a6df 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -24,7 +24,7 @@ endif + ifneq ($(OPTIMIZATION),-O0) + OPTIMIZATION+=-fno-omit-frame-pointer + endif +-DEPENDENCY_TARGETS=hiredict linenoise lua hdr_histogram fpconv ++DEPENDENCY_TARGETS=linenoise lua hdr_histogram fpconv + NODEPS:=clean distclean + + # Default settings +@@ -226,7 +226,7 @@ ifdef OPENSSL_PREFIX + endif + + # Include paths to dependencies +-FINAL_CFLAGS+= -I../deps/hiredict -I../deps/linenoise -I../deps/lua/src -I../deps/hdr_histogram -I../deps/fpconv ++FINAL_CFLAGS+= -I../deps/linenoise -I../deps/lua/src -I../deps/hdr_histogram -I../deps/fpconv + + # Determine systemd support and/or build preference (defaulting to auto-detection) + BUILD_WITH_SYSTEMD=no +@@ -277,6 +277,15 @@ else + endif + endif + ++ifeq ($(USE_SYSTEM_HIREDICT),yes) ++ FINAL_LIBS+= $(shell $(PKG_CONFIG) --libs hiredict) ++ FINAL_CFLAGS+= $(shell $(PKG_CONFIG) --cflags hiredict) ++else ++ DEPENDENCY_TARGETS += hiredict ++ FINAL_LIBS+= ../deps/hiredict/libhiredict.a ++ FINAL_CFLAGS+= -I../deps/hiredict ++endif ++ + # LIBSSL & LIBCRYPTO + LIBSSL_LIBS= + LIBSSL_PKGCONFIG := $(shell $(PKG_CONFIG) --exists libssl && echo $$?) +@@ -299,15 +308,23 @@ BUILD_MODULE:=2 + ifeq ($(BUILD_TLS),yes) + FINAL_CFLAGS+=-DUSE_OPENSSL=$(BUILD_YES) $(OPENSSL_CFLAGS) -DBUILD_TLS_MODULE=$(BUILD_NO) + FINAL_LDFLAGS+=$(OPENSSL_LDFLAGS) ++ifeq ($(USE_SYSTEM_HIREDICT),yes) ++ FINAL_LIBS += $(shell $(PKG_CONFIG) --libs hiredict_ssl) $(LIBSSL_LIBS) $(LIBCRYPTO_LIBS) ++else + FINAL_LIBS += ../deps/hiredict/libhiredict_ssl.a $(LIBSSL_LIBS) $(LIBCRYPTO_LIBS) + endif ++endif + + TLS_MODULE= + TLS_MODULE_NAME:=redict-tls$(PROG_SUFFIX).so + TLS_MODULE_CFLAGS:=$(FINAL_CFLAGS) + ifeq ($(BUILD_TLS),module) + FINAL_CFLAGS+=-DUSE_OPENSSL=$(BUILD_MODULE) $(OPENSSL_CFLAGS) ++ifeq ($(USE_SYSTEM_HIREDICT),yes) ++ TLS_CLIENT_LIBS = $(shell $(PKG_CONFIG) --libs hiredict_ssl) $(LIBSSL_LIBS) $(LIBCRYPTO_LIBS) ++else + TLS_CLIENT_LIBS = ../deps/hiredict/libhiredict_ssl.a $(LIBSSL_LIBS) $(LIBCRYPTO_LIBS) ++endif + TLS_MODULE=$(TLS_MODULE_NAME) + TLS_MODULE_CFLAGS+=-DUSE_OPENSSL=$(BUILD_MODULE) $(OPENSSL_CFLAGS) -DBUILD_TLS_MODULE=$(BUILD_MODULE) + endif +@@ -406,7 +423,7 @@ endif + + # redict-server + $(REDICT_SERVER_NAME): $(REDICT_SERVER_OBJ) +- $(REDICT_LD) -o $@ $^ ../deps/hiredict/libhiredict.a ../deps/lua/src/liblua.a ../deps/hdr_histogram/libhdrhistogram.a ../deps/fpconv/libfpconv.a $(FINAL_LIBS) ++ $(REDICT_LD) -o $@ $^ ../deps/lua/src/liblua.a ../deps/hdr_histogram/libhdrhistogram.a ../deps/fpconv/libfpconv.a $(FINAL_LIBS) + + # redict-sentinel + $(REDICT_SENTINEL_NAME): $(REDICT_SERVER_NAME) +@@ -426,11 +443,11 @@ $(TLS_MODULE_NAME): $(REDICT_SERVER_NAME) + + # redict-cli + $(REDICT_CLI_NAME): $(REDICT_CLI_OBJ) +- $(REDICT_LD) -o $@ $^ ../deps/hiredict/libhiredict.a ../deps/linenoise/linenoise.o $(FINAL_LIBS) $(TLS_CLIENT_LIBS) ++ $(REDICT_LD) -o $@ $^ ../deps/linenoise/linenoise.o $(FINAL_LIBS) $(TLS_CLIENT_LIBS) + + # redict-benchmark + $(REDICT_BENCHMARK_NAME): $(REDICT_BENCHMARK_OBJ) +- $(REDICT_LD) -o $@ $^ ../deps/hiredict/libhiredict.a ../deps/hdr_histogram/libhdrhistogram.a $(FINAL_LIBS) $(TLS_CLIENT_LIBS) ++ $(REDICT_LD) -o $@ $^ ../deps/hdr_histogram/libhdrhistogram.a $(FINAL_LIBS) $(TLS_CLIENT_LIBS) + + DEP = $(REDICT_SERVER_OBJ:%.o=%.d) $(REDICT_CLI_OBJ:%.o=%.d) $(REDICT_BENCHMARK_OBJ:%.o=%.d) + -include $(DEP) +-- +2.39.2 + + +From bd55c900ac123db05b7243f6e958e311a622fb7d Mon Sep 17 00:00:00 2001 +From: Maytham Alsudany <maytha8thedev@gmail.com> +Date: Sun, 14 Apr 2024 11:53:13 +0300 +Subject: [PATCH 2/2] Mention USE_SYSTEM_HIREDICT setting in README + +Signed-off-by: Maytham Alsudany <maytha8thedev@gmail.com> +--- + README.md | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/README.md b/README.md +index ae77a235a..cf4944e6f 100644 +--- a/README.md ++++ b/README.md +@@ -25,6 +25,8 @@ You can pass the following variables to Redict to customize the build: + * `USE_JEMALLOC=no MALLOC=libc`: use the libc allocator rather than jemalloc + * `USE_SYSTEM_JEMALLOC=yes`: use the system's installed jemalloc libraries + rather than the vendored copy. ++* `USE_SYSTEM_HIREDICT=yes`: use the system's installed hiredict libraries ++ rather than the vendored copy. + * `BUILD_TLS=yes`: build with TLS support. Requires OpenSSL. + * `USE_SYSTEMD=yes`: build with systemd support. Requires libsystemd. + * `PROG_SUFFIX="-suffix"`: Append "-suffix" to executable names +-- +2.39.2 + +From: Maytham Alsudany <maytha8thedev@gmail.com> +Subject: Fix hiredict imports +Forwarded: no + +--- a/src/cli_common.c ++++ b/src/cli_common.c +@@ -13,15 +13,15 @@ + #include <stdlib.h> + #include <fcntl.h> + #include <errno.h> +-#include <hiredict.h> +-#include <sds.h> ++#include <hiredict/hiredict.h> ++#include <hiredict/sds.h> + #include <unistd.h> + #include <string.h> + #include <ctype.h> + #ifdef USE_OPENSSL + #include <openssl/ssl.h> + #include <openssl/err.h> +-#include <hiredict_ssl.h> ++#include <hiredict/hiredict_ssl.h> + #endif + + #define UNUSED(V) ((void) V) +--- a/src/cli_common.h ++++ b/src/cli_common.h +@@ -7,8 +7,8 @@ + #ifndef __CLICOMMON_H + #define __CLICOMMON_H + +-#include <hiredict.h> +-#include <sds.h> ++#include <hiredict/hiredict.h> ++#include <hiredict/sds.h> + + typedef struct cliSSLconfig { + /* Requested SNI, or NULL */ +--- a/src/redict-benchmark.c ++++ b/src/redict-benchmark.c +@@ -19,13 +19,13 @@ + #include <math.h> + #include <pthread.h> + +-#include <sds.h> ++#include <hiredict/sds.h> + #include "ae.h" +-#include <hiredict.h> ++#include <hiredict/hiredict.h> + #ifdef USE_OPENSSL + #include <openssl/ssl.h> + #include <openssl/err.h> +-#include <hiredict_ssl.h> ++#include <hiredict/hiredict_ssl.h> + #endif + #include "adlist.h" + #include "dict.h" +--- a/src/redict-cli.c ++++ b/src/redict-cli.c +@@ -23,13 +23,13 @@ + #include <math.h> + #include <termios.h> + +-#include <hiredict.h> ++#include <hiredict/hiredict.h> + #ifdef USE_OPENSSL + #include <openssl/ssl.h> + #include <openssl/err.h> +-#include <hiredict_ssl.h> ++#include <hiredict/hiredict_ssl.h> + #endif +-#include <sds.h> ++#include <hiredict/sds.h> + #include "dict.h" + #include "adlist.h" + #include "zmalloc.h" +--- a/src/sentinel.c ++++ b/src/sentinel.c +@@ -6,12 +6,12 @@ + // SPDX-License-Identifier: LGPL-3.0-only + + #include "server.h" +-#include "hiredict.h" ++#include "hiredict/hiredict.h" + #if USE_OPENSSL == 1 /* BUILD_YES */ + #include "openssl/ssl.h" +-#include "hiredict_ssl.h" ++#include "hiredict/hiredict_ssl.h" + #endif +-#include "async.h" ++#include "hiredict/async.h" + + #include <ctype.h> + #include <arpa/inet.h> + diff --git a/dev-db/redict/files/redict-7.3.0-system-jemalloc.patch b/dev-db/redict/files/redict-7.3.0-system-jemalloc.patch new file mode 100644 index 000000000000..802b573dee83 --- /dev/null +++ b/dev-db/redict/files/redict-7.3.0-system-jemalloc.patch @@ -0,0 +1,173 @@ +# Patch comes from https://codeberg.org/redict/redict/pulls/40 +# https://codeberg.org/redict/redict/pulls/42 +# and https://codeberg.org/redict/redict/pulls/43 +# All got merged upstream and should be removed next release. + +From 5defea5b98859f4e1162b82120114e222b2a7465 Mon Sep 17 00:00:00 2001 +From: Maytham Alsudany <maytha8thedev@gmail.com> +Date: Wed, 10 Apr 2024 01:10:49 +0300 +Subject: [PATCH 1/2] Add ability to use system jemalloc + +This time, this shouldn't cause CI tests to fail. + +Co-authored-by: Chris Lamb <lamby@debian.org> +Signed-off-by: Maytham Alsudany <maytha8thedev@gmail.com> +--- + deps/Makefile | 2 ++ + src/Makefile | 8 +++++++- + src/debug.c | 3 +++ + src/object.c | 5 +++++ + src/sds.c | 4 ++++ + src/zmalloc.c | 4 ++++ + src/zmalloc.h | 4 ++++ + 7 files changed, 29 insertions(+), 1 deletion(-) + +diff --git a/deps/Makefile b/deps/Makefile +index 9a273aefc..345e1f703 100644 +--- a/deps/Makefile ++++ b/deps/Makefile +@@ -39,7 +39,9 @@ distclean: + -(cd hiredict && $(MAKE) clean) > /dev/null || true + -(cd linenoise && $(MAKE) clean) > /dev/null || true + -(cd lua && $(MAKE) clean) > /dev/null || true ++ifneq ($(USE_SYSTEM_JEMALLOC),yes) + -(cd jemalloc && [ -f Makefile ] && $(MAKE) distclean) > /dev/null || true ++endif + -(cd hdr_histogram && $(MAKE) clean) > /dev/null || true + -(cd fpconv && $(MAKE) clean) > /dev/null || true + -(rm -f .make-*) +diff --git a/src/Makefile b/src/Makefile +index 0739466b6..d399c6eb2 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -266,10 +266,16 @@ ifeq ($(MALLOC),tcmalloc_minimal) + endif + + ifeq ($(MALLOC),jemalloc) ++ FINAL_CFLAGS+= -DUSE_JEMALLOC ++ifeq ($(USE_SYSTEM_JEMALLOC),yes) ++ FINAL_CFLAGS+= -DUSE_SYSTEM_JEMALLOC $(shell $(PKG_CONFIG) --cflags jemalloc) ++ FINAL_LIBS := $(shell $(PKG_CONFIG) --libs jemalloc) $(FINAL_LIBS) ++else + DEPENDENCY_TARGETS+= jemalloc +- FINAL_CFLAGS+= -DUSE_JEMALLOC -I../deps/jemalloc/include ++ FINAL_CFLAGS+= -I../deps/jemalloc/include + FINAL_LIBS := ../deps/jemalloc/lib/libjemalloc.a $(FINAL_LIBS) + endif ++endif + + # LIBSSL & LIBCRYPTO + LIBSSL_LIBS= +diff --git a/src/debug.c b/src/debug.c +index 89d33bfd7..2257d655e 100644 +--- a/src/debug.c ++++ b/src/debug.c +@@ -56,6 +56,9 @@ void bugReportEnd(int killViaSignal, int sig); + void logStackTrace(void *eip, int uplevel, int current_thread); + void sigalrmSignalHandler(int sig, siginfo_t *info, void *secret); + ++#if defined(USE_JEMALLOC) && defined(USE_SYSTEM_JEMALLOC) ++#define je_mallctl mallctl ++#endif + /* ================================= Debugging ============================== */ + + /* Compute the sha1 of string at 's' with 'len' bytes long. +diff --git a/src/object.c b/src/object.c +index cf7811e81..5da8fbcc9 100644 +--- a/src/object.c ++++ b/src/object.c +@@ -15,6 +15,11 @@ + #define strtold(a,b) ((long double)strtod((a),(b))) + #endif + ++#if defined(USE_JEMALLOC) && defined(USE_SYSTEM_JEMALLOC) ++#define je_mallctl mallctl ++#define je_malloc_stats_print malloc_stats_print ++#endif ++ + /* ===================== Creation and parsing of objects ==================== */ + + robj *createObject(int type, void *ptr) { +diff --git a/src/sds.c b/src/sds.c +index 0a295132c..a1ac73d5a 100644 +--- a/src/sds.c ++++ b/src/sds.c +@@ -24,6 +24,10 @@ + #include "sds.h" + #include "sdsalloc.h" + ++#if defined(USE_JEMALLOC) && defined(USE_SYSTEM_JEMALLOC) ++#define je_nallocx nallocx ++#endif ++ + const char *SDS_NOINIT = "SDS_NOINIT"; + + static inline int sdsHdrSize(char type) { +diff --git a/src/zmalloc.c b/src/zmalloc.c +index d737e2b14..7187599aa 100644 +--- a/src/zmalloc.c ++++ b/src/zmalloc.c +@@ -56,6 +56,9 @@ void zlibc_free(void *ptr) { + #define free(ptr) tc_free(ptr) + /* Explicitly override malloc/free etc when using jemalloc. */ + #elif defined(USE_JEMALLOC) ++#if defined(USE_SYSTEM_JEMALLOC) ++#define je_mallctl mallctl ++#else + #define malloc(size) je_malloc(size) + #define calloc(count,size) je_calloc(count,size) + #define realloc(ptr,size) je_realloc(ptr,size) +@@ -63,6 +66,7 @@ void zlibc_free(void *ptr) { + #define mallocx(size,flags) je_mallocx(size,flags) + #define dallocx(ptr,flags) je_dallocx(ptr,flags) + #endif ++#endif + + #define update_zmalloc_stat_alloc(__n) atomicIncr(used_memory,(__n)) + #define update_zmalloc_stat_free(__n) atomicDecr(used_memory,(__n)) +diff --git a/src/zmalloc.h b/src/zmalloc.h +index df7d290da..c10858439 100644 +--- a/src/zmalloc.h ++++ b/src/zmalloc.h +@@ -27,7 +27,11 @@ + #include <jemalloc/jemalloc.h> + #if (JEMALLOC_VERSION_MAJOR == 2 && JEMALLOC_VERSION_MINOR >= 1) || (JEMALLOC_VERSION_MAJOR > 2) + #define HAVE_MALLOC_SIZE 1 ++#if defined(USE_SYSTEM_JEMALLOC) ++#define zmalloc_size(p) malloc_usable_size(p) ++#else + #define zmalloc_size(p) je_malloc_usable_size(p) ++#endif + #else + #error "Newer version of jemalloc required" + #endif +-- +2.39.2 + + +From 940b0fab0318f5f306a67d0818635acc522402c4 Mon Sep 17 00:00:00 2001 +From: Maytham Alsudany <maytha8thedev@gmail.com> +Date: Wed, 10 Apr 2024 01:11:24 +0300 +Subject: [PATCH 2/2] Mention USE_SYSTEM_JEMALLOC setting in README + +Signed-off-by: Maytham Alsudany <maytha8thedev@gmail.com> +--- + README.md | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/README.md b/README.md +index 14caf183d..ae77a235a 100644 +--- a/README.md ++++ b/README.md +@@ -23,6 +23,8 @@ toolchain, and GNU make. To build Redict, simply run "make". + You can pass the following variables to Redict to customize the build: + + * `USE_JEMALLOC=no MALLOC=libc`: use the libc allocator rather than jemalloc ++* `USE_SYSTEM_JEMALLOC=yes`: use the system's installed jemalloc libraries ++ rather than the vendored copy. + * `BUILD_TLS=yes`: build with TLS support. Requires OpenSSL. + * `USE_SYSTEMD=yes`: build with systemd support. Requires libsystemd. + * `PROG_SUFFIX="-suffix"`: Append "-suffix" to executable names +-- +2.39.2 + diff --git a/dev-db/redict/files/redict-sentinel-7.3.0-config.patch b/dev-db/redict/files/redict-sentinel-7.3.0-config.patch new file mode 100644 index 000000000000..8ed5da34b598 --- /dev/null +++ b/dev-db/redict/files/redict-sentinel-7.3.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, redict Sentinel writes a pid file in + # /var/run/redict-sentinel.pid by default. You can specify a custom pid file + # location here. +-pidfile /var/run/redict-sentinel.pid ++pidfile /run/redict-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/redict/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/redict/files/redict-sentinel.confd b/dev-db/redict/files/redict-sentinel.confd new file mode 100644 index 000000000000..e168b46b14f7 --- /dev/null +++ b/dev-db/redict/files/redict-sentinel.confd @@ -0,0 +1,16 @@ +# Redict-sentinel user. +REDICT_SENTINEL_USER="redict" + +# Redict-sentinel group. +REDICT_SENTINEL_GROUP="redict" + +# Redict-sentinel configuration file. +REDICT_SENTINEL_CONF="/etc/redict/sentinel.conf" + +# Redict-sentinel working directory. +REDICT_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/redict/files/redict-sentinel.initd b/dev-db/redict/files/redict-sentinel.initd new file mode 100644 index 000000000000..71bc19e2b7f1 --- /dev/null +++ b/dev-db/redict/files/redict-sentinel.initd @@ -0,0 +1,22 @@ +#!/sbin/openrc-run +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +: ${REDICT_SENTINEL_DIR:=/tmp} +: ${REDICT_SENTINEL_CONF:=/etc/redict/sentinel.conf} +: ${REDICT_SENTINEL_USER:=redict} +: ${REDICT_SENTINEL_GROUP:=redict} +: ${REDICT_SENTINEL_TIMEOUT:=30} + +depend() { + use localmount logger + after keepalived redict +} + +command="/usr/sbin/redict-sentinel" +command_args="${REDICT_SENTINEL_CONF}" +command_background="true" +command_user="${REDICT_SENTINEL_USER}:${REDICT_SENTINEL_GROUP}" +pidfile="/run/${RC_SVCNAME}.pid" +retry="${REDICT_SENTINEL_TIMEOUT}" +start_stop_daemon_args="--chdir \"${REDICT_SENTINEL_DIR}\"" diff --git a/dev-db/redict/files/redict.confd b/dev-db/redict/files/redict.confd new file mode 100644 index 000000000000..02814e18f140 --- /dev/null +++ b/dev-db/redict/files/redict.confd @@ -0,0 +1,20 @@ +# Redict user. +REDICT_USER="redict" + +# Redict group. +REDICT_GROUP="redict" + +# Redict configuration file. +REDICT_CONF="/etc/redict/redict.conf" + +# Redict dump directory. +REDICT_DIR="/var/lib/redict" + +# Redict options. +# (Redict expects the first argument to be the configuration file.) +REDICT_OPTS="${REDICT_CONF}" + +# Specify the network service that corresponds to the "bind" setting +# in your redict.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/redict/files/redict.initd b/dev-db/redict/files/redict.initd new file mode 100644 index 000000000000..90e1aa867658 --- /dev/null +++ b/dev-db/redict/files/redict.initd @@ -0,0 +1,25 @@ +#!/sbin/openrc-run +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +: ${REDICT_DIR:=/var/lib/redict} +: ${REDICT_CONF:=/etc/redict/redict.conf} +: ${REDICT_OPTS:="${REDICT_CONF}"} +: ${REDICT_USER:=redict} +: ${REDICT_GROUP:=redict} +: ${REDICT_TIMEOUT:=30} + +# https://bugs.gentoo.org/631002#c10 +# Force '--daemonize no' to override the config file +command="/usr/sbin/redict-server" +command_args="${REDICT_OPTS} --daemonize no" +command_background="true" +command_user="${REDICT_USER}:${REDICT_GROUP}" +pidfile="/run/${RC_SVCNAME}.pid" +retry="${REDICT_TIMEOUT}" +start_stop_daemon_args="--chdir \"${REDICT_DIR}\"" + +depend() { + use localmount logger + after keepalived +} diff --git a/dev-db/redict/files/redict.logrotate b/dev-db/redict/files/redict.logrotate new file mode 100644 index 000000000000..01608529dac4 --- /dev/null +++ b/dev-db/redict/files/redict.logrotate @@ -0,0 +1,6 @@ +/var/log/redict/redict.log /var/log/redict/sentinel.log { + compress + delaycompress + notifempty + missingok +} diff --git a/dev-db/redict/files/redict.service b/dev-db/redict/files/redict.service new file mode 100644 index 000000000000..97fabd001d8e --- /dev/null +++ b/dev-db/redict/files/redict.service @@ -0,0 +1,14 @@ +[Unit] +Description=A persistent key-value database +After=syslog.target network.target + +[Service] +Type=simple +PIDFile=/run/redict/redict.pid +ExecStart=/usr/sbin/redict-server /etc/redict/redict.conf +User=redict +Group=redict + +[Install] +WantedBy=multi-user.target + diff --git a/dev-db/redict/files/redict.tmpfiles b/dev-db/redict/files/redict.tmpfiles new file mode 100644 index 000000000000..45e56d32afe7 --- /dev/null +++ b/dev-db/redict/files/redict.tmpfiles @@ -0,0 +1,2 @@ +# redict runtime directory +d /run/redict 0755 redict root - diff --git a/dev-db/redict/metadata.xml b/dev-db/redict/metadata.xml new file mode 100644 index 000000000000..e00573fa4b5a --- /dev/null +++ b/dev-db/redict/metadata.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person" proxied="yes"> + <email>navi@vlhl.dev</email> + <name>Anna (navi) Figueiredo Gomes</name> + </maintainer> + <maintainer type="project" proxied="proxy"> + <email>proxy-maint@gentoo.org</email> + <name>Proxy Maintainers</name> + </maintainer> + <upstream> + <remote-id type="codeberg">redict/redict</remote-id> + </upstream> + <use> + <flag name="tcmalloc"> + Use tcmalloc from <pkg>dev-util/google-perftools</pkg> for allocations. + </flag> + </use> +</pkgmetadata> diff --git a/dev-db/redict/redict-7.3.0.ebuild b/dev-db/redict/redict-7.3.0.ebuild new file mode 100644 index 000000000000..b53bf105c3a1 --- /dev/null +++ b/dev-db/redict/redict-7.3.0.ebuild @@ -0,0 +1,159 @@ +# Copyright 2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +# N.B.: It is no clue in porting to Lua eclasses, as upstream have deviated +# too far from vanilla Lua, adding their own APIs like lua_enablereadonlytable + +inherit edo multiprocessing systemd tmpfiles toolchain-funcs + +DESCRIPTION="A persistent caching system, key-value, and data structures database" +HOMEPAGE="https://redict.io" + +SRC_URI="https://codeberg.org/redict/redict/archive/${PV/_/-}.tar.gz -> ${P}.tar.gz" + +S=${WORKDIR}/${PN} + +LICENSE="BSD Boost-1.0 LGPL-3" +SLOT="0/$(ver_cut 1-2)" +KEYWORDS="~amd64" +IUSE="+jemalloc ssl systemd tcmalloc test" +RESTRICT="!test? ( test )" + +REQUIRED_USE="?? ( jemalloc tcmalloc )" + +RDEPEND=" + acct-group/redict + acct-user/redict + dev-libs/hiredict:0=[ssl?] + jemalloc? ( >=dev-libs/jemalloc-5.1:=[stats] ) + ssl? ( dev-libs/openssl:0= ) + systemd? ( sys-apps/systemd:= ) + tcmalloc? ( dev-util/google-perftools ) +" + +DEPEND="${RDEPEND}" + +BDEPEND=" + virtual/pkgconfig + test? ( + dev-lang/tcl:0= + ssl? ( dev-tcltk/tls ) + ) +" + +PATCHES=( + "${FILESDIR}"/redict-7.3.0-config.patch + "${FILESDIR}"/redict-sentinel-7.3.0-config.patch + "${FILESDIR}"/redict-7.3.0-system-jemalloc.patch + "${FILESDIR}"/redict-7.3.0-system-hiredict.patch +) + +src_prepare() { + default + + # Respect user CFLAGS in bundled lua + sed -i '/LUA_CFLAGS/s: -O2::g' deps/Makefile || die +} + +_build() { + tc-export AR CC RANLIB + local myconf=( + AR="${AR}" + CC="${CC}" + RANLIB="${RANLIB}" + CFLAGS="${CFLAGS}" + LDFLAGS="${LDFLAGS}" + V=1 # verbose + OPTIMIZATION= + DEBUG= + DEBUG_FLAGS= + BUILD_TLS=$(usex ssl) + USE_SYSTEMD=$(usex systemd) + USE_SYSTEM_HIREDICT=yes + ) + + if use jemalloc; then + myconf+=( + MALLOC=jemalloc + USE_SYSTEM_JEMALLOC=yes + ) + elif use tcmalloc; then + myconf+=( MALLOC=tcmalloc ) + else + myconf+=( MALLOC=libc ) + fi + + emake -C src "${myconf[@]}" "$@" +} + +src_compile() { + _build +} + +src_test() { + local runtestargs=( + --clients "$(makeopts_jobs)" # see bug #649868 + + --skiptest "Active defrag eval scripts" # see bug #851654 + ) + + if has usersandbox ${FEATURES} || ! has userpriv ${FEATURES}; then + ewarn "oom-score-adj related tests will be skipped." \ + "They are known to fail with FEATURES usersandbox or -userpriv. See bug #756382." + + runtestargs+=( + # unit/oom-score-adj was introduced in version 6.2.0 + --skipunit unit/oom-score-adj # see bug #756382 + + # Following test was added in version 7.0.0 to unit/introspection. + # It also tries to adjust OOM score. + --skiptest "CONFIG SET rollback on apply error" + ) + fi + + if use ssl; then + edo ./utils/gen-test-certs.sh + runtestargs+=( --tls ) + fi + + edo ./runtest "${runtestargs[@]}" +} + +src_install() { + insinto /etc/redict + doins redict.conf sentinel.conf + use prefix || fowners -R redict:redict /etc/redict /etc/redict/{redict,sentinel}.conf + + newconfd "${FILESDIR}/redict.confd" redict + newinitd "${FILESDIR}/redict.initd" redict + + systemd_newunit "${FILESDIR}/redict.service" redict.service + newtmpfiles "${FILESDIR}/redict.tmpfiles" redict.conf + + newconfd "${FILESDIR}/redict-sentinel.confd" redict-sentinel + newinitd "${FILESDIR}/redict-sentinel.initd" redict-sentinel + + insinto /etc/logrotate.d/ + newins "${FILESDIR}/redict.logrotate" "${PN}" + + _build DESTDIR="${ED}" PREFIX="/usr" install + + if use prefix; then + diropts -m0750 + else + diropts -m0750 -o redict -g redict + fi + keepdir /var/{log,lib}/redict +} + +pkg_postinst() { + tmpfiles_process redict.conf + + if has_version dev-db/redis && [[ -z "${REPLACING_VERSIONS}" ]]; then + ewarn "Redict uses different configuration files than redis:" + ewarn "/etc/redict/{redict,sentinel}.conf" + ewarn "Please apply your changes to the new configuration files." + fi +} |