ソースを参照

redis-5.0.5-1

git-svn-id: http://trac.vinelinux.org/repos/projects/specs@12187 ec354946-7b23-47d6-9f5a-488ba84defc7
tomop 5 年 前
コミット
ef649e3e13
1 ファイル変更234 行追加47 行削除
  1. 234 47
      r/redis/redis-vl.spec

+ 234 - 47
r/redis/redis-vl.spec

@@ -1,24 +1,57 @@
+%bcond_with systemd
+
 # Check for status of man pages
 # http://code.google.com/p/redis/issues/detail?id=202
 
+# Commit IDs for the (unversioned) redis-doc repository
+# https://fedoraproject.org/wiki/Packaging:SourceURL "Commit Revision"
+%global doc_commit 1797cc9887752f9e3dac876fe3e1291d63c65629
+%global short_doc_commit %(c=%{doc_commit}; echo ${c:0:7})
+
+# %%{rpmmacrodir} not usable on EL-6
+%global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d)
+
 %ifarch %{ix86} x86_64 ppc
 # available only on selected architectures
 %global with_perftools 1
 %endif
 
 Name:             redis
-Version:          2.6.10
+Version:          5.0.5
 Release:          1%{?_dist_release}
 Summary:          A persistent in-memory key-value database
 Summary(ja):      永続化可能なキー・バリュー型インメモリデータベース
 
 Group:            Applications/Databases
 License:          BSD
-URL:              http://redis.io
-Source0:          http://redis.googlecode.com/files/%{name}-%{version}.tar.gz
+URL:              https://redis.io
+
+Vendor:           Project Vine
+Distribution:     Vine Linux
+Packager:         daisuke
+
+Source0:          https://download.redis.io/releases/%{name}-%{version}.tar.gz
 Source1:          %{name}.logrotate
-Source2:          %{name}.init
-Patch0:           %{name}-2.6.10-vine.patch
+Source2:          %{name}-sentinel.service
+Source3:          %{name}.service
+Source4:          %{name}-sentinel.init
+Source5:          %{name}.init
+Source6:          %{name}-shutdown
+Source7:          %{name}-limit-systemd
+Source8:          %{name}-limit-init
+Source9:          macros.%{name}
+Source10:         https://github.com/antirez/%{name}-doc/archive/%{doc_commit}/%{name}-doc-%{short_doc_commit}.tar.gz
+
+# To refresh patches:
+# tar xf redis-xxx.tar.gz && cd redis-xxx && git init && git add . && git commit -m "%%{version} baseline"
+# git am %%{patches}
+# Then refresh your patches
+# git format-patch HEAD~<number of expected patches>
+# Update configuration for Fedora
+# https://github.com/antirez/redis/pull/3491 - man pages
+Patch0001:         0001-1st-man-pageis-for-redis-cli-redis-benchmark-redis-c.patch
+# https://github.com/antirez/redis/pull/3494 - symlink
+Patch0002:         0002-install-redis-check-rdb-as-a-symlink-instead-of-dupl.patch
 
 BuildRoot:	  %{_tmppath}/%{name}-%{version}-root
 %if %{?with_perftools}
@@ -26,16 +59,23 @@ BuildRequires:    gperftools-devel
 %endif
 
 Requires:         logrotate
+%if %{with systemd}
+BuildRequires:     systemd
+Requires(post):    systemd
+Requires(preun):   systemd
+Requires(postun):  systemd
+%else
 Requires(post):   chkconfig
 Requires(postun): initscripts
-Requires(pre):    shadow-utils
 Requires(preun):  chkconfig
 Requires(preun):  initscripts
+%endif
+Requires(pre):    shadow-utils
 
-Distribution: Vine Linux
-Vendor: Project Vine
-Packager: daisuke
 
+%global redis_modules_abi 1
+%global redis_modules_dir %{_libdir}/%{name}/modules
+Provides:          redis(modules_abi)%{?_isa} = %{redis_modules_abi}
 
 %description
 Redis is an advanced key-value store. It is similar to memcached but the data
@@ -46,69 +86,216 @@ union, intersection, difference between sets, and so forth. Redis supports
 different kind of sorting abilities.
 
 
+%package           devel
+Summary:           Development header for Redis module development
+# Header-Only Library (https://fedoraproject.org/wiki/Packaging:Guidelines)
+Provides:          %{name}-static = %{version}-%{release}
+
+%description       devel
+Header file required for building loadable Redis modules. Detailed
+API documentation is available in the redis-doc package.
+
+
+%package           doc
+Summary:           Documentation for Redis including man pages
+License:           CC-BY-SA
+BuildArch:         noarch
+
+# http://fedoraproject.org/wiki/Packaging:Conflicts "Splitting Packages"
+Conflicts:         redis < 4.0
+
+%description       doc
+Manual pages and detailed documentation for many aspects of Redis use,
+administration and development.
+
+
 %prep
