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:
c5ed702b27
This commit is contained in:
Lukas Javorsky 2026-03-05 14:02:38 +01:00
parent a818c111e7
commit e6bdff2cbc
3 changed files with 81 additions and 16 deletions

View File

@ -1,2 +0,0 @@
%valkey_modules_abi 1
%valkey_modules_dir %{_libdir}/valkey/modules

61
valkey-conf.patch Normal file
View File

@ -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.

View File

@ -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 <ljavorsk@redhat.com> - 8.0.7-1
- Rebase to 8.0.7 for CVE-2026-21863 CVE-2025-67733