Skip to content

Commit

Permalink
fix redis jemalloc compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
blueSherii committed Sep 24, 2024
1 parent c3fc12a commit 4982905
Show file tree
Hide file tree
Showing 8 changed files with 688 additions and 80 deletions.
26 changes: 25 additions & 1 deletion dev-db/redis/Manifest
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
DIST redis-6.2.5.tar.gz 2465302 BLAKE2B 51cc672ab432bb87560151521289d04e8fefb8e4df820f58a9b742131a0f1960c0019dec42a601bad827ec2a172375b88b6cf32a19aef42964e18f5a7a911c40 SHA512 8c54451032cbb627ec2827251556cba2010e56544baca7ea117b5afd2c2add484acbedd3baf21bdb8fd10672602cf52294a4e26b135c1406d7a723c048275e3a
AUX configure.ac-3.2 1882 BLAKE2B b8bc3e04c3203977218ee1d6d68e9f841b84fe82ab8803027034237275fb548cde282748a2f96bc25532e61f8e25a50cba9e165aac578d5db634a7ffc587ee9e SHA512 13d9f16cde8a95c96bcd726056d670d390dea6e2752ac607bc68eefb6214f0ab18b0e27d3283f2b219febd2da82e6489bd434215c9380c3c85c711aa00cb2be5
AUX configure.ac-7.0 1523 BLAKE2B fc05fd3fd13bf192d2a52096c89bfb87d6660c19b9c88f0c2d5541262626338146870441f361d5d6b9d19133e7c01d912b2f99d4db39e66627ddf2158e860a98 SHA512 de1c16ad2b89a99a34a0b3f2e341efe69bd879efbddeee44d96398ba2a1ef9896c69a9aed13fc24b25992f61019d3c9026c57504cffd4e5910ca2606d5a48d1e
AUX redis-5.0-shared.patch 883 BLAKE2B 71a490d5c40d873db7d363c4f3cab966bf8e92fa84bcb7209344b79b3bfc4c6f8df5224c8ae0e5d9ee8dbd62d9e288e90934809e91fd6f63c7d1dd4a518170a9 SHA512 f1d1e37a4786a84e9543956e21644a1dcfdc52742299119ba1547b9fb56a92fdef3ca518d94a1db8a88222b661ac7849a4db0bf7ba38b1ae65f286e7df90f0c1
AUX redis-6.2.1-config.patch 1477 BLAKE2B bc87272e52b44fc58e7e8b08b5d97e53c9ba22eab02f89c3803d02e526c6c5eb1df5d1565021d96dabf8b9936dfc0b2c27c9dd148d1968d98d31d10470687741 SHA512 da2a2f4321fc4f5fef4db1e399bd6a011c18a997b28c4355ed4284d07c24a5038f086f7dcbb26d4534d800baf9be0634cf53466524a8323d16ad542042d89d98
AUX redis-6.2.3-ppc-atomic.patch 465 BLAKE2B 9324bb198f03a3e5043986adaac170f30f378f5835a53e1c749ccf3392edcfecb22f4f7ae2b325ced3b06bf20535a243daa138073014a109e6e54b27d736dde5 SHA512 803ea4e1dfcb2f87187a0294051bf91f4e67a9b7de421dca20fe8b574741dc454f83fe1eadac7a4ef5d29b7a707a9dc2a56479f8d86c9e82de6332b21101456f
AUX redis-7.0.4-no-which.patch 1876 BLAKE2B 9461bdfac73c21d338fbac0a41d64ecb4c14f993b2932ae2df35317529cec399ef9163ce8ebae012dd215d755c3d5a2527bb6f8647ffb0cc6365e1a67a19a331 SHA512 eb22bb26642f1c602bb2fd4b08af7de9036c0acc5fb2a4139608bec10962031f0515f31fc18c7dcd1f8352359fc381a752ac6f63adc01b46df853019bd886d16
AUX redis-7.2.0-system-jemalloc.patch 879 BLAKE2B c511606969b5f9876fa6481f0e6abf441732342299e0be3b0517541ca428ddc745a1692a0f703c5fe62442c5c2e5697e86d37b4e771f433d9dc9bfa5fa19f100 SHA512 605b3f4f41b8539e50a0fa1aa924e6d1fa7e8a80dfc03ed46a33c8b25a3bb43b4ab668c991150afd1dea5d86b8252c00c03f1582b3b0f47242127dc149819463
AUX redis-sentinel-5.0-config.patch 706 BLAKE2B 0fa0166bbb3460e783e85b90acf4c606b83e271d8e9828bb5b3a39b623508b21dac33369ac25b645169271822e9c5deb6ea7294e40fc8d1a5ceec5129c174505 SHA512 2dee5666d50fc5d9b6021735a95c9a9647ba99c562e348785381d5a05f1388c3fb9e8c4a15b0de771cf73fb80e5e29f1df25805df749457a2ce4f2e3f2e0e9e8
AUX redis-sentinel-7.2.0-config.patch 959 BLAKE2B c94c2a291a4ccc42272115528bf774978cae88d8f0e4f5dd17d2f3f407a719afa9381e76a589f654563393966d24d76d01282b92bb0a7d6106fa9dabb6f12a14 SHA512 6ad97df345bf07f4d3bd8fc05d52d4e495a723ecaeec961b7e3b27e94a89ac949b5a52fd62f4a4a1ec2e2b4e962878ab65e0a47f742c8bfd0e83b076455d8811
AUX redis-sentinel.confd-r1 476 BLAKE2B e06aba8c65637a02dd7c778e7ddeb1ee8f25abbe24cea6d9ab90aee0ab512d36ad342dc4aba73c792533c561a00413a6432c6a635246e2fa7f44d2c4cf244972 SHA512 be2bdfa5efa5c55294da382e0d648c06788e77df150acbb2004ac3fe88d8545992787df4a5dd585e5e5fed9a9018e55e03e5f048601d5401795c37a476232c9f
AUX redis-sentinel.initd-r1 654 BLAKE2B 064f7ac04ead49052aa221d295067df5cd23081bf7a65546d680281eeb4fcf0fe42c4d756917b0aa05f110be84b142d23410ba4829e1d82725826f788107f235 SHA512 b483902f343a52a4f285d7aed6a56c3bd8e820eb5f3e8805c4bd93c0df009e944e6479fea6060bc07b493d655d995ae8e6f91548c2e512215a5966abdb0aa6a6
AUX redis.confd-r2 517 BLAKE2B 2b1834796373e28d759058f2867d88d506d1b4ca34f143abc38b4fb55c602dab44aca9ecbdb5ddfb7fd2400be1d86108b7521d6cbedda5be73eecf48cdef73de SHA512 64dfb4d4de21f5415cce1b031b627b9d42b10b10ad4de6a5f60b9a617f9e688b449b527d34ce9caba1c4817ac31246a684ca15e2b04e6d9458d5e59cd739fc09
AUX redis.initd-6 701 BLAKE2B f2e47fa903e7f397250435c215d33f9d63766a718c2a045aa0d8744fb9ecf2b9824a6889e75c2ee8fa0b88e306a5f9b6e12cbc07699a66fe88b60712e330fd97 SHA512 d755f797905a233315f162c674e2f83dc5a629eb6b178d1de17af6080565a021c2f6ee048cdeeb06d8baa5a741b3bcc408c395649045aef04f1080c44ebc776b
AUX redis.logrotate 105 BLAKE2B 1281fd86d399b40aaaa69d1fe170b2c49523c074e14b12907428b676b03d510b680363dd5041428d5fddecb91a510baf53dfa57df66d697ba4846f1e49ab59fe SHA512 9cbd27732c7f8270bf9b8563df0964af142d1ac4e97417e495fcb02e730e93fdfafac9370188a2fce040d55d6c3704e284a50b6300616a3f13a03a6e25c1ae49
AUX redis.service-4 255 BLAKE2B e51cfbb7ce6586e7c16003e3b470be036e9c28b408c4ad71e90d084f5ee843eb2b0b60552735099564f99fc4b4c318980f2e1dde7ac69b32a54a636e663a7cd5 SHA512 786fb60e628146d5024fbee2c17bee26276f58b8d2f15c8eb0a416b1b2e870a1d82e7a1ef7155b7a489da8c89d6feae5b1207597bf6fcb929d7bcfddcae25937
AUX redis.tmpfiles-2 57 BLAKE2B 1e0577c1828bb693cf820f3ba5e77d7d748adf4df2d1910d465ce097765308c7b7ea729526404120d04a79b547e865df93f7bfce1e63341c73563496f1dce691 SHA512 3de050ce044b7daf71219ec61dee2bc31acef161319b87ec2963b23c72e8a4807f1302c4932897664a63ef94507449f6ab75ce18d59f5e1a4558c330a7042e43
DIST redis-6.2.14.tar.gz 2496149 BLAKE2B 689a0c3b558e07f43f8b1480fbf7a083184bbc0ccde0b184dc8a1d89ed22bec9694b7c8605ff729c9e9d582e8cf47c8f9cd9ee0794ea15e07cdb0b886e93c116 SHA512 140d4b23c20d459b65be8c61996e281222f978b51c52cb048039d741801e4027775ad89ed354dc0dce3d47703a08610adafaf6253fea2f973d5b9d20bc1e59ce
DIST redis-7.0.15.tar.gz 2994329 BLAKE2B fa1bc85c89cb6a6fb18710a4d29c20db44a80ce445d217f39a234a2aad1d79031e9d1fc45415af7b0eb1c169bd88f45f1fe60cab35de38c6fadc839e2a27676d SHA512 83d58f98085f91754f6d87810e7da0d6cf11ffbe11a0f5d3581d5b2c63d2a752ba6b4eda921a04031aedc56ecebe349cd468ab5ad837493f55d2cac0ab3d015a
DIST redis-7.2.5.tar.gz 3386454 BLAKE2B 5a0e5b0162f684ecd6db4a782a18a3c7bf272ec1ce38e2d2a4b5bc3966d968170f5b968e7f9946fd50d2b942c52298430eeccb386bbb443201eda6ac180c7f2b SHA512 e064a0f380e3a00ab8eb2f10ed7317fd6aa27d64cf00792fab80465036f92d17b166050e71b8a779fdf024528ac736cb54722316811f99951c4e386f4ab2245d
DIST redis-7.4.0.tar.gz 3525325 BLAKE2B 232e5d8db368e1a6c13e044ea40b4f4cd2b1f8f8d02319e408c8b0cfdbc6e4630ca2d38af080c5ccd1a4564da06f8cc761b54b00362f515edb11dc13c4853f78 SHA512 f5cd7566664f41a038f1078cd746b0a143ae543e035c363ae1ba60639830cc244d1536c84a95ce897b277bd0c4aad91a569e209dbb7917b7a2319805901a49d1
EBUILD redis-6.2.14-r1.ebuild 5480 BLAKE2B 03ab7cacdd2720e6b70e177f83814f5ebc4f5ccf010efca90b01fdabb9d553ce40f7e80c241cc90f9cf1f9d11746e3565a549fad345b93863277fa599026834b SHA512 7822951152271e852494c8500d17eeefe4e749cd0178b0a4ddf54810e063765d0cc0574bb448b815b4f15de5aa125f96926a5cf0f06a4d4eb07a4ff122cf8a5c
EBUILD redis-7.0.15-r1.ebuild 4940 BLAKE2B 9a3479bddd9566f08a9d7bca3aeb5be6ef5b1b9b06b6d0b27073983a4114ff087b3db05399e5f178c06d349c67cc8d695430fa6563a59c9b5944057601938bbe SHA512 93cd8775146b02b7b6a4296fc03f4802b5f7d8b6c12bf602d0bdd15d511cc8a6e022640a5ef8ceb241ece8083a3145ec6a4ef34fc879e72f0510c627145934be
EBUILD redis-7.2.5.ebuild 5024 BLAKE2B 54dfdbc184b04c83b20667bf5db958cb2a689c67051b3cab78ecf9bc968110bc5e886ca4d5f87713dce638f91826a210f9e73a846183af0e57f4da3ea34824b3 SHA512 f9e99196b5ccbec2dc7cbd4fc6d11b73c1fce0e56588e19147b0bd5ba6c9f15fe4f9bf69244e77b20797af7209ed4713938a9669012a2af5ba51b53cd1b1aa9e
EBUILD redis-7.4.0.ebuild 4860 BLAKE2B 1bae3712b3f54b5ccd373b0e53ed0fbe306fa03c41dde9910c5e71cc5b55acde590c8f03bc985a305ae3006a8c78ca24fa3db6d343c116177f880d2dee403a02 SHA512 6c8614e6a8538476835b49f8c7f0848b520aa82395c72a49f7c9b2853367d1b504747270f5f660154ad15239bc47c62498d8cb2a1f642832410ba72b24f8e41e
MISC metadata.xml 547 BLAKE2B 43d462a2c301c4431aa233467563140076269fec170063a9b5501fad2bad3afb9602aab971a5ef16997dd24cc5cfd27c9a9e194059b8db8784250cdae0fd5db3 SHA512 6b4549d4c296c19bc054175c7cf2d1af785d9217b4f298460be5ed08c0197ad8d6fdc29c998c85a5c6926947d99665265a008163e2dc15def2e1230ca6b561eb
2 changes: 1 addition & 1 deletion dev-db/redis/files/redis-7.0.4-no-which.patch
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
$since = {}
git_dir = File.dirname(__FILE__) ++ "/../.git"
-if File.directory?(git_dir) && `which git` != ""
+if File.directory?(git_dir) && `comamnd -v git` != ""
+if File.directory?(git_dir) && `command -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!
Expand Down
33 changes: 0 additions & 33 deletions dev-db/redis/files/redis-7.2.0-system-jemalloc.patch

This file was deleted.

154 changes: 154 additions & 0 deletions dev-db/redis/redis-6.2.14-r1.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

# 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 )

# Upstream have deviated too far from vanilla Lua, adding their own APIs
# like lua_enablereadonlytable, but we still need the eclass and such
# for bug #841422.
inherit autotools edo flag-o-matic lua-single multiprocessing systemd tmpfiles toolchain-funcs

DESCRIPTION="A persistent caching system, key-value, and data structures database"
HOMEPAGE="https://redis.io"
SRC_URI="https://github.com/redis/redis/archive/refs/tags/${P}.tar.gz"

LICENSE="BSD"
SLOT="0/$(ver_cut 1-2)"
KEYWORDS="amd64 ~arm arm64 ~hppa ~ppc ppc64 ~riscv ~s390 ~sparc x86 ~amd64-linux ~x86-linux"
IUSE="+jemalloc selinux ssl systemd tcmalloc test"
RESTRICT="!test? ( test )"

COMMON_DEPEND="
${LUA_DEPS}
ssl? ( dev-libs/openssl:0= )
systemd? ( sys-apps/systemd:= )
tcmalloc? ( dev-util/google-perftools )
"

RDEPEND="
${COMMON_DEPEND}
acct-group/redis
acct-user/redis
selinux? ( sec-policy/selinux-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}-sentinel-5.0-config.patch
)

src_prepare() {
default
}

src_configure() {
default
}

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() {
local runtestargs=(
--clients "$(makeopts_jobs)" # see bug #649868
)

if has usersandbox ${FEATURES} || ! has userpriv ${FEATURES}; then
ewarn "unit/oom-score-adj test will be skipped." \
"It is known to fail with FEATURES usersandbox or -userpriv. See bug #756382."

# unit/oom-score-adj was introduced in version 6.2.0
runtestargs+=( --skipunit unit/oom-score-adj ) # see bug #756382
fi

if use ssl; then
edo ./utils/gen-test-certs.sh
runtestargs+=( --tls )
fi

edo ./runtest "${runtestargs[@]}"
}

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."
}
47 changes: 2 additions & 45 deletions dev-db/redis/redis-6.2.5.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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"
SRC_URI="https://github.com/redis/redis/archive/refs/tags/${P}.tar.gz"

LICENSE="BSD"
SLOT="0"
Expand All @@ -25,7 +25,6 @@ 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 )
Expand Down Expand Up @@ -56,57 +55,15 @@ REQUIRED_USE="?? ( jemalloc tcmalloc )
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.*\<LUA\>/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
default
}

src_compile() {
Expand Down
Loading

0 comments on commit 4982905

Please sign in to comment.