+%setup -q -b 10
 %setup -q
-%patch0 -p1 -b .vine
+mv ../%{name}-doc-%{doc_commit} doc
+%patch0001 -p1
+%patch0002 -p1
+
+mv deps/lua/COPYRIGHT    COPYRIGHT-lua
+mv deps/hiredis/COPYING  COPYING-hiredis
+
+# 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
+
+sed -i -e 's|^daemonize no$|daemonize yes|g' redis.conf
+sed -i -e 's|^protected-mode no$|protected-mode yes|g' redis.conf
+sed -i -e 's|^# bind 127\.0\.0\.1$|bind 127.0.0.1|g' redis.conf
+
+# Module API version safety check
+api=`sed -n -e 's/#define REDISMODULE_APIVER_[0-9][0-9]* //p' src/redismodule.h`
+if test "$api" != "%{redis_modules_abi}"; then
+   : Error: Upstream API version is now ${api}, expecting %%{redis_modules_abi}.
+   : Update the redis_modules_abi macro, the rpmmacros file, and rebuild.
+   exit 1
+fi
+
+%global make_flags	DEBUG="" V="echo" LDFLAGS="%{?__global_ldflags}" CFLAGS+="%{optflags} -fPIC" INSTALL="install -p" PREFIX=%{buildroot}%{_prefix}
+
 
 %build
-make %{?_smp_mflags} \
-  DEBUG="" \
-  CFLAGS='%{optflags}' \
-%if %{?with_perftools}
-  USE_TCMALLOC=yes \
-%endif
-  all
+make %{?_smp_mflags} %{make_flags} all
 
 %check
 # make test
 
 %install
-make install PREFIX=%{buildroot}%{_prefix}
-# Install misc other
-install -p -D -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
-install -p -D -m 755 %{SOURCE2} %{buildroot}%{_initrddir}/%{name}
-install -p -D -m 644 %{name}.conf %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf
-install -d -m 755 %{buildroot}%{_localstatedir}/lib/%{name}
-install -d -m 755 %{buildroot}%{_localstatedir}/log/%{name}
-install -d -m 755 %{buildroot}%{_localstatedir}/run/%{name}
-
-# Fix non-standard-executable-perm error
+make %{make_flags} install
+
+# Filesystem.
+install -d %{buildroot}%{_sharedstatedir}/%{name}
+install -d %{buildroot}%{_localstatedir}/log/%{name}
+install -d %{buildroot}%{_localstatedir}/run/%{name}
+install -d %{buildroot}%{redis_modules_dir}
+
+# Install logrotate file.
+install -pDm644 %{S:1} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
+
+# Install configuration files.
+mkdir -p %{buildroot}%{_sysconfdir}/%{name}
+install -pDm640 %{name}.conf %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf
+install -pDm640 sentinel.conf %{buildroot}%{_sysconfdir}/%{name}/%{name}-sentinel.conf
+
+%if %{with systemd}
+# Install systemd unit files.
+mkdir -p %{buildroot}%{_unitdir}
+install -pm644 %{S:3} %{buildroot}%{_unitdir}
+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
+mkdir -p %{buildroot}%{_initdir}
+install -pm755 %{S:4} %{buildroot}%{_initdir}/%{name}-sentinel
+install -pm755 %{S:5} %{buildroot}%{_initdir}/%{name}
+install -pm755 %{S:8} %{buildroot}%{_initdir}/%{name}-limit
+%endif
+
+
+# Fix non-standard-executable-perm error.
 chmod 755 %{buildroot}%{_bindir}/%{name}-*
 
