redis/redis.spec
2024-10-04 21:44:55 +00:00

125 lines
4.2 KiB
RPMSpec

Name: redis
Version: 7.2.6
Release: 1
Summary: A persistent key-value database
Group: Databases
License: RSALv2 and SSPLv1
URL: http://redis.io
Patch0: 0001-1st-man-pageis-for-redis-cli-redis-benchmark-redis-c.patch
Patch1: 0001-redis-4.0.8-workaround-make-deadlock.patch
#Source0: http://download.redis.io/releases/%{name}-%{version}.tar.gz
Source0: https://github.com/redis/redis/archive/%{version}/%{name}-%{version}.tar.gz
Source1: redis-limit-systemd
Source2: redis-sentinel.service
Source3: redis-shutdown
Source4: redis.logrotate
# Based on, but not identical to, Fedora's file
Source5: redis.service
BuildRequires: pkgconfig(lua)
BuildRequires: procps-ng
BuildRequires: systemd
BuildRequires: tcl
BuildRequires: pkgconfig(libsystemd)
Requires: awk
Requires: logrotate
BuildRequires: rpm-helper
Requires(pre): rpm-helper >= 0.24.8-1
Requires(postun): rpm-helper >= 0.24.8-1
%description
Redis is an advanced key-value store.
It is similar to memcached but the data set is not volatile,
and values can be strings, exactly like in memcached,
but also lists, sets, and ordered sets.
All this data types can be manipulated with atomic operations
to push/pop elements, add/remove elements, perform server side
union, intersection, difference between sets, and so
forth. Redis supports different kind of sorting abilities.
%prep
#autosetup -p1 -n %{name}-%{version}%{?beta:-%{beta}}
%setup -q
rm -rf deps/jemalloc
# No hidden build.
sed -i -e 's|\t@|\t|g' deps/lua/src/Makefile
sed -i -e 's|$(QUIET_CC)||g' src/Makefile
sed -i -e 's|$(QUIET_LINK)||g' src/Makefile
sed -i -e 's|$(QUIET_INSTALL)||g' src/Makefile
# Ensure deps are built with proper flags
sed -i -e 's|$(CFLAGS)|%{optflags}|g' deps/Makefile
sed -i -e 's|OPTIMIZATION?=-O3|OPTIMIZATION=%{optflags}|g' deps/hiredis/Makefile
sed -i -e 's|$(LDFLAGS)|%{?__global_ldflags}|g' deps/hiredis/Makefile
sed -i -e 's|$(CFLAGS)|%{optflags}|g' deps/linenoise/Makefile
sed -i -e 's|$(LDFLAGS)|%{?__global_ldflags}|g' deps/linenoise/Makefile
# 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
%build
%make \
DEBUG="" \
LDFLAGS="%{ldflags}" \
CFLAGS+="%{optflags}" \
LUA_LDFLAGS+="%{ldflags}" \
MALLOC=libc \
BUILD_WITH_SYSTEMD=yes \
all
%install
%make install INSTALL="install -p" PREFIX=%{buildroot}%{_prefix}
# Filesystem
mkdir -p %{buildroot}%{_sharedstatedir}/%{name} \
%{buildroot}%{_localstatedir}/log/%{name} \
%{buildroot}%{_localstatedir}/run/%{name} \
%{buildroot}%{_localstatedir}/lib/%{name}
# Extras
install -pDm 755 %{S:3} %{buildroot}%{_bindir}/%{name}-shutdown
# Logrotate file
install -pDm 644 %{S:4} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
# Configuration files
mkdir -p %{buildroot}%{_sysconfdir}/redis/
install -pDm 644 redis.conf %{buildroot}%{_sysconfdir}/redis.conf
install -pDm 644 sentinel.conf %{buildroot}%{_sysconfdir}/redis-sentinel.conf
# Systemd unit files
install -pDm 644 %{S:2} %{buildroot}%{_unitdir}/redis-sentinel.service
install -pDm 644 %{S:5} %{buildroot}%{_unitdir}/redis.service
# Systemd limits
install -pDm 644 %{S:1} %{buildroot}%{_sysconfdir}/systemd/system/%{name}.service.d/limit.conf
install -pDm 644 %{S:1} %{buildroot}%{_sysconfdir}/systemd/system/%{name}-sentinel.service.d/limit.conf
%check
# Currently says all tests passed and then segfaults
#make test
%pre
%_pre_useradd %{name} %{_sharedstatedir}/%{name} /sbin/nologin
%postun
%_postun_userdel %{name}
%files
%doc 00-RELEASENOTES BUGS COPYING README.md
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%config(noreplace) %{_sysconfdir}/%{name}.conf
%config(noreplace) %{_sysconfdir}/%{name}-sentinel.conf
%dir %attr(0755, redis, root) %{_localstatedir}/lib/%{name}
%dir %attr(0755, redis, root) %{_localstatedir}/log/%{name}
%{_bindir}/%{name}-*
%{_unitdir}/%{name}.service
%{_unitdir}/%{name}-sentinel.service
%dir %{_sysconfdir}/systemd/system/%{name}.service.d
%{_sysconfdir}/systemd/system/%{name}.service.d/limit.conf
%dir %{_sysconfdir}/systemd/system/%{name}-sentinel.service.d
%{_sysconfdir}/systemd/system/%{name}-sentinel.service.d/limit.conf