]> git.pld-linux.org Git - packages/redis.git/blobdiff - redis.spec
patch to make arm arch check more consistent
[packages/redis.git] / redis.spec
index 398a5450a1e5f547654e00773ccb7c0856072d97..3ee5a25755a9fa4abcb8e018d59ee757f532d523 100644 (file)
@@ -1,27 +1,44 @@
 # TODO
-# - register user/gid, pld initscript
 # - Check for status of man pages http://code.google.com/p/redis/issues/detail?id=202
+# - use shared jemalloc?
 #
 # Conditional build:
 %bcond_without tests           # build without tests
+%bcond_without perftools       # google perftools
+
+%ifnarch %{ix86} %{x8664} ppc
+# available only on selected architectures
+%undefine      with_perftools
+%endif
 
 Summary:       A persistent key-value database
 Name:          redis
-Version:       2.0.2
-Release:       0.1
+Version:       6.2.5
+Release:       1
 License:       BSD
 Group:         Applications/Databases
-URL:           http://code.google.com/p/redis/
-Source0:       http://redis.googlecode.com/files/%{name}-%{version}.tar.gz
-# Source0-md5: 1658ab25161efcc0d0e98b4d1e38a985
+Source0:       http://download.redis.io/releases/%{name}-%{version}.tar.gz
+# Source0-md5: db8a2b45eafbf1ead4353044fb70f581
 Source1:       %{name}.logrotate
 Source2:       %{name}.init
-Patch0:                %{name}-redis.conf.patch
+Source3:       %{name}.tmpfiles
+Patch0:                %{name}.conf.patch
+Patch1:                %{name}-tcl.patch
+Patch2:                0001-1st-man-pageis-for-redis-cli-redis-benchmark-redis-c.patch
+Patch3:                arm-arch-check.patch
+URL:           http://www.redis.io/
+%{?with_perftools:BuildRequires:    gperftools-devel}
+BuildRequires: jemalloc-static
+%ifarch %{arm}
+BuildRequires: libatomic-devel
+%endif
+BuildRequires: rpm >= 4.4.9-56
+BuildRequires: rpmbuild(macros) >= 1.202
 BuildRequires: sed >= 4.0
-%{?with_tests:BuildRequires:   tcl}
-Requires(post):        /sbin/chkconfig
-Requires(preun):       /sbin/chkconfig
-Requires(preun):       rc-scripts
+%{?with_tests:BuildRequires:   tcl >= 8.5}
+Obsoletes:     redis-doc
+Conflicts:     logrotate < 3.8.0
+ExcludeArch:   sparc sparc64 alpha
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
@@ -33,63 +50,145 @@ add/remove elements, perform server side union, intersection,
 difference between sets, and so forth. Redis supports different kind
 of sorting abilities.
 
+%package server
+Summary:       Persistent key-value database with network interface
+Group:         Applications/Databases
+Requires(post,preun):  /sbin/chkconfig
+Requires(postun):      /usr/sbin/groupdel
+Requires(postun):      /usr/sbin/userdel
+Requires(pre): /bin/id
+Requires(pre): /usr/bin/getgid
+Requires(pre): /usr/sbin/groupadd
+Requires(pre): /usr/sbin/useradd
+Requires:      rc-scripts
+Provides:      group(redis)
+Provides:      user(redis)
+
+%description server
+Redis is a key-value database in a similar vein to memcache but the
+dataset is non-volatile. Redis additionally provides native support
+for atomically manipulating and querying data structures such as lists
+and sets.
+
+The dataset is stored entirely in memory and periodically flushed to
+disk.
+
 %prep
 %setup -q
 %patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+
 # Remove integration tests
-%{__sed} -i -e '/    execute_tests "integration\/replication"/d' tests/test_helper.tcl
-%{__sed} -i -e '/    execute_tests "integration\/aof"/d' tests/test_helper.tcl
+%{__sed} -i -e '/    integration\/replication/d' tests/test_helper.tcl
+%{__sed} -i -e '/    unit\/memefficiency/d' tests/test_helper.tcl
+
+# randomize port number so concurrent builds doesn't break
+port=$((21110 + ${RANDOM:-$$} % 1000))
+sed -i -e "s/set ::port 21111/set ::port $port/" tests/test_helper.tcl
+
+# use system jemalloc
+mv deps/jemalloc{,-local}
+install -d deps/jemalloc
+ln -s %{_libdir} deps/jemalloc/lib
+ln -s %{_includedir} deps/jemalloc/include
 
 %build
-%{__make} all \
-       DEBUG="" \
-       CC="%{__cc}" \
-       CFLAGS="%{rpmcflags} -std=c99"
+%define specflags -std=c99 -pedantic
+%define _make_opts CC="%{__cc}" CFLAGS="%{rpmcflags}" LDFLAGS="%{rpmldflags}" OPTIMIZATION="" DEBUG="" V=1 uname_M=%{_target_cpu}
+
+%{__make} -C src all
 
 %if %{with tests}
-tclsh tests/test_helper.tcl
+%{__make} test
 %endif
 
 %install
 rm -rf $RPM_BUILD_ROOT
