From e3f21c8aff8a76afe3423721c437a088e9232840 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Tue, 23 Apr 2024 23:59:27 +0100 Subject: gentoo auto-resync : 23:04:2024 - 23:59:26 --- dev-db/redict/Manifest | 14 ++ dev-db/redict/files/redict-7.3.0-config.patch | 40 ++++ .../files/redict-7.3.0-system-hiredict.patch | 240 +++++++++++++++++++++ .../files/redict-7.3.0-system-jemalloc.patch | 173 +++++++++++++++ .../files/redict-sentinel-7.3.0-config.patch | 27 +++ dev-db/redict/files/redict-sentinel.confd | 16 ++ dev-db/redict/files/redict-sentinel.initd | 22 ++ dev-db/redict/files/redict.confd | 20 ++ dev-db/redict/files/redict.initd | 25 +++ dev-db/redict/files/redict.logrotate | 6 + dev-db/redict/files/redict.service | 14 ++ dev-db/redict/files/redict.tmpfiles | 2 + dev-db/redict/metadata.xml | 20 ++ dev-db/redict/redict-7.3.0.ebuild | 159 ++++++++++++++ 14 files changed, 778 insertions(+) create mode 100644 dev-db/redict/Manifest create mode 100644 dev-db/redict/files/redict-7.3.0-config.patch create mode 100644 dev-db/redict/files/redict-7.3.0-system-hiredict.patch create mode 100644 dev-db/redict/files/redict-7.3.0-system-jemalloc.patch create mode 100644 dev-db/redict/files/redict-sentinel-7.3.0-config.patch create mode 100644 dev-db/redict/files/redict-sentinel.confd create mode 100644 dev-db/redict/files/redict-sentinel.initd create mode 100644 dev-db/redict/files/redict.confd create mode 100644 dev-db/redict/files/redict.initd create mode 100644 dev-db/redict/files/redict.logrotate create mode 100644 dev-db/redict/files/redict.service create mode 100644 dev-db/redict/files/redict.tmpfiles create mode 100644 dev-db/redict/metadata.xml create mode 100644 dev-db/redict/redict-7.3.0.ebuild (limited to 'dev-db/redict') diff --git a/dev-db/redict/Manifest b/dev-db/redict/Manifest new file mode 100644 index 000000000000..e93742e59c67 --- /dev/null +++ b/dev-db/redict/Manifest @@ -0,0 +1,14 @@ +AUX redict-7.3.0-config.patch 1490 BLAKE2B 99cb977e9e9ce39f9d4440d98bfea3ba8af7c8fa5ae3ba5b1144622d02f62cb43ac6a4653811d9b138edce1f6a6026389a66795ef85a4ac53e23df5240161197 SHA512 cd26f712af024aa866ce393be478190519304bf614e99b5871bb30be593cdbaf5c71bc353efb4141e31dd284896e0f106bb72bb2eb4a1b436e47279ef6cadee0 +AUX redict-7.3.0-system-hiredict.patch 7707 BLAKE2B c3169965031710fa10674f0b14c6ff46a770b010058f0fbe163ce7ca8cee01ed79df34a04e0cbedfed68400c8df5f54e005c96639bd890d92aeff9145f3a26da SHA512 12642a0e17f1cd4d8c6946cd9e2cd87c60171d5d7f06fed0f7ac85c49c972358d7b2fff1691b6e6e3430df5798451f625bab5a247ce2d9bf87bf06fa2b47fed5 +AUX redict-7.3.0-system-jemalloc.patch 5719 BLAKE2B 63f4fb05c6027677ed057acedf2e3b4bce9cf988147ca399c79e01322006eea67ebeee26761b2bcbc89ca926ed7bb736d51cb31eafc3d059ba47620cc7ee108b SHA512 9367d04cfc59216f1302599b999d8b5da25ccf2cf5dae8475629d81e79849a4006cc6736fe12b08f7c3603a91984c9cd5ba8c362fa04a74d0e686d399a42a503 +AUX redict-sentinel-7.3.0-config.patch 964 BLAKE2B 5bed0c1fa1fcd6ca0dd3d2b5099080ceac59605c5f75624c9bdb502726894bbeba549f5a5d97ada32a5ee9905bc13ba8e4ab41aa43f6d5611af70a1ce251490b SHA512 d05ff11d77582c10d5f109d8f0b24ec0bf3deb056fd335d40201d36fd3fe344e86aa5d0b0ed2916e9d05679ca49f46b20a7e297c5e701063289c71dd55e99a37 +AUX redict-sentinel.confd 487 BLAKE2B 9db09634f7f8aad966b281a4aa0a8b931fe59b52cd4f6c6ecedc20f705bfff408055c1fee6117380c14967af65c6e52db8ede4461bf6e4bd7e027496e031c49f SHA512 bc68b69eb79a01c7daea2e460844ac577415781eb4e947e7a0b2f8cd15a5f728345edef94a3838183c57b056945770e9eff7891e9d853c1a63746df5e16e42d7 +AUX redict-sentinel.initd 666 BLAKE2B d7161df83904c9247f8bda19f8521c035a0012535e42dc2ab532937333613f485d5347e4931d7226a5eb11fd1b684508b83d71bfba787aef10546e4852bd920f SHA512 c00335bd8f62da0b04302fc33f6bf8e36d5ef8e117cc61b1cb219eb6068837794fcf3d19657612efbc61c06a03ae6af36d471bc72831ec04e0d533f74eca9bc1 +AUX redict.confd 535 BLAKE2B 3ac737e7d7f21cd32babf8be705dc494ffc9c0f8c92828cc4b39079477a8abdfb091e9b9d4cb53ae00706942ba4f80f303001bd2785d18f2952d331b979a967d SHA512 fac7aac54a312a561a52eb2c81b9160f9cd6cf0b29eb20aa6499b86ab89fd54ee65698e2df416fe90abd617ff18914526026685d3ff1d00344232aa9e2ba5e5b +AUX redict.initd 716 BLAKE2B b7aea41ba6f0124719a6f9be99b9f22233994d57829749542e581bdf1ee7fcb2bbe4303552ff7f0b5e2dc51c48272e98ab9d16b8feccba9d9d12e1b7bb11d4d4 SHA512 4e8c373dc617761ed7d45c672b4b571c9ee667029bf0c6c6b95f088947f8b035bfdba0e437c09ee5573e2285c787c323274d75a36536abd85805d0c2a52b5694 +AUX redict.logrotate 108 BLAKE2B ed7c2f04a7994b88a18fee851775bb2fb964bd835b26a7498ea27e57bf275a3f5b4bf6bd9642f390f5d42159f242d0f83ffac10b5f36ec8cdbab64d4ff6fe9cf SHA512 63f1af50b7e9e7e90cf2c3f83013c6484c8020c14c519161d7d0bf3045ca9f90d1032d40bebf59aba906ad5929cd84ec9ef45556d60a83dc75cd148ef4984a88 +AUX redict.service 262 BLAKE2B 1e6eec3426fe0890a767ae8365313d4e28a5746d79aecf88a1bf26a5a9c8ee425bfb7726a4436e64d9c6a34d75f32903a1fe8359e61f509a8b226cf3013bf7d9 SHA512 131a06df2b4b0cd5a0ed5ad0b3022d698d21c4aa5a502d92508de64707f0a4cd41482c196eba83549aebfc193640530af945ebb6213eb0f30d6ee9d204acd4fe +AUX redict.tmpfiles 60 BLAKE2B 79f15e360cb2fbdc07a676a17a438fb5d85cb0252505e5fb86d52294eb5f6fc304c5dde98149e344223b11e599901fdd2f0cba6dbb09400b5afbbb3c0190e7c7 SHA512 4e81318de5760e152403b44ec3ee0b18a9be602501143bb2d2b0841608ea5460fc890fb211264d7c80ac363b2295e14bd06d51ea7bd6259f28c9b947d322a30a +DIST redict-7.3.0.tar.gz 3414514 BLAKE2B dd2ce2fdd8fbede33ddea9fee34e81535b0948a8963fb0d3391aac32ddf786e5cce996d1d405d81182ef6098ab8389b3c71b95ff9d8cbc68637746538e36999d SHA512 d33f4dfaf728f5a22abe7a6223f3192c39dc41a32e7bcb0f453caaa859f35b512534979c26ced9f4458c19611debd282f37955e930151c0f827035f349647226 +EBUILD redict-7.3.0.ebuild 3719 BLAKE2B e374237bad6af40ff0ac618e6c73a18beaee7842147eac8d1d3e016aa84320dcc40903d7ef42a6841571f054bf9e439d99afaaaa76555d11a52b5a404e8443d9 SHA512 4bf94148055fa1fa6bb77a2acb9ef21564af2484d9a14d4c902769addf12d7a7232163f18867c78c022ce5c158b99f6511a5bf0c95db8f8487bbf000cd5d16c1 +MISC metadata.xml 610 BLAKE2B 0c61950ab5459b6122247c049a2f18373fa5bd21496882d4478f7e9d91683d6978f23997cbe3ce11bde346d9ad0bcad810a358f719aea6355c86466f0299f08e SHA512 65141d43ca54cf57962b24a5d5cacb3894675994a0b87b561216a6c7a26526bf5f9b4952c23eadd1e4598c56d9b147b219ef010fe62e0cc8f500f8bc4cb40366 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 ++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 +Date: Sun, 14 Apr 2024 11:52:21 +0300 +Subject: [PATCH 1/2] Add ability to use system hiredict + +Co-authored-by: Chris Lamb +Signed-off-by: Maytham Alsudany +--- + 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 +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 +--- + 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 +Subject: Fix hiredict imports +Forwarded: no + +--- a/src/cli_common.c ++++ b/src/cli_common.c +@@ -13,15 +13,15 @@ + #include + #include + #include +-#include +-#include ++#include ++#include + #include + #include + #include + #ifdef USE_OPENSSL + #include + #include +-#include ++#include + #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 +-#include ++#include ++#include + + typedef struct cliSSLconfig { + /* Requested SNI, or NULL */ +--- a/src/redict-benchmark.c ++++ b/src/redict-benchmark.c +@@ -19,13 +19,13 @@ + #include + #include + +-#include ++#include + #include "ae.h" +-#include ++#include + #ifdef USE_OPENSSL + #include + #include +-#include ++#include + #endif + #include "adlist.h" + #include "dict.h" +--- a/src/redict-cli.c ++++ b/src/redict-cli.c +@@ -23,13 +23,13 @@ + #include + #include + +-#include ++#include + #ifdef USE_OPENSSL + #include + #include +-#include ++#include + #endif +-#include ++#include + #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 + #include + 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 +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 +Signed-off-by: Maytham Alsudany +--- + 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 + #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 +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 +--- + 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..f2d4afcd3cad --- /dev/null +++ b/dev-db/redict/files/redict-sentinel.initd @@ -0,0 +1,22 @@ +#!/sbin/openrc-run +# Copyright 1999-2024 Gentoo Authors +# 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..80b086fbfce1 --- /dev/null +++ b/dev-db/redict/files/redict.initd @@ -0,0 +1,25 @@ +#!/sbin/openrc-run +# Copyright 1999-2024 Gentoo Authors +# 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 @@ + + + + + navi@vlhl.dev + Anna (navi) Figueiredo Gomes + + + proxy-maint@gentoo.org + Proxy Maintainers + + + redict/redict + + + + Use tcmalloc from dev-util/google-perftools for allocations. + + + 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 +} -- cgit v1.2.3