-# Ensure redis-server location doesn't change
-mkdir -p %{buildroot}%{_sbindir}
-mv %{buildroot}%{_bindir}/%{name}-server %{buildroot}%{_sbindir}/%{name}-server
+# Install redis-shutdown
+install -pDm755 %{S:6} %{buildroot}%{_libexecdir}/%{name}-shutdown
+
+# Install redis module header
+install -pDm644 src/%{name}module.h %{buildroot}%{_includedir}/%{name}module.h
+
+# Install man pages
+man=$(dirname %{buildroot}%{_mandir})
+for page in man/man?/*; do
+    install -Dpm644 $page $man/$page
+done
+ln -s redis-server.1 %{buildroot}%{_mandir}/man1/redis-sentinel.1
+ln -s redis.conf.5   %{buildroot}%{_mandir}/man5/redis-sentinel.conf.5
+
+# Install documentation and html pages
+doc=$(echo %{buildroot}/%{_docdir}/%{name})
+for page in 00-RELEASENOTES BUGS CONTRIBUTING MANIFESTO; do
+    install -Dpm644 $page $doc/$page
+done
+for page in $(find doc -name \*.md | sed -e 's|.md$||g'); do
+    base=$(echo $page | sed -e 's|doc/||g')
+    install -Dpm644 $page.md $doc/$base.md
+done
+
+# Install rpm macros for redis modules
+mkdir -p %{buildroot}%{macrosdir}
+install -pDm644 %{S:9} %{buildroot}%{macrosdir}/macros.%{name}
+
 
 %post
-/sbin/chkconfig --add redis
+%if %{with systemd}
+%systemd_post %{name}.service
+%systemd_post %{name}-sentinel.service
+%else
+if [ $1 -eq 1 ]; then
+	/sbin/chkconfig --add %{name}
+	/sbin/chkconfig --add %{name}-sentinel
+fi
+%endif
 
 %pre
-getent group redis &> /dev/null || groupadd -r redis &> /dev/null
-getent passwd redis &> /dev/null || \
-useradd -r -g redis -d %{_localstatedir}/lib/%{name} -s /sbin/nologin \
--c 'Redis Server' redis &> /dev/null
+getent group %{name} &> /dev/null || \
+groupadd -r %{name} &> /dev/null
+getent passwd %{name} &> /dev/null || \
+useradd -r -g %{name} -d %{_sharedstatedir}/%{name} -s /sbin/nologin \
+-c 'Redis Database Server' %{name} &> /dev/null
 exit 0
 
 %preun
-if [ $1 = 0 ]; then
-  /sbin/service redis stop &> /dev/null
-  /sbin/chkconfig --del redis &> /dev/null
+%if %{with systemd}
+%systemd_preun %{name}.service
+%systemd_preun %{name}-sentinel.service
+%else
+if [ $1 -eq 0 ]; then
+	/sbin/service %{name} stop ||:
+	/sbin/service %{name}-sentinel stop ||:
+	/sbin/chkconfig --del %{name}
+	/sbin/chkconfig --del %{name}-sentinel
 fi
+%endif
+
+%postun
+%if %{with systemd}
+%systemd_postun_with_restart %{name}.service
+%systemd_postun_with_restart %{name}-sentinel.service
+%endif
+
 
 %files
-%defattr(-,root,root,-)
-%doc 00-RELEASENOTES BUGS CONTRIBUTING COPYING README
+%{!?_licensedir:%global license %%doc}
+%license COPYING
 %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
-%config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
-%dir %attr(0755, redis, redis) %{_localstatedir}/lib/%{name}
-%dir %attr(0755, redis, redis) %{_localstatedir}/log/%{name}
-%dir %attr(0755, redis, redis) %{_localstatedir}/run/%{name}
+%dir %{_sysconfdir}/%{name}
+%attr(0640, redis, root) %config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
+%attr(0640, redis, root) %config(noreplace) %{_sysconfdir}/%{name}/%{name}-sentinel.conf
+%dir %attr(0750, redis, redis) %{_libdir}/%{name}
+%dir %attr(0750, redis, redis) %{redis_modules_dir}
+%dir %attr(0750, redis, redis) %{_sharedstatedir}/%{name}
+%dir %attr(0750, redis, redis) %{_localstatedir}/log/%{name}
+%exclude %{macrosdir}
+%exclude %{_includedir}
+%exclude %{_docdir}/%{name}/*
 %{_bindir}/%{name}-*
-%{_sbindir}/%{name}-*
-%{_initrddir}/%{name}
-#%{_unitdir}/%{name}.service
+%{_libexecdir}/%{name}-*
+%{_mandir}/man1/%{name}*
+%{_mandir}/man5/%{name}*
+%if %{with systemd}
+%{_unitdir}/%{name}.service
+%{_unitdir}/%{name}-sentinel.service
+%dir %{_sysconfdir}/systemd/system/%{name}.service.d
+%config(noreplace) %{_sysconfdir}/systemd/system/%{name}.service.d/limit.conf
+%dir %{_sysconfdir}/systemd/system/%{name}-sentinel.service.d
+%config(noreplace) %{_sysconfdir}/systemd/system/%{name}-sentinel.service.d/limit.conf
+%else
+%{_initdir}/*
+%endif
+%dir %attr(0755, redis, redis) %{_localstatedir}/run/%{name}
+
+%files devel
+%license COPYING
+%license COPYRIGHT-lua
+%license COPYING-hiredis
+%{_includedir}/%{name}module.h
+%{macrosdir}/*
+
+%files doc
+%docdir %{_docdir}/%{name}
+%{_docdir}/%{name}
+
 
 %changelog
+* Sun Sep 08 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 5.0.5-1
+- new upstream release.
+
 * Mon Mar 11 2013 Daisuke SUZUKI <daisuke@linux.or.jp> 2.6.10-1
 - update to 2.6.10