redis-vl.spec 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. %bcond_with systemd
  2. # Check for status of man pages
  3. # http://code.google.com/p/redis/issues/detail?id=202
  4. # Commit IDs for the (unversioned) redis-doc repository
  5. # https://fedoraproject.org/wiki/Packaging:SourceURL "Commit Revision"
  6. %global doc_commit 4f1da37c03daa943f2cf3cd5fda8dbd1bf1f22d7
  7. %global short_doc_commit %(c=%{doc_commit}; echo ${c:0:7})
  8. # %%{rpmmacrodir} not usable on EL-6
  9. %global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d)
  10. %ifarch %{ix86} x86_64 ppc
  11. # available only on selected architectures
  12. %global with_perftools 1
  13. %endif
  14. Name: redis
  15. Version: 6.0.5
  16. Release: 1%{?_dist_release}%{?with_systemd:.systemd}
  17. Summary: A persistent in-memory key-value database
  18. Summary(ja): 永続化可能なキー・バリュー型インメモリデータベース
  19. Group: Applications/Databases
  20. License: BSD
  21. URL: https://redis.io
  22. Vendor: Project Vine
  23. Distribution: Vine Linux
  24. Packager: daisuke
  25. Source0: https://github.com/redis-io/redis/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
  26. Source1: %{name}.logrotate
  27. Source2: %{name}-sentinel.service
  28. Source3: %{name}.service
  29. Source4: %{name}-sentinel.init
  30. Source5: %{name}.init
  31. Source6: %{name}-shutdown
  32. Source7: %{name}-limit-systemd
  33. Source8: %{name}-limit-init
  34. Source9: macros.%{name}
  35. Source10: https://github.com/redis-io/%{name}-doc/archive/%{doc_commit}/%{name}-doc-%{short_doc_commit}.tar.gz
  36. # To refresh patches:
  37. # tar xf redis-xxx.tar.gz && cd redis-xxx && git init && git add . && git commit -m "%%{version} baseline"
  38. # git am %%{patches}
  39. # Then refresh your patches
  40. # git format-patch HEAD~<number of expected patches>
  41. # Update configuration for Fedora
  42. # https://github.com/antirez/redis/pull/3491 - man pages
  43. Patch0001: 0001-1st-man-pageis-for-redis-cli-redis-benchmark-redis-c.patch
  44. # https://github.com/antirez/redis/pull/3494 - symlink
  45. Patch0002: 0002-install-redis-check-rdb-as-a-symlink-instead-of-dupl.patch
  46. BuildRoot: %{_tmppath}/%{name}-%{version}-root
  47. %if %{?with_perftools}
  48. BuildRequires: gperftools-devel
  49. %endif
  50. Requires: logrotate
  51. %if %{with systemd}
  52. BuildRequires: systemd
  53. Requires(post): systemd
  54. Requires(preun): systemd
  55. Requires(postun): systemd
  56. %else
  57. Requires(post): chkconfig
  58. Requires(postun): initscripts
  59. Requires(preun): chkconfig
  60. Requires(preun): initscripts
  61. %endif
  62. Requires(pre): shadow-utils
  63. %global redis_modules_abi 1
  64. %global redis_modules_dir %{_libdir}/%{name}/modules
  65. Provides: redis(modules_abi)%{?_isa} = %{redis_modules_abi}
  66. %description
  67. Redis is an advanced key-value store. It is similar to memcached but the data
  68. set is not volatile, and values can be strings, exactly like in memcached, but
  69. also lists, sets, and ordered sets. All this data types can be manipulated with
  70. atomic operations to push/pop elements, add/remove elements, perform server side
  71. union, intersection, difference between sets, and so forth. Redis supports
  72. different kind of sorting abilities.
  73. %package devel
  74. Summary: Development header for Redis module development
  75. # Header-Only Library (https://fedoraproject.org/wiki/Packaging:Guidelines)
  76. Provides: %{name}-static = %{version}-%{release}
  77. %description devel
  78. Header file required for building loadable Redis modules. Detailed
  79. API documentation is available in the redis-doc package.
  80. %package doc
  81. Summary: Documentation for Redis including man pages
  82. License: CC-BY-SA
  83. BuildArch: noarch
  84. # http://fedoraproject.org/wiki/Packaging:Conflicts "Splitting Packages"
  85. Conflicts: redis < 4.0
  86. %description doc
  87. Manual pages and detailed documentation for many aspects of Redis use,
  88. administration and development.
  89. %prep
  90. %setup -q -b 10
  91. %setup -q
  92. mv ../%{name}-doc-%{doc_commit} doc
  93. %patch0001 -p1
  94. %patch0002 -p1
  95. mv deps/lua/COPYRIGHT COPYRIGHT-lua
  96. mv deps/hiredis/COPYING COPYING-hiredis
  97. # Configuration file changes
  98. sed -i -e 's|^logfile .*$|logfile /var/log/redis/redis.log|g' redis.conf
  99. sed -i -e 's|^logfile .*$|logfile /var/log/redis/sentinel.log|g' sentinel.conf
  100. sed -i -e 's|^dir .*$|dir /var/lib/redis|g' redis.conf
  101. sed -i -e 's|^daemonize no$|daemonize yes|g' redis.conf
  102. sed -i -e 's|^protected-mode no$|protected-mode yes|g' redis.conf
  103. sed -i -e 's|^# bind 127\.0\.0\.1$|bind 127.0.0.1|g' redis.conf
  104. # Module API version safety check
  105. api=`sed -n -e 's/#define REDISMODULE_APIVER_[0-9][0-9]* //p' src/redismodule.h`
  106. if test "$api" != "%{redis_modules_abi}"; then
  107. : Error: Upstream API version is now ${api}, expecting %%{redis_modules_abi}.
  108. : Update the redis_modules_abi macro, the rpmmacros file, and rebuild.
  109. exit 1
  110. fi
  111. %global make_flags DEBUG="" V="echo" LDFLAGS="%{?__global_ldflags}" CFLAGS+="%{optflags} -fPIC" INSTALL="install -p" PREFIX=%{buildroot}%{_prefix}
  112. %build
  113. make %{?_smp_mflags} %{make_flags} all
  114. %check
  115. # make test
  116. %install
  117. make %{make_flags} install
  118. # Filesystem.
  119. install -d %{buildroot}%{_sharedstatedir}/%{name}
  120. install -d %{buildroot}%{_localstatedir}/log/%{name}
  121. install -d %{buildroot}%{_localstatedir}/run/%{name}
  122. install -d %{buildroot}%{redis_modules_dir}
  123. # Install logrotate file.
  124. install -pDm644 %{S:1} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
  125. # Install configuration files.
  126. mkdir -p %{buildroot}%{_sysconfdir}/%{name}
  127. install -pDm640 %{name}.conf %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf
  128. install -pDm640 sentinel.conf %{buildroot}%{_sysconfdir}/%{name}/%{name}-sentinel.conf
  129. %if %{with systemd}
  130. # Install systemd unit files.
  131. mkdir -p %{buildroot}%{_unitdir}
  132. install -pm644 %{S:3} %{buildroot}%{_unitdir}
  133. install -pm644 %{S:2} %{buildroot}%{_unitdir}
  134. # Install systemd limit files (requires systemd >= 204)
  135. install -p -D -m 644 %{S:7} %{buildroot}%{_sysconfdir}/systemd/system/%{name}.service.d/limit.conf
  136. install -p -D -m 644 %{S:7} %{buildroot}%{_sysconfdir}/systemd/system/%{name}-sentinel.service.d/limit.conf
  137. %else
  138. mkdir -p %{buildroot}%{_initdir}
  139. install -pm755 %{S:4} %{buildroot}%{_initdir}/%{name}-sentinel
  140. install -pm755 %{S:5} %{buildroot}%{_initdir}/%{name}
  141. install -pm755 %{S:8} %{buildroot}%{_initdir}/%{name}-limit
  142. %endif
  143. # Fix non-standard-executable-perm error.
  144. chmod 755 %{buildroot}%{_bindir}/%{name}-*
  145. # Install redis-shutdown
  146. install -pDm755 %{S:6} %{buildroot}%{_libexecdir}/%{name}-shutdown
  147. # Install redis module header
  148. install -pDm644 src/%{name}module.h %{buildroot}%{_includedir}/%{name}module.h
  149. # Install man pages
  150. man=$(dirname %{buildroot}%{_mandir})
  151. for page in man/man?/*; do
  152. install -Dpm644 $page $man/$page
  153. done
  154. ln -s redis-server.1 %{buildroot}%{_mandir}/man1/redis-sentinel.1
  155. ln -s redis.conf.5 %{buildroot}%{_mandir}/man5/redis-sentinel.conf.5
  156. # Install documentation and html pages
  157. doc=$(echo %{buildroot}/%{_docdir}/%{name})
  158. for page in 00-RELEASENOTES BUGS CONTRIBUTING MANIFESTO; do
  159. install -Dpm644 $page $doc/$page
  160. done
  161. for page in $(find doc -name \*.md | sed -e 's|.md$||g'); do
  162. base=$(echo $page | sed -e 's|doc/||g')
  163. install -Dpm644 $page.md $doc/$base.md
  164. done
  165. # Install rpm macros for redis modules
  166. mkdir -p %{buildroot}%{macrosdir}
  167. install -pDm644 %{S:9} %{buildroot}%{macrosdir}/macros.%{name}
  168. %post
  169. %if %{with systemd}
  170. %systemd_post %{name}.service
  171. %systemd_post %{name}-sentinel.service
  172. %else
  173. if [ $1 -eq 1 ]; then
  174. /sbin/chkconfig --add %{name}
  175. /sbin/chkconfig --add %{name}-sentinel
  176. fi
  177. %endif
  178. %pre
  179. getent group %{name} &> /dev/null || \
  180. groupadd -r %{name} &> /dev/null
  181. getent passwd %{name} &> /dev/null || \
  182. useradd -r -g %{name} -d %{_sharedstatedir}/%{name} -s /sbin/nologin \
  183. -c 'Redis Database Server' %{name} &> /dev/null
  184. exit 0
  185. %preun
  186. %if %{with systemd}
  187. %systemd_preun %{name}.service
  188. %systemd_preun %{name}-sentinel.service
  189. %else
  190. if [ $1 -eq 0 -o -x /sbin/systemctl ]; then
  191. /sbin/service %{name} stop ||:
  192. /sbin/service %{name}-sentinel stop ||:
  193. /sbin/chkconfig --del %{name}
  194. /sbin/chkconfig --del %{name}-sentinel
  195. fi
  196. %endif
  197. %postun
  198. %if %{with systemd}
  199. %systemd_postun_with_restart %{name}.service
  200. %systemd_postun_with_restart %{name}-sentinel.service
  201. %else
  202. if [ $1 -gt 0 ]; then
  203. if [ -x /sbin/systemctl ]; then
  204. /sbin/service %{name} stop ||:
  205. else
  206. /sbin/service %{name} condrestart ||:
  207. fi
  208. fi
  209. %endif
  210. %files
  211. %{!?_licensedir:%global license %%doc}
  212. %license COPYING
  213. %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
  214. %dir %{_sysconfdir}/%{name}
  215. %attr(0640, redis, root) %config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
  216. %attr(0640, redis, root) %config(noreplace) %{_sysconfdir}/%{name}/%{name}-sentinel.conf
  217. %dir %attr(0750, redis, redis) %{_libdir}/%{name}
  218. %dir %attr(0750, redis, redis) %{redis_modules_dir}
  219. %dir %attr(0750, redis, redis) %{_sharedstatedir}/%{name}
  220. %dir %attr(0750, redis, redis) %{_localstatedir}/log/%{name}
  221. %exclude %{macrosdir}
  222. %exclude %{_includedir}
  223. %exclude %{_docdir}/%{name}/*
  224. %{_bindir}/%{name}-*
  225. %{_libexecdir}/%{name}-*
  226. %{_mandir}/man1/%{name}*
  227. %{_mandir}/man5/%{name}*
  228. %if %{with systemd}
  229. %{_unitdir}/%{name}.service
  230. %{_unitdir}/%{name}-sentinel.service
  231. %dir %{_sysconfdir}/systemd/system/%{name}.service.d
  232. %config(noreplace) %{_sysconfdir}/systemd/system/%{name}.service.d/limit.conf
  233. %dir %{_sysconfdir}/systemd/system/%{name}-sentinel.service.d
  234. %config(noreplace) %{_sysconfdir}/systemd/system/%{name}-sentinel.service.d/limit.conf
  235. %else
  236. %{_initdir}/*
  237. %endif
  238. %dir %attr(0755, redis, redis) %{_localstatedir}/run/%{name}
  239. %files devel
  240. %license COPYING
  241. %license COPYRIGHT-lua
  242. %license COPYING-hiredis
  243. %{_includedir}/%{name}module.h
  244. %{macrosdir}/*
  245. %files doc
  246. %docdir %{_docdir}/%{name}
  247. %{_docdir}/%{name}
  248. %changelog
  249. * Thu Jul 02 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 6.0.5-1
  250. - new upstream release.
  251. * Fri Apr 10 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 5.0.8-1
  252. - new upstream release.
  253. * Sun Sep 08 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 5.0.5-1
  254. - new upstream release.
  255. * Mon Mar 11 2013 Daisuke SUZUKI <daisuke@linux.or.jp> 2.6.10-1
  256. - update to 2.6.10
  257. * Sat Oct 27 2012 Daisuke SUZUKI <daisuke@linux.or.jp> 2.4.15-1
  258. - initial build for Vine Linux
  259. * Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4.15-3
  260. - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
  261. * Sun Jul 08 2012 Silas Sewell <silas@sewell.org> - 2.4.15-2
  262. - Remove TODO from docs
  263. * Sun Jul 08 2012 Silas Sewell <silas@sewell.org> - 2.4.15-1
  264. - Update to redis 2.4.15
  265. * Sat May 19 2012 Silas Sewell <silas@sewell.org> - 2.4.13-1
  266. - Update to redis 2.4.13
  267. * Sat Mar 31 2012 Silas Sewell <silas@sewell.org> - 2.4.10-1
  268. - Update to redis 2.4.10
  269. * Fri Feb 24 2012 Silas Sewell <silas@sewell.org> - 2.4.8-1
  270. - Update to redis 2.4.8
  271. * Sat Feb 04 2012 Silas Sewell <silas@sewell.org> - 2.4.7-1
  272. - Update to redis 2.4.7
  273. * Wed Feb 01 2012 Fabian Deutsch <fabiand@fedoraproject.org> - 2.4.6-4
  274. - Fixed a typo in the spec
  275. * Tue Jan 31 2012 Fabian Deutsch <fabiand@fedoraproject.org> - 2.4.6-3
  276. - Fix .service file, to match config (Type=simple).
  277. * Tue Jan 31 2012 Fabian Deutsch <fabiand@fedoraproject.org> - 2.4.6-2
  278. - Fix .service file, credits go to Timon.
  279. * Thu Jan 12 2012 Fabian Deutsch <fabiand@fedoraproject.org> - 2.4.6-1
  280. - Update to 2.4.6
  281. - systemd unit file added
  282. - Compiler flags changed to compile 2.4.6
  283. - Remove doc/ and Changelog
  284. * Sun Jul 24 2011 Silas Sewell <silas@sewell.org> - 2.2.12-1
  285. - Update to redis 2.2.12
  286. * Fri May 06 2011 Dan Horák <dan[at]danny.cz> - 2.2.5-2
  287. - google-perftools exists only on selected architectures
  288. * Sat Apr 23 2011 Silas Sewell <silas@sewell.ch> - 2.2.5-1
  289. - Update to redis 2.2.5
  290. * Sat Mar 26 2011 Silas Sewell <silas@sewell.ch> - 2.2.2-1
  291. - Update to redis 2.2.2
  292. * Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.4-2
  293. - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
  294. * Sun Dec 19 2010 Silas Sewell <silas@sewell.ch> - 2.0.4-1
  295. - Update to redis 2.0.4
  296. * Tue Oct 19 2010 Silas Sewell <silas@sewell.ch> - 2.0.3-1
  297. - Update to redis 2.0.3
  298. * Fri Oct 08 2010 Silas Sewell <silas@sewell.ch> - 2.0.2-1
  299. - Update to redis 2.0.2
  300. - Disable checks section for el5
  301. * Sat Sep 11 2010 Silas Sewell <silas@sewell.ch> - 2.0.1-1
  302. - Update to redis 2.0.1
  303. * Sat Sep 04 2010 Silas Sewell <silas@sewell.ch> - 2.0.0-1
  304. - Update to redis 2.0.0
  305. * Thu Sep 02 2010 Silas Sewell <silas@sewell.ch> - 1.2.6-3
  306. - Add Fedora build flags
  307. - Send all scriplet output to /dev/null
  308. - Remove debugging flags
  309. - Add redis.conf check to init script
  310. * Mon Aug 16 2010 Silas Sewell <silas@sewell.ch> - 1.2.6-2
  311. - Don't compress man pages
  312. - Use patch to fix redis.conf
  313. * Tue Jul 06 2010 Silas Sewell <silas@sewell.ch> - 1.2.6-1
  314. - Initial package