LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File redis.spec of Package redis (Project server:database)

# spec file for package redis
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/

%define _data_dir       %{_localstatedir}/lib/%{name}
%define _log_dir        %{_localstatedir}/log/%{name}
%define _conf_dir       %{_sysconfdir}/%{name}

Name:           redis
Version:        2.4.15
Release:        0
Summary:        Persistent key-value database
License:        BSD-3-Clause
Group:          Productivity/Databases/Servers
Url:            http://redis.io/
Source:         http://redis.googlecode.com/files/%{name}-%{version}.tar.gz
Source1:        %{name}.logrotate
Source4:        redis.sysconfig
# PATCH-FIX-OPENSUSE -- openSUSE-style init script
Patch0:         %{name}-initscript.patch
# PATCH-MISSING-TAG -- See http://wiki.opensuse.org/openSUSE:Packaging_Patches_guidelines
Patch1:         %{name}-conf.patch
# PATCH-FIX-UPSTREAM -- Fixed AOF: Server should have been started: Expected '1' to equal or match '0'
Patch2:         skip-aof-test.patch
Patch3:         redis-endian.patch
Patch4:         redis-2.4.15-linenoise-cflags.patch
# for make test
BuildRequires:  tcl
Requires:       logrotate
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

Redis is an advanced key-value store. It is similar to memcached but the dataset
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.

%setup -q
%patch2 -p1
%patch3 -p0
%patch4 -p0

# pushd deps/linenoise
# make CFLAGS="%{optflags}" 
# popd
# pushd deps/hiredis
# make CFLAGS="%{optflags}" 
# popd
make %{?_smp_mflags} CFLAGS="%{optflags}" V=1

install -d %{buildroot}%{_log_dir} %{buildroot}%{_data_dir} %{buildroot}%{_conf_dir}
install -d %{buildroot}%{_log_dir}/default %{buildroot}%{_data_dir}/default

install -D -m 0755 src/redis-benchmark  %{buildroot}%{_bindir}/redis-benchmark
install -m 0755 src/redis-cli           %{buildroot}%{_bindir}/redis-cli
install -m 0755 src/redis-check-dump    %{buildroot}%{_bindir}/redis-check-dump
install -m 0755 src/redis-check-aof     %{buildroot}%{_bindir}/redis-check-aof
install -D -m 0755 src/redis-server     %{buildroot}%{_sbindir}/redis-server

install -D -m 0640 redis.conf           %{buildroot}%{_conf_dir}/default.conf.example
## install -Dp -m 0755 %{SOURCE4}	%{buildroot}%{_sysconfdir}/sysconfig/redis

# init
install -D -m 0755 utils/redis_init_script %{buildroot}%{_sysconfdir}/init.d/redis
ln -s %{_sysconfdir}/init.d/%{name} %{buildroot}%{_sbindir}/rc%{name}

# logrotate
install -D -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}

%ifnarch ppc ppc64
cat <<EOF
The test suite often fails to start a server, with
'child process exited abnormally' -- sometimes it works.
make test && true

/usr/sbin/groupadd -r %{name} &>/dev/null || :
/usr/sbin/useradd -o -g %{name} -s /bin/false -r -c "User for Redis key-value store" -d %{_data_dir} %{name} &>/dev/null || :

%fillup_and_insserv %{name}
%restart_on_update %{name}
echo "To start the database server, create your configuration"
echo "starting from /etc/redis/default.conf.example, place it"
echo "in /etc/redis and do: "
echo " sudo rcredis start; sudo insserv redis"

%stop_on_removal %{name}


%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%config(noreplace) %{_sysconfdir}/init.d/redis
%config(noreplace) %attr(0640, %{name}, %{name}) %{_conf_dir}/default.conf.example
%dir %attr(0750, %{name}, %{name}) %{_data_dir}
%dir %attr(0750, %{name}, %{name}) %{_data_dir}/default
%dir %attr(0750, %{name}, %{name}) %{_log_dir}
%dir %attr(0750, %{name}, %{name}) %{_conf_dir}