summaryrefslogtreecommitdiffstats
path: root/valkey.spec
blob: e41fda6184629e36ea3018eb6e5c1b35f14b3658 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
# Docs require pandoc, which is not included in RHEL
%bcond_without docs

# Tests fail in mock, not in local build.
%bcond_with tests

# See https://github.com/valkey-io/valkey-doc/tags
%global doc_version 8.1.1

Name:              valkey
Version:           8.1.3
Release:           4%{?dist}
Summary:           A persistent key-value database
# valkey: BSD-3-Clause
# hiredis: BSD-3-Clause
# hdrhistogram, jemalloc, lzf, linenoise: BSD-2-Clause
# lua: MIT
# fpconv: BSL-1.0
License:           BSD-3-Clause AND BSD-2-Clause AND MIT AND BSL-1.0
URL:               https://valkey.io
Source0:           https://github.com/valkey-io/%{name}/archive/%{version}/%{name}-%{version}.tar.gz
Source1:           %{name}.logrotate
Source2:           %{name}-sentinel.service
Source3:           %{name}.service
Source4:           %{name}.sysusers
Source5:           %{name}.tmpfiles
Source50:          https://github.com/valkey-io/%{name}-doc/archive/%{doc_version}/%{name}-doc-%{doc_version}.tar.gz

# Fix default paths in configuration files for RPM layout
Patch0:            %{name}-conf.patch

BuildRequires:     make
BuildRequires:     gcc
%if %{with tests}
BuildRequires:     procps-ng
BuildRequires:     tcl
%endif
BuildRequires:     pkgconfig(libsystemd)
BuildRequires:     systemd-devel
%sysusers_requires_compat
%if 0%{?rhel}
BuildRequires:     epel-rpm-macros
%endif
BuildRequires:     systemd-rpm-macros
BuildRequires:     openssl-devel
%if %{with docs}
# for docs/man pages
BuildRequires:     pandoc
BuildRequires:     python3
BuildRequires:     python3-pyyaml
%endif

Requires:          logrotate
# from deps/hiredis/hiredis.h
Provides:          bundled(hiredis) = 1.0.3
# from deps/jemalloc/VERSION
Provides:          bundled(jemalloc) = 5.3.0
# from deps/lua/src/lua.h
Provides:          bundled(lua-libs) = 5.1.5
# from deps/linenoise/linenoise.h
Provides:          bundled(linenoise) = 1.0
Provides:          bundled(lzf)
# from deps/hdr_histogram/README.md
Provides:          bundled(hdr_histogram) = 0.11.0
# no version
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}

%description
Valkey is an advanced key-value store. It is often referred to as a data
structure server since keys can contain strings, hashes, lists, sets and
sorted sets.

You can run atomic operations on these types, like appending to a string;
incrementing the value in a hash; pushing to a list; computing set
intersection, union and difference; or getting the member with highest
ranking in a sorted set.

In order to achieve its outstanding performance, Valkey works with an
in-memory dataset. Depending on your use case, you can persist it either
by dumping the dataset to disk every once in a while, or by appending
each command to a log.

Valkey also supports trivial-to-setup master-slave replication, with very
fast non-blocking first synchronization, auto-reconnection on net split
and so forth.

Other features include Transactions, Pub/Sub, Lua scripting, Keys with a
limited time-to-live, and configuration settings to make Valkey behave like
a cache.

You can use Valkey from most programming languages also.

%package           devel
Summary:           Development header for Valkey module development
# Header-Only Library (https://fedoraproject.org/wiki/Packaging:Guidelines)
Provides:          %{name}-static = %{version}-%{release}

%description       devel
Header file required for building loadable Valkey modules.


%if %{with docs}
%package           doc
Summary:           Documentation and extra man pages for %{name}
BuildArch:         noarch
License:           CC-BY-SA-4.0

%description       doc
%summary
%endif


%prep
# no autosetup due to no support for multiple source extraction
%setup -n %{name}-%{version} -a50
%patch -P0 -p1 -b.rpm

mv deps/lua/COPYRIGHT             COPYRIGHT-lua
mv deps/jemalloc/COPYING          COPYING-jemalloc
mv deps/hiredis/COPYING COPYING-hiredis-BSD-3-Clause
mv deps/hdr_histogram/LICENSE.txt LICENSE-hdrhistogram
mv deps/hdr_histogram/COPYING.txt COPYING-hdrhistogram
mv deps/fpconv/LICENSE.txt        LICENSE-fpconv

# See https://bugzilla.redhat.com/2240293
# See https://src.fedoraproject.org/rpms/jemalloc/blob/rawhide/f/jemalloc.spec#_34
%ifarch %ix86 %arm x86_64 s390x
sed -e 's/--with-lg-quantum/--with-lg-page=12 --with-lg-quantum/' -i deps/Makefile
%endif
%ifarch ppc64 ppc64le aarch64
sed -e 's/--with-lg-quantum/--with-lg-page=16 --with-lg-quantum/' -i deps/Makefile
%endif