-# Install binaries
-install -p -D %{name}-benchmark $RPM_BUILD_ROOT%{_bindir}/%{name}-benchmark
-install -p -D %{name}-cli $RPM_BUILD_ROOT%{_bindir}/%{name}-cli
-install -p -D %{name}-check-aof $RPM_BUILD_ROOT%{_bindir}/%{name}-check-aof
-install -p -D %{name}-check-dump $RPM_BUILD_ROOT%{_bindir}/%{name}-check-dump
-install -p -D %{name}-server $RPM_BUILD_ROOT%{_sbindir}/%{name}-server
+install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{_sbindir}} \
+       $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d} \
+       $RPM_BUILD_ROOT%{_localstatedir}/{{lib,log,run}/%{name},log/archive/%{name}} \
+       $RPM_BUILD_ROOT%{systemdtmpfilesdir} \
+       $RPM_BUILD_ROOT%{_mandir}/man{1,5}
+
+%{__make} install \
+       INSTALL="install -p" \
+       PREFIX=$RPM_BUILD_ROOT%{_prefix}
+
+# Fix non-standard-executable-perm error
+chmod a+x $RPM_BUILD_ROOT%{_bindir}/%{name}-*
+
+# Ensure redis-server location doesn't change
+mv $RPM_BUILD_ROOT{%{_bindir},%{_sbindir}}/%{name}-server
+mv $RPM_BUILD_ROOT{%{_bindir},%{_sbindir}}/%{name}-sentinel
+
 # Install misc other
-install -p -D %{SOURCE1} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
-install -p -D %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
-install -p -D %{name}.conf $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.conf
-install -d $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}
-install -d $RPM_BUILD_ROOT%{_localstatedir}/log/%{name}
-install -d $RPM_BUILD_ROOT%{_localstatedir}/run/%{name}
+install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
+cp -p %{SOURCE1} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
+cp -p %{name}.conf $RPM_BUILD_ROOT%{_sysconfdir}
+cp -p %{SOURCE3} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{name}.conf
+
+# man-pages
+for man in man/man1/*; do
+       install $man $RPM_BUILD_ROOT%{_mandir}/man1
+done
+for man in man/man5/*; do
+       install $man $RPM_BUILD_ROOT%{_mandir}/man5
+done
+
+# sentinel can be symlinked
+echo ".so man1/redis-server.1" > $RPM_BUILD_ROOT%{_mandir}/man1/redis-sentinel.1
+echo ".so man5/redis.conf.5" > $RPM_BUILD_ROOT%{_mandir}/man5/redis-sentinel.conf.5
 
 %clean
-rm -fr $RPM_BUILD_ROOT
+rm -rf $RPM_BUILD_ROOT
 
-%post
-/sbin/chkconfig --add redis
+%pre server
+%groupadd -g 256 redis
+%useradd -u 256 -g redis -d %{_sharedstatedir}/redis -s /sbin/nologin -c 'Redis Server' redis
 
-%pre
-%groupadd -g 99 redis
-%useradd -u 99 -g redis -d %{_sharedstatedir}/redis -s /sbin/nologin -c 'Redis Server' redis
+%post server
+/sbin/chkconfig --add redis
+%service redis restart
 
-%preun
+%preun server
 if [ "$1" = 0 ]; then
        %service redis stop
        /sbin/chkconfig --del redis
 fi
 
+%postun server
+if [ "$1" = "0" ]; then
+       %userremove redis
+       %groupremove redis
+fi
+
 %files
 %defattr(644,root,root,755)
-%doc 00-RELEASENOTES BUGS COPYING Changelog README TODO doc/
+%doc 00-RELEASENOTES BUGS CONTRIBUTING COPYING INSTALL MANIFESTO README.md
+%attr(755,root,root) %{_bindir}/redis-benchmark
+%attr(755,root,root) %{_bindir}/redis-cli
+%{_mandir}/man1/redis-benchmark.1*
+%{_mandir}/man1/redis-cli.1*
+
+%files server
+%defattr(644,root,root,755)
 %config(noreplace) %{_sysconfdir}/%{name}.conf
 %attr(754,root,root) /etc/rc.d/init.d/%{name}
-%attr(755,root,root) %{_bindir}/%{name}-*
-%attr(755,root,root) %{_sbindir}/%{name}-*
+%attr(755,root,root) %{_sbindir}/redis-sentinel
+%attr(755,root,root) %{_sbindir}/redis-server
+%attr(755,root,root) %{_bindir}/redis-check-aof
+%attr(755,root,root) %{_bindir}/redis-check-rdb
 %config(noreplace) /etc/logrotate.d/%{name}
 %dir %attr(755,redis,root) %{_localstatedir}/lib/%{name}
 %dir %attr(755,redis,root) %{_localstatedir}/log/%{name}
+%dir %attr(755,redis,root) %{_localstatedir}/log/archive/%{name}
 %dir %attr(755,redis,root) %{_localstatedir}/run/%{name}
+%{systemdtmpfilesdir}/%{name}.conf
+%{_mandir}/man1/redis-sentinel.1*
+%{_mandir}/man1/redis-server.1*
+%{_mandir}/man1/redis-check-aof.1*
+%{_mandir}/man1/redis-check-rdb.1*
+%{_mandir}/man5/redis.conf.5*
+%{_mandir}/man5/redis-sentinel.conf.5*
This page took 0.032177 seconds and 4 git commands to generate.