diff --git a/redis.spec b/redis.spec index 31a1b89e710abdbb49dcbb37da8c37202549c592..54ed1cd4f22dea8988bc2f383a0964072f2180a9 100644 --- a/redis.spec +++ b/redis.spec @@ -1,111 +1,91 @@ -%define anolis_release 1 +%define anolis_release 2 # disable tests in mock, tests can pass on local rpmbuild %bcond_with tests -# Commit IDs for the (unversioned) redis-doc repository +%global redis_modules_abi 1 +%global redis_modules_dir %{_libdir}/%{name}/modules %global doc_commit 80258ecc251e8f7209d480cad77128ba5a43f968 %global short_doc_commit %(c=%{doc_commit}; echo ${c:0:7}) - %global macrosdir %{_rpmconfigdir}/macros.d +%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 Name: redis Version: 7.0.10 Release: %{anolis_release}%{?dist} Summary: A persistent key-value database -# redis, jemalloc, linenoise, lzf, hiredis are BSD -# lua is MIT License: BSD and MIT URL: https://redis.io Source0: https://download.redis.io/releases/%{name}-%{version}.tar.gz -Source1: %{name}.logrotate -Source2: %{name}-sentinel.service -Source3: %{name}.service -Source7: %{name}-limit-systemd -Source9: macros.%{name} +Source1: redis.logrotate +Source2: redis-sentinel.service +Source3: redis.service +Source7: redis-limit-systemd +Source9: macros.redis Source10: https://github.com/%{name}/%{name}-doc/archive/%{doc_commit}/%{name}-doc-%{short_doc_commit}.tar.gz -# https://github.com/redis/redis/pull/3491 - man pages Patch0001: 0001-1st-man-pageis-for-redis-cli-redis-benchmark-redis-c.patch -BuildRequires: make -BuildRequires: gcc +BuildRequires: make gcc systemd-devel openssl-devel systemd-rpm-macros %if %{with tests} -BuildRequires: procps-ng -BuildRequires: tcl +BuildRequires: procps-ng 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 -# from deps/hiredis/hiredis.h + +Obsoletes: redis-trib < 5 +Provides: bundled(lzf) Provides: bundled(hiredis) = 0.14.0 -# from deps/jemalloc/VERSION Provides: bundled(jemalloc) = 5.2.1 -# 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 - -%global redis_modules_abi 1 -%global redis_modules_dir %{_libdir}/%{name}/modules Provides: redis(modules_abi) = %{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. +Redis is often referred to as a data structures server. What this means is that Redis +provides access to mutable data structures via a set of commands, which are sent using +a server-client model with TCP sockets and a simple protocol. So different processes +can query and modify the same data structures in a shared way. -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. +Data structures implemented into Redis have a few special properties: -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 cares to store them on disk, even if they are always served and modified into the + server memory. This means that Redis is fast, but that it is also non-volatile. + - The implementation of data structures emphasizes memory efficiency, so data structures + inside Redis will likely use less memory compared to the same data structure modelled + using a high-level programming language. + - Redis offers a number of features that are natural to find in a database, like replication, + tunable levels of durability, clustering, and high availability. -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. +Another good example is to think of Redis as a more complex version of memcached, where the operations +are not just SETs and GETs, but operations that work with complex data types like Lists, Sets, ordered +data structures, and so forth. %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. +Header file required for building loadable Redis modules. Detailed API +documentation is available in the redis-doc package. -%package doc -Summary: Documentation for Redis including man pages -License: CC-BY-SA -BuildArch: noarch +%package doc +Summary: Documentation for Redis including man pages +License: CC-BY-SA +BuildArch: noarch +Requires: %{name} = %{EVR} Conflicts: redis < 4.0 -%description doc +%description doc Manual pages and detailed documentation for many aspects of Redis use, administration and development. - %prep %setup -q -b 10 %setup -q @@ -120,8 +100,8 @@ mv deps/hdr_histogram/COPYING.txt COPYING-hdrhistogram # Configuration file changes 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 +sed -i -e 's|^logfile .*$|logfile /var/log/redis/sentinel.log|g' sentinel.conf # Module API version safety check api=`sed -n -e 's/#define REDISMODULE_APIVER_[0-9][0-9]* //p' src/redismodule.h` @@ -131,8 +111,6 @@ if test "$api" != "%{redis_modules_abi}"; then 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 @@ -140,33 +118,26 @@ fi 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} +mkdir -p %{buildroot}%{_sharedstatedir}/%{name} +mkdir -p %{buildroot}%{_localstatedir}/log/%{name} +mkdir -p %{buildroot}%{_localstatedir}/run/%{name} +mkdir -p %{buildroot}%{redis_modules_dir} -# Install logrotate file. install -pDm644 %{SOURCE1} %{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 %{SOURCE3} %{buildroot}%{_unitdir} install -pm644 %{SOURCE2} %{buildroot}%{_unitdir} - -# Install systemd limit files (requires systemd >= 204) install -p -D -m 644 %{SOURCE7} %{buildroot}%{_sysconfdir}/systemd/system/%{name}.service.d/limit.conf install -p -D -m 644 %{SOURCE7} %{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 rpm macros for redis modules +mkdir -p %{buildroot}%{macrosdir} +install -pDm644 %{SOURCE9} %{buildroot}%{macrosdir}/macros.%{name} + # Install man pages man=$(dirname %{buildroot}%{_mandir}) for page in man/man?/*; do @@ -185,16 +156,14 @@ for page in $(find doc -name \*.md | sed -e 's|.md$||g'); do install -Dpm644 $page.md $doc/$base.md done -# Install rpm macros for redis modules -mkdir -p %{buildroot}%{macrosdir} -install -pDm644 %{SOURCE9} %{buildroot}%{macrosdir}/macros.%{name} - %check %if %{with tests} taskset -c 1 make %{make_flags} test make %{make_flags} test-sentinel %endif +%generate_compatibility_deps + %pre getent group %{name} &> /dev/null || \ groupadd -r %{name} &> /dev/null @@ -236,31 +205,29 @@ fi %systemd_postun_with_restart %{name}-sentinel.service %files -%license COPYING -%license COPYRIGHT-lua -%license COPYING-jemalloc -%license COPYING-hiredis -%license LICENSE-hdrhistogram -%license COPYING-hdrhistogram +%license COPYING COPYRIGHT-lua COPYING-jemalloc doc/LICENSE +%license COPYING-hiredis LICENSE-hdrhistogram COPYING-hdrhistogram %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 %{abidir} %dir %attr(0750, redis, redis) %{_sharedstatedir}/%{name} %dir %attr(0750, redis, redis) %{_localstatedir}/log/%{name} +%dir %{_sysconfdir}/systemd/system/%{name}.service.d +%dir %{_sysconfdir}/systemd/system/%{name}-sentinel.service.d +%dir %attr(0755, redis, redis) %ghost %{_localstatedir}/run/%{name} +%config(noreplace) %{_sysconfdir}/systemd/system/%{name}.service.d/limit.conf +%config(noreplace) %{_sysconfdir}/systemd/system/%{name}-sentinel.service.d/limit.conf %exclude %{_docdir}/%{name} %{_bindir}/%{name}-* -%{_mandir}/man1/%{name}* -%{_mandir}/man5/%{name}* +%{abidir}/%{name}*-option.list %{_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} +%{_mandir}/man1/%{name}* +%{_mandir}/man5/%{name}* %files devel %license COPYING @@ -268,12 +235,13 @@ fi %{macrosdir}/* %files doc -%license doc/LICENSE %docdir %{_docdir}/%{name} %{_docdir}/%{name} - %changelog +* Wed Apr 12 2023 yuanhui 7.0.10-2 +- Optimize the spec file + * Tue Apr 04 2023 Funda Wang - 7.0.10-1 - New version 7.0.10 - drop redis-shutdown helper and rely on systemd