valkey-vl.spec 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. %bcond_with systemd
  2. # Tests fail in mock, not in local build.
  3. %bcond_without tests
  4. Name: valkey
  5. Summary: A persistent key-value database
  6. Version: 7.2.6
  7. Release: 2%{?_dist_release}%{?with_systemd:.systemd}
  8. Group: servers
  9. Vendor: Project Vine
  10. Distribution: Vine Linux
  11. # valkey: BSD-3-Clause
  12. # hiredis: BSD-3-Clause
  13. # hdrhistogram, jemalloc, lzf, linenoise: BSD-2-Clause
  14. # lua: MIT
  15. # fpconv: BSL-1.0
  16. License: BSD-3-Clause AND BSD-2-Clause AND MIT AND BSL-1.0
  17. URL: https://valkey.io
  18. Source0: https://github.com/valkey-io/%{name}/archive/%{version}/%{name}-%{version}.tar.gz
  19. Source1: %{name}.logrotate
  20. Source2: %{name}-sentinel.service
  21. Source3: %{name}.service
  22. Source4: %{name}.sysusers
  23. # could have pulled this out of unpacked sources but
  24. # our copy has additional options pre-programmed in
  25. Source5: %{name}-limit-systemd
  26. Source8: macros.%{name}
  27. Source9: migrate_redis_to_valkey.sh
  28. Source100: %{name}.init
  29. Source101: %{name}-sentinel.init
  30. BuildRequires: make
  31. BuildRequires: gcc
  32. %if %{with tests}
  33. BuildRequires: procps
  34. BuildRequires: tcl
  35. %endif
  36. %if %{with systemd}
  37. BuildRequires: pkgconfig(libsystemd)
  38. BuildRequires: systemd-devel
  39. %endif
  40. BuildRequires: openssl-devel
  41. Requires: logrotate
  42. # from deps/hiredis/hiredis.h
  43. Provides: bundled(hiredis) = 1.0.3
  44. # from deps/jemalloc/VERSION
  45. Provides: bundled(jemalloc) = 5.3.0
  46. # from deps/lua/src/lua.h
  47. Provides: bundled(lua-libs) = 5.1.5
  48. # from deps/linenoise/linenoise.h
  49. Provides: bundled(linenoise) = 1.0
  50. Provides: bundled(lzf)
  51. # from deps/hdr_histogram/README.md
  52. Provides: bundled(hdr_histogram) = 0.11.0
  53. # no version
  54. Provides: bundled(fpconv)
  55. %global valkey_modules_abi 1
  56. %global valkey_modules_dir %{_libdir}/%{name}/modules
  57. Provides: valkey(modules_abi)%{?_isa} = %{valkey_modules_abi}
  58. %description
  59. Valkey is an advanced key-value store. It is often referred to as a data
  60. structure server since keys can contain strings, hashes, lists, sets and
  61. sorted sets.
  62. You can run atomic operations on these types, like appending to a string;
  63. incrementing the value in a hash; pushing to a list; computing set
  64. intersection, union and difference; or getting the member with highest
  65. ranking in a sorted set.
  66. In order to achieve its outstanding performance, Valkey works with an
  67. in-memory dataset. Depending on your use case, you can persist it either
  68. by dumping the dataset to disk every once in a while, or by appending
  69. each command to a log.
  70. Valkey also supports trivial-to-setup master-slave replication, with very
  71. fast non-blocking first synchronization, auto-reconnection on net split
  72. and so forth.
  73. Other features include Transactions, Pub/Sub, Lua scripting, Keys with a
  74. limited time-to-live, and configuration settings to make Valkey behave like
  75. a cache.
  76. You can use Valkey from most programming languages also.
  77. %package devel
  78. Summary: Development header for Valkey module development
  79. Group: programming
  80. # Header-Only Library (https://fedoraproject.org/wiki/Packaging:Guidelines)
  81. Provides: %{name}-static = %{version}-%{release}
  82. %description devel
  83. Header file required for building loadable Valkey modules.
  84. %package compat-redis
  85. Summary: Conversion script and compatibility symlinks for Redis
  86. Group: servers
  87. Requires: valkey = %{version}-%{release}
  88. Conflicts: redis
  89. %if 0%{?fedora} > 40 || 0%{?rhel} > 9
  90. Obsoletes: redis <= 7.2.5
  91. Provides: redis = %{version}-%{release}
  92. %endif
  93. BuildArch: noarch
  94. %description compat-redis
  95. %summary
  96. %debug_package
  97. %prep
  98. %autosetup -n %{name}-%{version} -p1
  99. mv deps/lua/COPYRIGHT COPYRIGHT-lua
  100. mv deps/jemalloc/COPYING COPYING-jemalloc
  101. mv deps/hiredis/COPYING COPYING-hiredis-BSD-3-Clause
  102. mv deps/hdr_histogram/LICENSE.txt LICENSE-hdrhistogram
  103. mv deps/hdr_histogram/COPYING.txt COPYING-hdrhistogram
  104. mv deps/fpconv/LICENSE.txt LICENSE-fpconv
  105. # See https://bugzilla.redhat.com/2240293
  106. # See https://src.fedoraproject.org/rpms/jemalloc/blob/rawhide/f/jemalloc.spec#_34
  107. %ifarch %ix86 %arm x86_64 s390x
  108. sed -e 's/--with-lg-quantum/--with-lg-page=12 --with-lg-quantum/' -i deps/Makefile
  109. %endif
  110. %ifarch ppc64 ppc64le aarch64
  111. sed -e 's/--with-lg-quantum/--with-lg-page=16 --with-lg-quantum/' -i deps/Makefile
  112. %endif
  113. # Module API version safety check
  114. api=`sed -n -e 's/#define VALKEYMODULE_APIVER_[0-9][0-9]* //p' src/valkeymodule.h`
  115. if test "$api" != "%{valkey_modules_abi}"; then
  116. : Error: Upstream API version is now ${api}, expecting %%{valkey_modules_abi}.
  117. : Update the valkey_modules_abi macro, the rpmmacros file, and rebuild.
  118. exit 1
  119. fi
  120. sed -i -e 's|^logfile .*$|logfile /var/log/valkey/valkey.log|g' \
  121. -e 's|^# unixsocket .*$|unixsocket /run/valkey/valkey.sock|g' \
  122. -e 's|^pidfile .*$|pidfile /run/valkey/valkey.pid|g' \
  123. valkey.conf
  124. sed -i -e 's|^logfile .*$|logfile /var/log/valkey/sentinel.log|g' \
  125. -e 's|^pidfile .*$|pidfile /run/valkey/sentinel.pid|g' \
  126. sentinel.conf
  127. %if (%{defined fedora} && 0%{?fedora} < 42) || (%{defined rhel} && 0%{?rhel} < 10)
  128. # these lines are for conditionals around sysconfig to valkey.conf porting scriptlets to avoid re-runs
  129. echo '# valkey_rpm_conf' >> valkey.conf
  130. echo '# valkey-sentinel_rpm_conf' >> sentinel.conf
  131. %endif
  132. %if %{with systemd}
  133. %global make_flags DEBUG="" V="echo" PREFIX=%{buildroot}%{_prefix} BUILD_WITH_SYSTEMD=yes BUILD_TLS=yes
  134. %else
  135. %global make_flags DEBUG="" V="echo" PREFIX=%{buildroot}%{_prefix} BUILD_WITH_SYSTEMD=no BUILD_TLS=yes
  136. %endif
  137. %build
  138. %make_build %{make_flags}
  139. %install
  140. %make_install %{make_flags}
  141. # remove sample confs
  142. rm -rf %{buildroot}%{_datadir}/%{name}
  143. # System user
  144. install -p -D -m 0644 %{S:4} %{buildroot}%{_sysusersdir}/%{name}.conf
  145. # Filesystem.
  146. install -d %{buildroot}%{_sharedstatedir}/%{name}
  147. install -d %{buildroot}%{_localstatedir}/log/%{name}
  148. install -d %{buildroot}%{_localstatedir}/run/%{name}
  149. install -d %{buildroot}%{valkey_modules_dir}
  150. # Install logrotate file.
  151. install -pDm644 %{S:1} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
  152. # Install configuration files.
  153. install -pDm640 %{name}.conf %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf
  154. install -pDm640 sentinel.conf %{buildroot}%{_sysconfdir}/%{name}/sentinel.conf
  155. %if %{with systemd}
  156. # Install systemd unit files.
  157. mkdir -p %{buildroot}%{_unitdir}
  158. install -pm644 %{S:3} %{buildroot}%{_unitdir}
  159. install -pm644 %{S:2} %{buildroot}%{_unitdir}
  160. # Install systemd limit files
  161. install -p -D -m 644 %{S:5} %{buildroot}%{_unitdir}/%{name}.service.d/limit.conf
  162. install -p -D -m 644 %{S:5} %{buildroot}%{_unitdir}/%{name}-sentinel.service.d/limit.conf
  163. %else
  164. mkdir -p %{buildroot}%{_initdir}
  165. install -pm755 %{S:100} %{buildroot}%{_initdir}/%{name}
  166. install -pm755 %{S:101} %{buildroot}%{_initdir}/%{name}-sentinel
  167. %endif
  168. # Fix non-standard-executable-perm error.
  169. chmod 755 %{buildroot}%{_bindir}/%{name}-*
  170. # Install valkey module header
  171. install -pDm644 src/%{name}module.h %{buildroot}%{_includedir}/%{name}module.h
  172. # Install rpm macros for valkey modules
  173. #mkdir -p %{buildroot}%{_rpmmacrodir}
  174. install -pDm644 %{S:8} %{buildroot}%{_rpmmacrodir}/macros.%{name}
  175. # compat script
  176. install -Dpm 755 %{S:9} %{buildroot}%{_libexecdir}/migrate_redis_to_valkey.sh
  177. %ifarch x86_64
  178. %check
  179. %if %{with tests}
  180. # https://github.com/redis/redis/issues/1417 (for "taskset -c 1")
  181. taskset -c 1 ./runtest --skiptest "Active defrag - AOF loading"
  182. # sentinel tests fail in mock, but we want the normal tests above
  183. #./runtest-sentinel
  184. %endif
  185. %endif
  186. %post compat-redis
  187. %{_libexecdir}/migrate_redis_to_valkey.sh
  188. %if %{with systemd}
  189. %pre
  190. %sysusers_create_compat %{S:4}
  191. %post
  192. %systemd_post %{name}.service
  193. %systemd_post %{name}-sentinel.service
  194. %preun
  195. %systemd_preun %{name}.service
  196. %systemd_preun %{name}-sentinel.service
  197. %postun
  198. %systemd_postun_with_restart %{name}.service
  199. %systemd_postun_with_restart %{name}-sentinel.service
  200. %else
  201. %pre
  202. getent group %{name} &> /dev/null || \
  203. groupadd -r %{name} &> /dev/null
  204. getent passwd %{name} &> /dev/null || \
  205. useradd -r -g %{name} -d %{_sharedstatedir}/%{name} -s /sbin/nologin \
  206. -c 'Valkey Database Server' %{name} &> /dev/null
  207. exit 0
  208. %post
  209. if [ $1 -eq 1 ]; then
  210. /sbin/chkconfig --add %{name}
  211. /sbin/chkconfig --add %{name}-sentinel
  212. fi
  213. %preun
  214. if [ $1 -eq 0 -o -x /usr/sbin/systemctl ]; then
  215. /sbin/service %{name} stop ||:
  216. /sbin/service %{name}-sentinel stop ||:
  217. /sbin/chkconfig --del %{name}
  218. /sbin/chkconfig --del %{name}-sentinel
  219. fi
  220. %postun
  221. if [ $1 -gt 0 ]; then
  222. if [ -x /usr/sbin/systemctl ]; then
  223. /sbin/service %{name} stop ||:
  224. /sbin/service-sentinel %{name} stop ||:
  225. else
  226. /sbin/service %{name} condrestart ||:
  227. /sbin/service %{name}-sentinel condrestart ||:
  228. fi
  229. fi
  230. %endif
  231. %files
  232. %license COPYING
  233. %license COPYRIGHT-lua
  234. %license COPYING-jemalloc
  235. %license LICENSE-hdrhistogram
  236. %license COPYING-hdrhistogram
  237. %license LICENSE-fpconv
  238. %license COPYING-hiredis-BSD-3-Clause
  239. %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
  240. %attr(0750, valkey, root) %dir %{_sysconfdir}/%{name}
  241. %attr(0640, valkey, root) %config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
  242. %attr(0640, valkey, root) %config(noreplace) %{_sysconfdir}/%{name}/sentinel.conf
  243. %dir %{_libdir}/%{name}
  244. %dir %{valkey_modules_dir}
  245. %dir %attr(0750, valkey, valkey) %{_sharedstatedir}/%{name}
  246. %dir %attr(0750, valkey, valkey) %{_localstatedir}/log/%{name}
  247. %dir %attr(0755, valkey, valkey) %ghost %{_localstatedir}/run/%{name}
  248. %{_bindir}/%{name}-*
  249. %if %{with systemd}
  250. %{_unitdir}/%{name}.service
  251. %{_unitdir}/%{name}-sentinel.service
  252. %dir %{_unitdir}/%{name}.service.d
  253. %{_unitdir}/%{name}.service.d/limit.conf
  254. %dir %{_unitdir}/%{name}-sentinel.service.d
  255. %{_unitdir}/%{name}-sentinel.service.d/limit.conf
  256. %{_sysusersdir}/%{name}.conf
  257. %else
  258. %{_initdir}/%{name}
  259. %{_initdir}/%{name}-sentinel
  260. %endif
  261. %files devel
  262. # main package is not required
  263. %license COPYING
  264. %{_includedir}/%{name}module.h
  265. %{_rpmmacrodir}/macros.%{name}
  266. %files compat-redis
  267. %{_libexecdir}/migrate_redis_to_valkey.sh
  268. %{_bindir}/redis-*
  269. %changelog
  270. * Thu Aug 01 2024 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 7.2.6-2
  271. - fixed initscripts.
  272. * Thu Aug 01 2024 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 7.2.6-1
  273. - initial build for Vine Linux.
  274. - new upstream release.
  275. * Sat Jul 20 2024 Fedora Release Engineering <releng@fedoraproject.org> - 7.2.5-10
  276. - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
  277. * Mon Jul 15 2024 Jonathan Wright <jonathan@almalinux.org> - 7.2.5-9
  278. - Fix journal warning rhbz#2297457
  279. * Tue Jul 02 2024 Jonathan Wright <jonathan@almalinux.org> - 7.2.5-8
  280. - Enable tests by default
  281. selectively disable tests that fail in mock for redis
  282. disable redis-sentinel tests, they always fail in mock
  283. * Sat Jun 22 2024 Neal Gompa <ngompa@fedoraproject.org> - 7.2.5-7
  284. - Enable automatic replacement of redis with valkey
  285. * Mon Jun 17 2024 Jonathan Wright <jonathan@almalinux.org> - 7.2.5-6
  286. - drop /etc/sysconfig/valkey
  287. * Mon Apr 29 2024 Jonathan Wright <jonathan@almalinux.org> - 7.2.5-5
  288. - improve migration scripts
  289. - rename compat package
  290. - fix working dir
  291. * Mon Apr 22 2024 Nathan Scott <nathans@redhat.com> - 7.2.5-3
  292. - remove version_no_tilde code
  293. * Mon Apr 22 2024 Nathan Scott <nathans@redhat.com> - 7.2.5-2
  294. - move redis compat symlinks to compat subpackage
  295. * Wed Apr 17 2024 Jonathan Wright <jonathan@almalinux.org> - 7.2.5-1
  296. - update to 7.2.5 rhbz#2275379
  297. * Fri Apr 12 2024 Jonathan Wright <jonathan@almalinux.org> - 7.2.5~rc1-2
  298. - add compat subpackage with migration scripts from redis
  299. * Fri Apr 12 2024 Jonathan Wright <jonathan@almalinux.org> - 7.2.5~rc1-1
  300. - update to 7.2.5-rc1
  301. * Tue Apr 09 2024 Jonathan Wright <jonathan@almalinux.org> - 7.2.4~rc1-1
  302. - Initial package build, release candidate