]> git.pld-linux.org Git - SPECS.git/blob - redis.spec
SPECS updated Tue 30 Apr 15:13:02 CEST 2024
[SPECS.git] / redis.spec
1 # TODO
2 # - Check for status of man pages http://code.google.com/p/redis/issues/detail?id=202
3 #
4 # Conditional build:
5 %bcond_without  tests           # build without tests
6 %bcond_without  perftools       # google perftools
7 %bcond_without  systemd         # systemd support
8 %bcond_without  system_jemalloc # use embedded jemalloc
9
10 %ifnarch %{ix86} %{x8664} ppc
11 # available only on selected architectures
12 %undefine       with_perftools
13 %endif
14
15 Summary:        A persistent key-value database
16 Name:           redis
17 Version:        6.2.11
18 Release:        1
19 License:        BSD
20 Group:          Applications/Databases
21 Source0:        http://download.redis.io/releases/%{name}-%{version}.tar.gz
22 # Source0-md5:  63ed5185723511200f7c0e2a811730dc
23 Source1:        %{name}.logrotate
24 Source2:        %{name}.init
25 Source3:        %{name}.tmpfiles
26 Source4:        %{name}.service
27 Source5:        %{name}.sysconfig
28 Patch0:         %{name}.conf.patch
29 Patch1:         %{name}-tcl.patch
30 Patch2:         0001-1st-man-pageis-for-redis-cli-redis-benchmark-redis-c.patch
31 Patch3:         arm-arch-check.patch
32 Patch4:         system-jemalloc.patch
33 URL:            http://www.redis.io/
34 %{?with_perftools:BuildRequires:    gperftools-devel}
35 %ifnarch %{arm}
36 BuildRequires:  jemalloc-devel
37 %endif
38 %ifarch %{arm}
39 BuildRequires:  libatomic-devel
40 %endif
41 BuildRequires:  openssl-devel
42 BuildRequires:  pkgconfig
43 BuildRequires:  rpm >= 4.4.9-56
44 BuildRequires:  rpmbuild(macros) >= 2.011
45 BuildRequires:  sed >= 4.0
46 %{?with_systemd:BuildRequires:  systemd-devel}
47 %{?with_tests:BuildRequires:    tcl >= 8.5}
48 Obsoletes:      redis-doc
49 Conflicts:      logrotate < 3.8.0
50 ExcludeArch:    sparc sparc64 alpha
51 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
52
53 %description
54 Redis is an advanced key-value store. It is similar to memcached but
55 the data set is not volatile, and values can be strings, exactly like
56 in memcached, but also lists, sets, and ordered sets. All this data
57 types can be manipulated with atomic operations to push/pop elements,
58 add/remove elements, perform server side union, intersection,
59 difference between sets, and so forth. Redis supports different kind
60 of sorting abilities.
61
62 %package server
63 Summary:        Persistent key-value database with network interface
64 Group:          Applications/Databases
65 Requires(post,preun):   /sbin/chkconfig
66 Requires(postun):       /usr/sbin/groupdel
67 Requires(postun):       /usr/sbin/userdel
68 Requires(pre):  /bin/id
69 Requires(pre):  /usr/bin/getgid
70 Requires(pre):  /usr/sbin/groupadd
71 Requires(pre):  /usr/sbin/useradd
72 Requires:       rc-scripts
73 Provides:       group(redis)
74 Provides:       user(redis)
75
76 %description server
77 Redis is a key-value database in a similar vein to memcache but the
78 dataset is non-volatile. Redis additionally provides native support
79 for atomically manipulating and querying data structures such as lists
80 and sets.
81
82 The dataset is stored entirely in memory and periodically flushed to
83 disk.
84
85 %prep
86 %setup -q
87 %patch0 -p1
88 %patch1 -p1
89 %patch2 -p1
90 %patch3 -p1
91 %patch4 -p1
92
93 # Remove integration tests
94 %{__sed} -i -e '/    integration\/replication/d' tests/test_helper.tcl
95 %{__sed} -i -e '/    unit\/memefficiency/d' tests/test_helper.tcl
96
97 # randomize port number so concurrent builds doesn't break
98 port=$((21110 + ${RANDOM:-$$} % 1000))
99 sed -i -e "s/set ::port 21111/set ::port $port/" tests/test_helper.tcl
100
101 %{__rm} -r deps/jemalloc
102
103 %build
104 %define specflags -std=c99 -pedantic
105 %define _make_opts \\\
106         CC="%{__cc}" \\\
107         CFLAGS="%{rpmcflags}" \\\
108         LDFLAGS="%{rpmldflags}" \\\
109         OPTIMIZATION="" \\\
110         DEBUG="" \\\
111         BUILD_TLS=yes \\\
112         USE_SYSTEMD=%{?with_systemd:yes}%{!?with_systemd:no} \\\
113         V=1 \\\
114         uname_M=%{_target_cpu}
115
116 %{__make} -C src all
117
118 %if %{with tests}
119 %{__make} test
120 %endif
121
122 %install
123 rm -rf $RPM_BUILD_ROOT
124 install -d $RPM_BUILD_ROOT{%{_sysconfdir},/etc/sysconfig,%{_sbindir}} \
125         $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d} \
126         $RPM_BUILD_ROOT%{_localstatedir}/{{lib,log,run}/%{name},log/archive/%{name}} \
127         $RPM_BUILD_ROOT%{systemdtmpfilesdir} $RPM_BUILD_ROOT%{systemdunitdir} \
128         $RPM_BUILD_ROOT%{_mandir}/man{1,5}
129
130 %{__make} install \
131         INSTALL="install -p" \
132         PREFIX=$RPM_BUILD_ROOT%{_prefix}
133
134 # Fix non-standard-executable-perm error
135 chmod a+x $RPM_BUILD_ROOT%{_bindir}/%{name}-*
136
137 # Ensure redis-server location doesn't change
138 mv $RPM_BUILD_ROOT{%{_bindir},%{_sbindir}}/%{name}-server
139 mv $RPM_BUILD_ROOT{%{_bindir},%{_sbindir}}/%{name}-sentinel
140
141 # Install misc other
142 install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
143 cp -p %{SOURCE1} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
144 cp -p %{name}.conf $RPM_BUILD_ROOT%{_sysconfdir}
145 cp -p %{SOURCE3} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{name}.conf
146 %{?with_systemd:%{__sed} -e 's;@sbindir@;%{_sbindir};' -e 's;@localstatedir@;%{_localstatedir};' %{SOURCE4} > $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service}
147 %{__sed} -e 's;@sysconfdir@;%{_sysconfdir};' %{SOURCE5} > $RPM_BUILD_ROOT/etc/sysconfig/%{name}
148
149 # man-pages
150 for man in man/man1/*; do
151         install $man $RPM_BUILD_ROOT%{_mandir}/man1
152 done
153 for man in man/man5/*; do
154         install $man $RPM_BUILD_ROOT%{_mandir}/man5
155 done
156
157 # sentinel can be symlinked
158 echo ".so man1/redis-server.1" > $RPM_BUILD_ROOT%{_mandir}/man1/redis-sentinel.1
159 echo ".so man5/redis.conf.5" > $RPM_BUILD_ROOT%{_mandir}/man5/redis-sentinel.conf.5
160
161 %clean
162 rm -rf $RPM_BUILD_ROOT
163
164 %pre server
165 %groupadd -g 256 redis
166 %useradd -u 256 -g redis -d %{_sharedstatedir}/redis -s /sbin/nologin -c 'Redis Server' redis
167
168 %post server
169 /sbin/chkconfig --add redis
170 %service redis restart
171 %{?with_systemd:%systemd_post %{name}.service}
172
173 %preun server
174 if [ "$1" = 0 ]; then
175         %service redis stop
176         /sbin/chkconfig --del redis
177 fi
178
179 %postun server
180 if [ "$1" = "0" ]; then
181         %userremove redis
182         %groupremove redis
183 fi
184 %{?with_systemd:%systemd_reload}
185
186 %triggerpostun server -- redis-server < 6.2.5-2
187 %{?with_systemd?%systemd_trigger %{name}.service}
188
189 %files
190 %defattr(644,root,root,755)
191 %doc 00-RELEASENOTES BUGS CONTRIBUTING COPYING INSTALL MANIFESTO README.md
192 %attr(755,root,root) %{_bindir}/redis-benchmark
193 %attr(755,root,root) %{_bindir}/redis-cli
194 %{_mandir}/man1/redis-benchmark.1*
195 %{_mandir}/man1/redis-cli.1*
196
197 %files server
198 %defattr(644,root,root,755)
199 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
200 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}.conf
201 %attr(754,root,root) /etc/rc.d/init.d/%{name}
202 %attr(755,root,root) %{_sbindir}/redis-sentinel
203 %attr(755,root,root) %{_sbindir}/redis-server
204 %attr(755,root,root) %{_bindir}/redis-check-aof
205 %attr(755,root,root) %{_bindir}/redis-check-rdb
206 %config(noreplace) /etc/logrotate.d/%{name}
207 %dir %attr(750,redis,redis) %{_localstatedir}/lib/%{name}
208 %dir %attr(750,redis,redis) %{_localstatedir}/log/%{name}
209 %dir %attr(750,redis,redis) %{_localstatedir}/log/archive/%{name}
210 %dir %attr(750,redis,redis) %{_localstatedir}/run/%{name}
211 %{systemdtmpfilesdir}/%{name}.conf
212 %{?with_systemd:%{systemdunitdir}/%{name}.service}
213 %{_mandir}/man1/redis-sentinel.1*
214 %{_mandir}/man1/redis-server.1*
215 %{_mandir}/man1/redis-check-aof.1*
216 %{_mandir}/man1/redis-check-rdb.1*
217 %{_mandir}/man5/redis.conf.5*
218 %{_mandir}/man5/redis-sentinel.conf.5*
This page took 0.358147 seconds and 3 git commands to generate.