# Module API version safety check
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, and rebuild.
   exit 1
fi

# 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

%global make_flags DEBUG="" V="echo" PREFIX=%{buildroot}%{_prefix} BUILD_WITH_SYSTEMD=yes BUILD_TLS=yes


%build
%make_build %{make_flags}

%if %{with docs}
# docs
pushd %{name}-doc-%{doc_version}
# build man pages
%make_build VALKEY_ROOT=../
# build html docs
%make_build html VALKEY_ROOT=../
popd
%endif


%install
%make_install %{make_flags}
%if %{with docs}
# install docs
pushd %{name}-doc-%{doc_version}
# man pages
%make_install INSTALL_MAN_DIR=%{buildroot}%{_mandir} VALKEY_ROOT=../
# install html docs
install -d %{buildroot}%{_docdir}/%{name}/
cp -ra _build/html/* %{buildroot}%{_docdir}/%{name}/
# install doc license
install -d %{buildroot}%{_defaultlicensedir}/valkey-doc/
cp -a LICENSE %{buildroot}%{_defaultlicensedir}/valkey-doc/
popd
%endif

# remove sample confs
rm -rf %{buildroot}%{_datadir}/%{name}

# System user
install -p -D -m 0644 %{S:4} %{buildroot}%{_sysusersdir}/%{name}.conf

# Install tmpfiles.d file
install -p -D -m 0644 %{S:5} %{buildroot}%{_tmpfilesdir}/%{name}.conf

# Filesystem.
install -d %{buildroot}%{_sharedstatedir}/%{name}
install -d %{buildroot}%{_localstatedir}/log/%{name}
install -d %{buildroot}%{_localstatedir}/run/%{name}
install -d %{buildroot}%{valkey_modules_dir}

# Install logrotate file.
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}
install -pm644 %{S:3} %{buildroot}%{_unitdir}
install -pm644 %{S:2} %{buildroot}%{_unitdir}

# Fix non-standard-executable-perm error.
chmod 755 %{buildroot}%{_bindir}/%{name}-*

# Install valkey module header
install -pDm644 src/%{name}module.h %{buildroot}%{_includedir}/%{name}module.h

# Install rpm macros for valkey modules
#mkdir -p %{buildroot}%{_rpmmacrodir}
install -pDm644 macros.%{name} %{buildroot}%{_rpmmacrodir}/macros.%{name}

# Clean-up redis compatibility commands as redis package exists
rm %{buildroot}%{_bindir}/redis-*


%check
%if %{with tests}
# https://github.com/redis/redis/issues/1417 (for "taskset -c 1")
taskset -c 1 ./runtest --clients 50 --skiptest "Active defrag - AOF loading"

# sentinel tests fail in mock, but we want the normal tests above
#./runtest-sentinel
%endif


%systemd_post %{name}.service
%systemd_post %{name}-sentinel.service


%pre
%sysusers_create_compat %{SOURCE4}
exit 0


%preun
%systemd_preun %{name}.service
%systemd_preun %{name}-sentinel.service


%postun
%systemd_postun_with_restart %{name}.service
%systemd_postun_with_restart %{name}-sentinel.service


%files
%license COPYING
%license COPYRIGHT-lua
%license COPYING-jemalloc
%license LICENSE-hdrhistogram
%license COPYING-hdrhistogram
%license LICENSE-fpconv
%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}
%dir %{valkey_modules_dir}
%dir %attr(0750, valkey, valkey) %{_sharedstatedir}/%{name}
%dir %attr(0750, valkey, valkey) %{_localstatedir}/log/%{name}
%{_bindir}/%{name}-*
%{_unitdir}/%{name}.service
%{_unitdir}/%{name}-sentinel.service
%dir %attr(0755, valkey, valkey) %ghost %{_localstatedir}/run/%{name}
%{_sysusersdir}/%{name}.conf
%{_tmpfilesdir}/%{name}.conf
%if %{with docs}
%{_mandir}/man1/%{name}*.gz
%{_mandir}/man5/%{name}.conf.5.gz
%endif


%if %{with docs}
%files doc
%license LICENSE
%doc %{_docdir}/valkey/
%{_mandir}/man{3,7}/*%{name}*.gz
%endif


%files devel
# main package is not required
%license COPYING
%{_includedir}/%{name}module.h
%{_rpmmacrodir}/macros.%{name}


%changelog
* Wed Aug 27 2025 Remi Collet <remi@fedoraproject.org> - 8.1.3-4
- mising valkey user https://github.com/remicollet/remirepo/issues/315

* Tue Aug  5 2025 Remi Collet <remi@fedoraproject.org> - 8.1.3-3
- fix path to module configuration files

* Thu Jul 24 2025 Remi Collet <remi@fedoraproject.org> - 8.1.3-2
- use patch for configuration changes
- add /etc/valkey/modules drop-in directory for module configuration files
- add %%valkey_modules_cfg macro
- remove compatibility stuff

* Mon Jul  7 2025 Remi Collet <remi@fedoraproject.org> - 8.1.3-1
- update to 8.1.3
  fixes CVE-2025-CVE-2025-32023 and CVE-2025-48367

* Wed Jun 18 2025 Remi Collet <remi@fedoraproject.org> - 8.1.2-1
- update to 8.1.2
  fixes CVE-2025-27151

* Thu Apr 24 2025 Remi Collet <remi@fedoraproject.org> - 8.1.1-1
- update to 8.1.1
  fixes CVE-2025-21605

* Fri Apr 04 2025 Nathan Scott <nathans@redhat.com> - 8.1.0-1
- include tmpfiles.d configuration file
- redis.log transition rhbz#2316030
- update to 8.1.0 rhbz#22356280

* Tue Feb 11 2025 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 8.0.2-3
- Drop call to %sysusers_create_compat

* Sun Jan 19 2025 Fedora Release Engineering <releng@fedoraproject.org> - 8.0.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild

* Wed Jan 08 2025 Jonathan Wright <jonathan@almalinux.org> - 8.0.2-1
- update to 8.0.2 rhbz#2336259
  fixes CVE-2024-46981
  fixes CVE-2024-51741

* Wed Nov 13 2024 Jonathan Wright <jonathan@almalinux.org> - 8.0.1-3
- include license with doc sub-package
- include systemd symlinks for redis in compat package

* Mon Oct 07 2024 Jonathan Wright <jonathan@almalinux.org> - 8.0.1-2
- fix spec for epel8
- buildrequires python3 for docs

* Mon Oct 07 2024 Jonathan Wright <jonathan@almalinux.org> - 8.0.1-1
- update to 8.0.1 rhbz#2316254
  fixes CVE-2024-31449
  fixes CVE-2024-31227
  fixes CVE-2024-31228

* Fri Sep 27 2024 Yaakov Selkowitz <yselkowi@redhat.com> - 8.0.0-3
- Disable docs on RHEL

* Tue Sep 24 2024 Jonathan Wright <jonathan@almalinux.org> - 8.0.0-2
- add man pages rhbz#2276017
- add doc subpackage rhbz#2276020

* Mon Sep 16 2024 Jonathan Wright <jonathan@almalinux.org> - 8.0.0-1
- update to 8.0.0 rhbz#2312577

* Mon Aug 12 2024 Neal Gompa <ngompa@fedoraproject.org> - 7.2.6-2
- Add compat-redis-devel subpackage for Redis API Valkey modules
  Resolves: rhbz#2304083

* Mon Aug 05 2024 Jonathan Wright <jonathan@almalinux.org> - 7.2.6-1
- update to 7.2.6 rhbz#2302510

* Thu Aug  1 2024 Remi Collet <rcollet@redhat.com> - 7.2.5-11
- merge limit.conf in main service files
- fix obsoletes/conflicts up to 7.4

* Sat Jul 20 2024 Fedora Release Engineering <releng@fedoraproject.org> - 7.2.5-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild

* Mon Jul 15 2024 Jonathan Wright <jonathan@almalinux.org> - 7.2.5-9
- Fix journal warning rhbz#2297457

* Tue Jul 02 2024 Jonathan Wright <jonathan@almalinux.org> - 7.2.5-8
- Enable tests by default
  selectively disable tests that fail in mock for redis
  disable redis-sentinel tests, they always fail in mock

* Sat Jun 22 2024 Neal Gompa <ngompa@fedoraproject.org> - 7.2.5-7
- Enable automatic replacement of redis with valkey

* Mon Jun 17 2024 Jonathan Wright <jonathan@almalinux.org> - 7.2.5-6
- drop /etc/sysconfig/valkey

* Mon Apr 29 2024 Jonathan Wright <jonathan@almalinux.org> - 7.2.5-5
- improve migration scripts
- rename compat package
- fix working dir

* Mon Apr 22 2024 Nathan Scott <nathans@redhat.com> - 7.2.5-3
- remove version_no_tilde code

* Mon Apr 22 2024 Nathan Scott <nathans@redhat.com> - 7.2.5-2
- move redis compat symlinks to compat subpackage

* Wed Apr 17 2024 Jonathan Wright <jonathan@almalinux.org> - 7.2.5-1
- update to 7.2.5 rhbz#2275379

* Fri Apr 12 2024 Jonathan Wright <jonathan@almalinux.org> - 7.2.5~rc1-2
- add compat subpackage with migration scripts from redis

* Fri Apr 12 2024 Jonathan Wright <jonathan@almalinux.org> - 7.2.5~rc1-1
- update to 7.2.5-rc1

* Tue Apr 09 2024 Jonathan Wright <jonathan@almalinux.org> - 7.2.4~rc1-1
- Initial package build, release candidate