Drop redis-trib sub-package and pre-systemd functionality

This commit is contained in:
Nathan Scott 2019-05-15 11:12:15 +10:00
parent bea1cbef61
commit e900f51ac3

View File

@ -7,18 +7,6 @@
# Please preserve changelog entries
#
%if 0%{?fedora} >= 19 || 0%{?rhel} >= 7
%global with_redistrib 1
%else
%global with_redistrib 0
%endif
%if 0%{?fedora} >= 19 || 0%{?rhel} >= 7
%global with_systemd 1
%else
%global with_systemd 0
%endif
# Tests fail in mock, not in local build.
%global with_tests %{?_with_tests:1}%{!?_with_tests:0}
@ -32,7 +20,7 @@
Name: redis
Version: 5.0.4
Release: 1%{?dist}
Release: 2%{?dist}
Summary: A persistent key-value database
# redis, linenoise, lzf, hiredis are BSD
# lua is MIT
@ -66,23 +54,16 @@ BuildRequires: jemalloc-devel
BuildRequires: procps-ng
BuildRequires: tcl
%endif
%if 0%{?with_systemd}
BuildRequires: systemd
%endif
# redis-trib functionality migrated to redis-cli
Obsoletes: redis-trib
# Required for redis-shutdown
Requires: /bin/awk
Requires: logrotate
Requires(pre): shadow-utils
%if 0%{?with_systemd}
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%else
Requires(post): chkconfig
Requires(preun): chkconfig
Requires(preun): initscripts
Requires(postun): initscripts
%endif
Provides: bundled(hiredis)
Provides: bundled(lua-libs)
Provides: bundled(linenoise)
@ -138,18 +119,6 @@ Conflicts: redis < 4.0
Manual pages and detailed documentation for many aspects of Redis use,
administration and development.
%if 0%{?with_redistrib}
%package trib
Summary: Cluster management script for Redis
BuildArch: noarch
Requires: ruby
Requires: rubygem-redis
%description trib
Redis cluster management utility providing cluster creation, node addition
and removal, status checks, resharding, rebalancing, and other operations.
%endif
%prep
%setup -q -b 10
%setup -q
@ -202,7 +171,6 @@ install -pDm640 %{name}.conf %{buildroot}%{_sysconfdir}/%{name}.conf
install -pDm640 sentinel.conf %{buildroot}%{_sysconfdir}/%{name}-sentinel.conf
# Install systemd unit files.
%if 0%{?with_systemd}
mkdir -p %{buildroot}%{_unitdir}
install -pm644 %{S:3} %{buildroot}%{_unitdir}
install -pm644 %{S:2} %{buildroot}%{_unitdir}
@ -210,11 +178,6 @@ 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
%else # install SysV service files
install -pDm755 %{S:4} %{buildroot}%{_initrddir}/%{name}-sentinel
install -pDm755 %{S:5} %{buildroot}%{_initrddir}/%{name}
install -p -D -m 644 %{S:8} %{buildroot}%{_sysconfdir}/security/limits.d/95-%{name}.conf
%endif
# Fix non-standard-executable-perm error.
chmod 755 %{buildroot}%{_bindir}/%{name}-*
@ -225,11 +188,6 @@ install -pDm755 %{S:6} %{buildroot}%{_libexecdir}/%{name}-shutdown
# Install redis module header
install -pDm644 src/%{name}module.h %{buildroot}%{_includedir}/%{name}module.h
%if 0%{?with_redistrib}
# Install redis-trib
install -pDm755 src/%{name}-trib.rb %{buildroot}%{_bindir}/%{name}-trib
%endif
# Install man pages
man=$(dirname %{buildroot}%{_mandir})
for page in man/man?/*; do
@ -272,37 +230,16 @@ useradd -r -g %{name} -d %{_sharedstatedir}/%{name} -s /sbin/nologin \
exit 0
%post
%if 0%{?with_systemd}
%systemd_post %{name}.service
%systemd_post %{name}-sentinel.service
%else
chkconfig --add %{name}
chkconfig --add %{name}-sentinel
%endif
%preun
%if 0%{?with_systemd}
%systemd_preun %{name}.service
%systemd_preun %{name}-sentinel.service
%else
if [ $1 -eq 0 ] ; then
service %{name} stop &> /dev/null
chkconfig --del %{name} &> /dev/null
service %{name}-sentinel stop &> /dev/null
chkconfig --del %{name}-sentinel &> /dev/null
fi
%endif
%postun
%if 0%{?with_systemd}
%systemd_postun_with_restart %{name}.service
%systemd_postun_with_restart %{name}-sentinel.service
%else
if [ "$1" -ge "1" ] ; then
service %{name} condrestart >/dev/null 2>&1 || :
service %{name}-sentinel condrestart >/dev/null 2>&1 || :
fi
%endif
%files
%{!?_licensedir:%global license %%doc}
@ -314,9 +251,6 @@ fi
%dir %attr(0750, redis, redis) %{redis_modules_dir}
%dir %attr(0750, redis, redis) %{_sharedstatedir}/%{name}
%dir %attr(0750, redis, redis) %{_localstatedir}/log/%{name}
%if 0%{?with_redistrib}
%exclude %{_bindir}/%{name}-trib
%endif
%exclude %{macrosdir}
%exclude %{_includedir}
%exclude %{_docdir}/%{name}/*
@ -324,7 +258,6 @@ fi
%{_libexecdir}/%{name}-*
%{_mandir}/man1/%{name}*
%{_mandir}/man5/%{name}*
%if 0%{?with_systemd}
%{_unitdir}/%{name}.service
%{_unitdir}/%{name}-sentinel.service
%dir %{_sysconfdir}/systemd/system/%{name}.service.d
@ -332,12 +265,6 @@ fi
%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}
%else
%{_initrddir}/%{name}
%{_initrddir}/%{name}-sentinel
%config(noreplace) %{_sysconfdir}/security/limits.d/95-%{name}.conf
%dir %attr(0755, redis, redis) %{_localstatedir}/run/%{name}
%endif
%files devel
%license COPYING
@ -350,14 +277,12 @@ fi
%docdir %{_docdir}/%{name}
%{_docdir}/%{name}
%if 0%{?with_redistrib}
%files trib
%license COPYING
%{_bindir}/%{name}-trib
%endif
%changelog
* Sat May 11 2019 Nathan Scott <nathans@redhat.com> - 5.0.4-2
- Obsolete redis-trib - functionality now in redis-cli(1)
- Remove old chkconfig support, all systemd platforms now
* Tue Mar 19 2019 Nathan Scott <nathans@redhat.com> - 5.0.4-1
- Upstream 5.0.4 release and redis-doc updates.
- Fix sentinel.conf logfile line addition.