%undefine _package_note_file %bcond_with tests %global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d) Name: redis Version: 7.2.10 Release: 1%{?dist} Summary: A persistent key-value database License: BSD-3-Clause AND BSD-2-Clause AND MIT AND BSL-1.0 URL: https://redis.io Source0: https://github.com/redis/redis/archive/refs/tags/%{version}.tar.gz Source1: %{name}.logrotate Source2: %{name}-sentinel.service Source3: %{name}.service Source7: %{name}-limit-systemd Source9: macros.%{name} Source10: https://github.com/%{name}/%{name}-doc/archive/%{doc_commit}/%{name}-doc-%{short_doc_commit}.tar.gz BuildRequires: make BuildRequires: gcc %if %{with tests} BuildRequires: procps-ng BuildRequires: tcl %endif BuildRequires: pkgconfig(libsystemd) BuildRequires: systemd-devel BuildRequires: systemd-rpm-macros BuildRequires: openssl-devel # redis-trib functionality migrated to redis-cli Obsoletes: redis-trib < 5 Requires: logrotate Requires(pre): shadow-utils Requires(post): systemd Requires(preun): systemd Requires(postun): systemd Provides: bundled(hiredis) = 1.0.3 Provides: bundled(jemalloc) = 5.3.0 Provides: bundled(lua-libs) = 5.1.5 Provides: bundled(linenoise) = 1.0 Provides: bundled(lzf) Provides: bundled(hdr_histogram) = 0.11.0 Provides: bundled(fpconv) %global redis_modules_abi 1 %global redis_modules_dir %{_libdir}/%{name}/modules Provides: redis(modules_abi)%{?_isa} = %{redis_modules_abi} %description Redis 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, Redis 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. Redis 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 Redis behave like a cache. You can use Redis from most programming languages also. %package devel Summary: Development header for Redis module development Provides: %{name}-static = %{version}-%{release} %description devel Header file required for building loadable Redis modules. Detailed API documentation is available in the redis-doc package. %prep %setup -q -n %{name}-%{version} -b 10 mv deps/lua/COPYRIGHT COPYRIGHT-lua mv deps/jemalloc/COPYING COPYING-jemalloc mv deps/hiredis/COPYING COPYING-hiredis mv deps/hdr_histogram/LICENSE.txt LICENSE-hdrhistogram mv deps/hdr_histogram/COPYING.txt COPYING-hdrhistogram mv deps/fpconv/LICENSE.txt LICENSE-fpconv sed -i -e 's|^logfile .*$|logfile /var/log/redis/redis.log|g' redis.conf sed -i -e 's|^logfile .*$|logfile /var/log/redis/sentinel.log|g' sentinel.conf sed -i -e 's|^dir .*$|dir /var/lib/redis|g' redis.conf %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 api=`sed -n -e 's/#define REDISMODULE_APIVER_[0-9][0-9]* //p' src/redismodule.h` if test "$api" != "%{redis_modules_abi}"; then : Error: Upstream API version is now ${api}, expecting %%{redis_modules_abi}. : Update the redis_modules_abi macro, the rpmmacros file, and rebuild. exit 1 fi %global make_flags DEBUG="" V="echo" LDFLAGS="%{?__global_ldflags}" CFLAGS+="%{optflags} -fPIC" INSTALL="install -p" PREFIX=%{buildroot}%{_prefix} BUILD_WITH_SYSTEMD=yes BUILD_TLS=yes %build %make_build %{make_flags} all %install make %{make_flags} install # Filesystem. install -d %{buildroot}%{_sharedstatedir}/%{name} install -d %{buildroot}%{_localstatedir}/log/%{name} install -d %{buildroot}%{_localstatedir}/run/%{name} install -d %{buildroot}%{redis_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 systemd unit files. mkdir -p %{buildroot}%{_unitdir} install -pm644 %{S:3} %{buildroot}%{_unitdir} install -pm644 %{S:2} %{buildroot}%{_unitdir} # Install systemd limit files (requires systemd >= 204) install -p -D -m 644 %{S:7} %{buildroot}%{_sysconfdir}/systemd/system/%{name}.service.d/limit.conf install -p -D -m 644 %{S:7} %{buildroot}%{_sysconfdir}/systemd/system/%{name}-sentinel.service.d/limit.conf # Fix non-standard-executable-perm error. chmod 755 %{buildroot}%{_bindir}/%{name}-* # Install redis module header install -pDm644 src/%{name}module.h %{buildroot}%{_includedir}/%{name}module.h # Install man pages man=$(dirname %{buildroot}%{_mandir}) for page in man/man?/*; do install -Dpm644 $page $man/$page done ln -s redis-server.1 %{buildroot}%{_mandir}/man1/redis-sentinel.1 ln -s redis.conf.5 %{buildroot}%{_mandir}/man5/redis-sentinel.conf.5 # Install rpm macros for redis modules mkdir -p %{buildroot}%{macrosdir} install -pDm644 %{S:9} %{buildroot}%{macrosdir}/macros.%{name} %check %if %{with tests} # https://github.com/redis/redis/issues/1417 (for "taskset -c 1") taskset -c 1 make %{make_flags} test make %{make_flags} test-sentinel %endif %pre getent group %{name} &> /dev/null || \ groupadd -r %{name} &> /dev/null getent passwd %{name} &> /dev/null || \ useradd -r -g %{name} -d %{_sharedstatedir}/%{name} -s /sbin/nologin \ -c 'Redis Database Server' %{name} &> /dev/null exit 0 %post if [ -f %{_sysconfdir}/%{name}.conf -a ! -L %{_sysconfdir}/%{name}.conf ]; then if [ -f %{_sysconfdir}/%{name}/%{name}.conf.rpmnew ]; then rm %{_sysconfdir}/%{name}/%{name}.conf.rpmnew fi if [ -f %{_sysconfdir}/%{name}/%{name}.conf ]; then mv %{_sysconfdir}/%{name}/%{name}.conf %{_sysconfdir}/%{name}/%{name}.conf.rpmnew fi mv %{_sysconfdir}/%{name}.conf %{_sysconfdir}/%{name}/%{name}.conf echo -e "\nWarning: %{name} configuration is now in %{_sysconfdir}/%{name} directory\n" fi if [ -f %{_sysconfdir}/%{name}-sentinel.conf -a ! -L %{_sysconfdir}/%{name}-sentinel.conf ]; then if [ -f %{_sysconfdir}/%{name}/sentinel.conf.rpmnew ]; then rm %{_sysconfdir}/%{name}/sentinel.conf.rpmnew fi if [ -f %{_sysconfdir}/%{name}/sentinel.conf ]; then mv %{_sysconfdir}/%{name}/sentinel.conf %{_sysconfdir}/%{name}/sentinel.conf.rpmnew fi mv %{_sysconfdir}/%{name}-sentinel.conf %{_sysconfdir}/%{name}/sentinel.conf fi %systemd_post %{name}.service %systemd_post %{name}-sentinel.service %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 %{!?_licensedir:%global license %%doc} %license COPYING %license COPYRIGHT-lua %license COPYING-jemalloc %license COPYING-hiredis %license LICENSE-hdrhistogram %license COPYING-hdrhistogram %license LICENSE-fpconv %config(noreplace) %{_sysconfdir}/logrotate.d/%{name} %attr(0750, redis, root) %dir %{_sysconfdir}/%{name} %attr(0640, redis, root) %config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf %attr(0640, redis, root) %config(noreplace) %{_sysconfdir}/%{name}/sentinel.conf %dir %{_libdir}/%{name} %dir %{redis_modules_dir} %dir %attr(0750, redis, redis) %{_sharedstatedir}/%{name} %dir %attr(0750, redis, redis) %{_localstatedir}/log/%{name} %exclude %{macrosdir} %exclude %{_includedir} %exclude %{_docdir}/%{name}/* %{_bindir}/%{name}-* %{_mandir}/man1/%{name}* %{_mandir}/man5/%{name}* %{_unitdir}/%{name}.service %{_unitdir}/%{name}-sentinel.service %dir %{_sysconfdir}/systemd/system/%{name}.service.d %config(noreplace) %{_sysconfdir}/systemd/system/%{name}.service.d/limit.conf %dir %{_sysconfdir}/systemd/system/%{name}-sentinel.service.d %config(noreplace) %{_sysconfdir}/systemd/system/%{name}-sentinel.service.d/limit.conf %dir %attr(0755, redis, redis) %ghost %{_localstatedir}/run/%{name} %files devel # main package is not required %license COPYING %{_includedir}/%{name}module.h %{macrosdir}/* %changelog