From e6bdff2cbcfd89d8376bacde85df58ac16235f0b Mon Sep 17 00:00:00 2001 From: Lukas Javorsky Date: Thu, 5 Mar 2026 14:02:38 +0100 Subject: [PATCH] Use patch for configuration changes Add /etc/valkey/modules drop-in directory for module configuration files Add %valkey_modules_cfg macro Related: RHEL-119350 Fedora commit: https://src.fedoraproject.org/rpms/valkey/c/c5ed702b27beed691bdb8a6b062c58bd5a85bdca?branch=f43 --- macros.valkey | 2 -- valkey-conf.patch | 61 +++++++++++++++++++++++++++++++++++++++++++++++ valkey.spec | 34 +++++++++++++++----------- 3 files changed, 81 insertions(+), 16 deletions(-) delete mode 100644 macros.valkey create mode 100644 valkey-conf.patch diff --git a/macros.valkey b/macros.valkey deleted file mode 100644 index f27c41d..0000000 --- a/macros.valkey +++ /dev/null @@ -1,2 +0,0 @@ -%valkey_modules_abi 1 -%valkey_modules_dir %{_libdir}/valkey/modules diff --git a/valkey-conf.patch b/valkey-conf.patch new file mode 100644 index 0000000..55badf7 --- /dev/null +++ b/valkey-conf.patch @@ -0,0 +1,61 @@ +diff -up ./sentinel.conf.rpm ./sentinel.conf +--- ./sentinel.conf.rpm 2025-07-24 10:05:46.477794769 +0200 ++++ ./sentinel.conf 2025-07-24 10:07:27.023483441 +0200 +@@ -17,7 +17,7 @@ daemonize no + # When running daemonized, Valkey Sentinel writes a pid file in + # /var/run/valkey-sentinel.pid by default. You can specify a custom pid file + # location here. +-pidfile /var/run/valkey-sentinel.pid ++pidfile /run/valkey/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/valkey/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. +diff -up ./valkey.conf.rpm ./valkey.conf +--- ./valkey.conf.rpm 2025-07-24 10:05:46.475591081 +0200 ++++ ./valkey.conf 2025-07-24 10:07:23.219331838 +0200 +@@ -43,6 +43,9 @@ + # include /path/to/other.conf + # include /path/to/fragments/*.conf + # ++# Module configuration files ++include /etc/valkey/modules/*.conf ++ + + ################################## MODULES ##################################### + +@@ -153,7 +156,7 @@ tcp-backlog 511 + # incoming connections. There is no default, so the server will not listen + # on a unix socket when not specified. + # +-# unixsocket /run/valkey.sock ++unixsocket /run/valkey/valkey.sock + # unixsocketgroup wheel + # unixsocketperm 700 + +@@ -385,7 +388,7 @@ daemonize no + # + # Note that on modern Linux systems "/run/valkey.pid" is more conforming + # and should be used instead. +-pidfile /var/run/valkey_6379.pid ++pidfile /run/valkey/valkey.pid + + # Specify the server verbosity level. + # This can be one of: +@@ -416,7 +419,7 @@ loglevel notice + # Specify the log file name. Also the empty string can be used to force + # the server 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/valkey/valkey.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. diff --git a/valkey.spec b/valkey.spec index f6cee41..86972b7 100644 --- a/valkey.spec +++ b/valkey.spec @@ -18,12 +18,13 @@ Source2: %{name}-sentinel.service Source3: %{name}.service Source4: %{name}.sysusers Source5: %{name}.tmpfiles -Source8: macros.%{name} Source9: migrate_redis_to_valkey.sh Patch1: valkey-cve-2025-27151.patch +# Fix default paths in configuration files for RPM layout +Patch2: %{name}-conf.patch # Workaround to https://github.com/valkey-io/valkey/issues/2678 -Patch2: %{name}-loadmod.patch +Patch3: %{name}-loadmod.patch BuildRequires: make BuildRequires: gcc @@ -53,6 +54,7 @@ Provides: bundled(fpconv) %global valkey_modules_abi 1 %global valkey_modules_dir %{_libdir}/%{name}/modules +%global valkey_modules_cfg %{_sysconfdir}/%{name}/modules Provides: valkey(modules_abi)%{?_isa} = %{valkey_modules_abi} ExcludeArch: %{ix86} @@ -120,7 +122,8 @@ BuildArch: noarch %prep %setup -qn %{name}-%{version} %patch -P1 -p1 -%patch -P2 -p1 -b .loadmod +%patch -P2 -p1 -b.rpm +%patch -P3 -p1 -b .loadmod mv deps/lua/COPYRIGHT COPYRIGHT-lua mv deps/jemalloc/COPYING COPYING-jemalloc @@ -142,19 +145,17 @@ sed -e 's/--with-lg-quantum/--with-lg-page=16 --with-lg-quantum/' -i deps/Makefi api=`sed -n -e 's/#define VALKEYMODULE_APIVER_[0-9][0-9]* //p' src/valkeymodule.h` if test "$api" != "%{valkey_modules_abi}"; then : Error: Upstream API version is now ${api}, expecting %%{valkey_modules_abi}. - : Update the valkey_modules_abi macro, the rpmmacros file, and rebuild. + : Update the valkey_modules_abi macro, and rebuild. exit 1 fi - -sed -i -e 's|^logfile .*$|logfile /var/log/valkey/valkey.log|g' \ - -e 's|^# unixsocket .*$|unixsocket /run/valkey/valkey.sock|g' \ - -e 's|^pidfile .*$|pidfile /run/valkey/valkey.pid|g' \ - valkey.conf - -sed -i -e 's|^logfile .*$|logfile /var/log/valkey/sentinel.log|g' \ - -e 's|^pidfile .*$|pidfile /run/valkey/sentinel.pid|g' \ - sentinel.conf +# Generates macro file +cat << 'EOF' | tee macros.%{name} +%%valkey_version %version +%%valkey_modules_abi %valkey_modules_abi +%%valkey_modules_dir %valkey_modules_dir +%%valkey_modules_cfg %valkey_modules_cfg +EOF %if (%{defined fedora} && 0%{?fedora} < 42) || (%{defined rhel} && 0%{?rhel} < 10) # these lines are for conditionals around sysconfig to valkey.conf porting scriptlets to avoid re-runs @@ -198,6 +199,7 @@ install -pDm644 %{S:1} %{buildroot}%{_sysconfdir}/logrotate.d/%{name} # Install configuration files. install -pDm640 %{name}.conf %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf install -pDm640 sentinel.conf %{buildroot}%{_sysconfdir}/%{name}/sentinel.conf +install -dm750 %{buildroot}%{valkey_modules_cfg} # Install systemd unit files. mkdir -p %{buildroot}%{_unitdir} @@ -212,7 +214,7 @@ install -pDm644 src/%{name}module.h %{buildroot}%{_includedir}/%{name}module.h # Install rpm macros for valkey modules #mkdir -p %{buildroot}%{_rpmmacrodir} -install -pDm644 %{S:8} %{buildroot}%{_rpmmacrodir}/macros.%{name} +install -pDm644 macros.%{name} %{buildroot}%{_rpmmacrodir}/macros.%{name} # compat script install -Dpm 755 %{S:9} %{buildroot}%{_libexecdir}/migrate_redis_to_valkey.sh @@ -264,6 +266,7 @@ taskset -c 1 ./runtest --clients 50 --skiptest "Active defrag - AOF loading" %license COPYING-hiredis-BSD-3-Clause %config(noreplace) %{_sysconfdir}/logrotate.d/%{name} %attr(0750, valkey, root) %dir %{_sysconfdir}/%{name} +%attr(0750, valkey, root) %dir %{valkey_modules_cfg} %attr(0640, valkey, root) %config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf %attr(0640, valkey, root) %config(noreplace) %{_sysconfdir}/%{name}/sentinel.conf %dir %{_libdir}/%{name} @@ -300,6 +303,9 @@ taskset -c 1 ./runtest --clients 50 --skiptest "Active defrag - AOF loading" reported as https://github.com/valkey-io/valkey/issues/2678 using patch from https://github.com/valkey-io/valkey/pull/2689 - add sub-package for rdma module +- use patch for configuration changes +- add /etc/valkey/modules drop-in directory for module configuration files +- add %%valkey_version and %%valkey_modules_cfg macros * Mon Mar 02 2026 Lukas Javorsky - 8.0.7-1 - Rebase to 8.0.7 for CVE-2026-21863 CVE-2025-67733