From 74836e8db5299837e65fd23ba7632773541bfc05 Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Tue, 12 Sep 2017 17:28:06 +1000 Subject: [PATCH 1/5] Redis package builds for the 4.0 series Upstream redis-4.0.1 release packages, including a devel header-only package for module support. --- ...or-redis-cli-redis-benchmark-redis-c.patch | 2 +- ...eck-rdb-as-a-symlink-instead-of-dupl.patch | 17 ++++++----- redis.spec | 30 +++++++++++++++++-- sources | 2 +- 4 files changed, 38 insertions(+), 13 deletions(-) diff --git a/0001-1st-man-pageis-for-redis-cli-redis-benchmark-redis-c.patch b/0001-1st-man-pageis-for-redis-cli-redis-benchmark-redis-c.patch index 843dfb4..362b6de 100644 --- a/0001-1st-man-pageis-for-redis-cli-redis-benchmark-redis-c.patch +++ b/0001-1st-man-pageis-for-redis-cli-redis-benchmark-redis-c.patch @@ -1,4 +1,4 @@ -From e1ded77b1f80a5241f2f9b5088b9063ecbeb72c9 Mon Sep 17 00:00:00 2001 +From ed77684a7eb20635e7f8f8f3ead277c3c48182fe Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 8 Sep 2016 14:51:15 +0200 Subject: [PATCH 1/2] 1st man pageis for - redis-cli - redis-benchmark - diff --git a/0002-install-redis-check-rdb-as-a-symlink-instead-of-dupl.patch b/0002-install-redis-check-rdb-as-a-symlink-instead-of-dupl.patch index 4c4181a..4310cf3 100644 --- a/0002-install-redis-check-rdb-as-a-symlink-instead-of-dupl.patch +++ b/0002-install-redis-check-rdb-as-a-symlink-instead-of-dupl.patch @@ -1,25 +1,26 @@ -From bcd509def0d4a75f56d9d6a53eea280127803eb4 Mon Sep 17 00:00:00 2001 +From a7e5d1dab11be34fafe80180f58411f02cd98026 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 9 Sep 2016 17:23:27 +0200 -Subject: [PATCH 2/2] install redis-check-rdb as a symlink instead of - duplicating the binary +Subject: [PATCH 2/2] install redis-check-rdb as a symlink instead of duplicating + the binary --- - src/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + src/Makefile | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Makefile b/src/Makefile -index 6c27dd9..2de5e3f 100644 +index 4a8a326..a1bbfe9 100644 --- a/src/Makefile +++ b/src/Makefile -@@ -267,6 +267,6 @@ install: all +@@ -287,6 +287,6 @@ install: all $(REDIS_INSTALL) $(REDIS_SERVER_NAME) $(INSTALL_BIN) $(REDIS_INSTALL) $(REDIS_BENCHMARK_NAME) $(INSTALL_BIN) $(REDIS_INSTALL) $(REDIS_CLI_NAME) $(INSTALL_BIN) - $(REDIS_INSTALL) $(REDIS_CHECK_RDB_NAME) $(INSTALL_BIN) - $(REDIS_INSTALL) $(REDIS_CHECK_AOF_NAME) $(INSTALL_BIN) +- $(REDIS_INSTALL) $(REDIS_CHECK_AOF_NAME) $(INSTALL_BIN) @ln -sf $(REDIS_SERVER_NAME) $(INSTALL_BIN)/$(REDIS_SENTINEL_NAME) + @ln -sf $(REDIS_SERVER_NAME) $(INSTALL_BIN)/$(REDIS_CHECK_RDB_NAME) ++ @ln -sf $(REDIS_SERVER_NAME) $(INSTALL_BIN)/$(REDIS_CHECK_AOF_NAME) -- 2.9.3 diff --git a/redis.spec b/redis.spec index 3687968..8d32e17 100644 --- a/redis.spec +++ b/redis.spec @@ -17,8 +17,8 @@ %global with_tests %{?_with_tests:1}%{!?_with_tests:0} Name: redis -Version: 3.2.10 -Release: 3%{?dist} +Version: 4.0.1 +Release: 2%{?dist} Summary: A persistent key-value database License: BSD URL: http://redis.io @@ -98,6 +98,15 @@ a cache. You can use Redis from most programming languages also. +%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 available at [http://redis-module-redoc.readthedocs.io/] + %if 0%{?with_redistrib} %package trib Summary: Cluster management script for Redis @@ -151,6 +160,7 @@ make %{?_smp_mflags} \ %else MALLOC=jemalloc \ %endif + INSTALL="install -p" PREFIX=%{buildroot}%{_prefix} \ all %install @@ -189,6 +199,9 @@ chmod 755 %{buildroot}%{_bindir}/%{name}-* # 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 + %if 0%{?with_redistrib} # Install redis-trib install -pDm755 src/%{name}-trib.rb %{buildroot}%{_bindir}/%{name}-trib @@ -263,6 +276,7 @@ fi %if 0%{?with_redistrib} %exclude %{_bindir}/%{name}-trib %endif +%exclude %{_includedir}/%{name}module.h %{_bindir}/%{name}-* %{_libexecdir}/%{name}-* %{_mandir}/man1/%{name}* @@ -280,6 +294,10 @@ fi %config(noreplace) %{_sysconfdir}/security/limits.d/95-%{name}.conf %endif +%files devel +%license COPYING +%{_includedir}/%{name}module.h + %if 0%{?with_redistrib} %files trib %license COPYING @@ -288,10 +306,16 @@ fi %changelog -* Wed Sep 06 2017 Nathan Scott - 3.2.10-3 + +* Wed Sep 06 2017 Nathan Scott - 4.0.1-2 - Switch to using Type=notify for Redis systemd services (RHBZ #1172841) - Add Provides:bundled hiredis, linenoise, lua-libs clauses (RHBZ #788500) +* Mon Aug 14 2017 Nathan Scott - 4.0.1-1 +- Upstream 4.0.1 release. (RHBZ #1389592) +- Add redis-devel for loadable module development. +- Provide redis-check-aof as a symlink to redis-server also now. + * Mon Aug 14 2017 Nathan Scott - 3.2.10-2 - Add redis-trib based on patch from Sebastian Saletnik. (RHBZ #1215654) diff --git a/sources b/sources index 40c7ebf..9411699 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (redis-3.2.10.tar.gz) = 32fd27fac8ba559ea38e3a1006b90c4117c74a8ca15399ade19834c4221521e7e3669e4e1f24d214a53bb7cde896839438dd4a273d6be6def587841dd9954aa1 +SHA512 (redis-4.0.1.tar.gz) = 62dec537aebd12340b9642f5f8b07fd98757c9e648dcd539a0411f207db3495923c5a6a9941036c56b2d574ee38b46d08558668111e322345ef549f93fada26f From ac2422ae2594c3e5e324c8d0f4a91ec932dc5062 Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Wed, 27 Sep 2017 12:17:46 +1000 Subject: [PATCH 2/5] Update to redis 4.0.2 upstream release. Make redis-devel a noarch package as Remi suggests, first of many changes to come before 4.x builds are ready to go. --- .gitignore | 2 + ...or-redis-cli-redis-benchmark-redis-c.patch | 4 +- ...eck-rdb-as-a-symlink-instead-of-dupl.patch | 6 +- redis.spec | 58 +++++++------------ sources | 2 +- 5 files changed, 28 insertions(+), 44 deletions(-) diff --git a/.gitignore b/.gitignore index f2122e6..adbbf5b 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,5 @@ clog /redis-3.2.8.tar.gz /redis-3.2.9.tar.gz /redis-3.2.10.tar.gz +/redis-3.2.11.tar.gz +/redis-4.0.2.tar.gz diff --git a/0001-1st-man-pageis-for-redis-cli-redis-benchmark-redis-c.patch b/0001-1st-man-pageis-for-redis-cli-redis-benchmark-redis-c.patch index 362b6de..ab62c0c 100644 --- a/0001-1st-man-pageis-for-redis-cli-redis-benchmark-redis-c.patch +++ b/0001-1st-man-pageis-for-redis-cli-redis-benchmark-redis-c.patch @@ -1,4 +1,4 @@ -From ed77684a7eb20635e7f8f8f3ead277c3c48182fe Mon Sep 17 00:00:00 2001 +From c7958ad1c0d615b81276ec2d4dbc1bf6a67dcc4d Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 8 Sep 2016 14:51:15 +0200 Subject: [PATCH 1/2] 1st man pageis for - redis-cli - redis-benchmark - @@ -648,5 +648,5 @@ index 0000000..1e0c9c9 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -2.9.3 +2.13.5 diff --git a/0002-install-redis-check-rdb-as-a-symlink-instead-of-dupl.patch b/0002-install-redis-check-rdb-as-a-symlink-instead-of-dupl.patch index 4310cf3..ce09350 100644 --- a/0002-install-redis-check-rdb-as-a-symlink-instead-of-dupl.patch +++ b/0002-install-redis-check-rdb-as-a-symlink-instead-of-dupl.patch @@ -1,4 +1,4 @@ -From a7e5d1dab11be34fafe80180f58411f02cd98026 Mon Sep 17 00:00:00 2001 +From 992c773e70462a6fbe1536e18e673c9ab55d5901 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 9 Sep 2016 17:23:27 +0200 Subject: [PATCH 2/2] install redis-check-rdb as a symlink instead of duplicating @@ -9,7 +9,7 @@ Subject: [PATCH 2/2] install redis-check-rdb as a symlink instead of duplicating 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Makefile b/src/Makefile -index 4a8a326..a1bbfe9 100644 +index fdbe36a..c3083f8 100644 --- a/src/Makefile +++ b/src/Makefile @@ -287,6 +287,6 @@ install: all @@ -22,5 +22,5 @@ index 4a8a326..a1bbfe9 100644 + @ln -sf $(REDIS_SERVER_NAME) $(INSTALL_BIN)/$(REDIS_CHECK_RDB_NAME) + @ln -sf $(REDIS_SERVER_NAME) $(INSTALL_BIN)/$(REDIS_CHECK_AOF_NAME) -- -2.9.3 +2.13.5 diff --git a/redis.spec b/redis.spec index 8d32e17..bb1c2ec 100644 --- a/redis.spec +++ b/redis.spec @@ -17,8 +17,8 @@ %global with_tests %{?_with_tests:1}%{!?_with_tests:0} Name: redis -Version: 4.0.1 -Release: 2%{?dist} +Version: 4.0.2 +Release: 1%{?dist} Summary: A persistent key-value database License: BSD URL: http://redis.io @@ -32,8 +32,8 @@ Source6: %{name}-shutdown Source7: %{name}-limit-systemd Source8: %{name}-limit-init # To refresh patches: -# tar xf redis-xxx.tar.gz && cd redis-xxx && git init && git add . && git commit -m "%{version} baseline" -# git am %{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~ # Update configuration for Fedora @@ -100,6 +100,7 @@ You can use Redis from most programming languages also. %package devel Summary: Development header for Redis module development +BuildArch: noarch # Header-Only Library (https://fedoraproject.org/wiki/Packaging:Guidelines) Provides: %{name}-static = %{version}-%{release} @@ -125,46 +126,27 @@ rm -frv deps/jemalloc %patch0001 -p1 %patch0002 -p1 -# No hidden build. -sed -i -e 's|\t@|\t|g' deps/lua/src/Makefile -sed -i -e 's|$(QUIET_CC)||g' src/Makefile -sed -i -e 's|$(QUIET_LINK)||g' src/Makefile -sed -i -e 's|$(QUIET_INSTALL)||g' src/Makefile # Use system jemalloc library sed -i -e '/cd jemalloc && /d' deps/Makefile sed -i -e 's|../deps/jemalloc/lib/libjemalloc.a|-ljemalloc -ldl|g' src/Makefile sed -i -e 's|-I../deps/jemalloc.*|-DJEMALLOC_NO_DEMANGLE -I/usr/include/jemalloc|g' src/Makefile -# Ensure deps are built with proper flags -sed -i -e 's|$(CFLAGS)|%{optflags} -fPIC|g' deps/Makefile -sed -i -e 's|OPTIMIZATION?=-O3|OPTIMIZATION=%{optflags}|g' deps/hiredis/Makefile -sed -i -e 's|$(LDFLAGS)|%{?__global_ldflags}|g' deps/hiredis/Makefile -sed -i -e 's|$(CFLAGS)|%{optflags} -fPIC|g' deps/linenoise/Makefile -sed -i -e 's|$(LDFLAGS)|%{?__global_ldflags}|g' deps/linenoise/Makefile # Configuration file changes and additions sed -i -e 's|^logfile .*$|logfile /var/log/redis/redis.log|g' redis.conf sed -i -e '$ alogfile /var/log/redis/sentinel.log' sentinel.conf sed -i -e 's|^dir .*$|dir /var/lib/redis|g' redis.conf -%if 0%{?with_systemd} -sed -i -e 's|^supervised .*$|supervised systemd|g' redis.conf -sed -i -e '$ asupervised systemd|g' sentinel.conf + +%if 0%{?with_perftools} +%global malloc_flags MALLOC=tcmalloc +%else +%global malloc_flags MALLOC=jemalloc %endif +%global make_flags DEBUG="" V="echo" LDFLAGS="%{?__global_ldflags}" CFLAGS+="%{optflags} -fPIC" %{malloc_flags} INSTALL="install -p" PREFIX=%{buildroot}%{_prefix} %build -make %{?_smp_mflags} \ - DEBUG="" \ - LDFLAGS="%{?__global_ldflags}" \ - CFLAGS+="%{optflags} -fPIC" \ - LUA_LDFLAGS+="%{?__global_ldflags}" \ -%if 0%{?with_perftools} - MALLOC=tcmalloc \ -%else - MALLOC=jemalloc \ -%endif - INSTALL="install -p" PREFIX=%{buildroot}%{_prefix} \ - all +make %{?_smp_mflags} %{make_flags} all %install -make install INSTALL="install -p" PREFIX=%{buildroot}%{_prefix} +make %{make_flags} install # Filesystem. install -d %{buildroot}%{_sharedstatedir}/%{name} @@ -306,16 +288,16 @@ fi %changelog - -* Wed Sep 06 2017 Nathan Scott - 4.0.1-2 -- Switch to using Type=notify for Redis systemd services (RHBZ #1172841) -- Add Provides:bundled hiredis, linenoise, lua-libs clauses (RHBZ #788500) - -* Mon Aug 14 2017 Nathan Scott - 4.0.1-1 -- Upstream 4.0.1 release. (RHBZ #1389592) +* Wed Sep 27 2017 Nathan Scott - 4.0.2-1 +- Upstream 4.0.2 release. (RHBZ #1389592) - Add redis-devel for loadable module development. - Provide redis-check-aof as a symlink to redis-server also now. +* Tue Sep 26 2017 Nathan Scott - 3.2.11-1 +- Upstream 3.2.11 bug-fix-only release +- Switch to using Type=notify for Redis systemd services (RHBZ #1172841) +- Add Provides:bundled hiredis, linenoise, lua-libs clauses (RHBZ #788500) + * Mon Aug 14 2017 Nathan Scott - 3.2.10-2 - Add redis-trib based on patch from Sebastian Saletnik. (RHBZ #1215654) diff --git a/sources b/sources index 9411699..d11ef3b 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (redis-4.0.1.tar.gz) = 62dec537aebd12340b9642f5f8b07fd98757c9e648dcd539a0411f207db3495923c5a6a9941036c56b2d574ee38b46d08558668111e322345ef549f93fada26f +SHA512 (redis-4.0.2.tar.gz) = 1458909c6fc16cff8ca5e6dddff23b988ee1e447f2d0bccf5941553b22bab6abb851732b3fe53dafb8a69d6c0939c3ce7e0686d51e03be720fb018c038d3b1b4 From 25bfce9ab8b1286aa11455ee65524afde3d4987a Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Wed, 27 Sep 2017 16:02:32 +1000 Subject: [PATCH 3/5] Undo noarch setting for devel package after all Its explicitly forbidden in ... https://fedoraproject.org/wiki/Packaging:Guidelines#Packaging_Header_Only_Libraries --- redis.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/redis.spec b/redis.spec index bb1c2ec..388ec2c 100644 --- a/redis.spec +++ b/redis.spec @@ -100,7 +100,6 @@ You can use Redis from most programming languages also. %package devel Summary: Development header for Redis module development -BuildArch: noarch # Header-Only Library (https://fedoraproject.org/wiki/Packaging:Guidelines) Provides: %{name}-static = %{version}-%{release} From da65cc3c9811c0d537ee54adec4b46117642f47f Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Mon, 2 Oct 2017 11:05:08 +1100 Subject: [PATCH 4/5] Redis v4 modules packaging preparation Add spec file macros to create a default location for Redis modules, and to allow module packages to depend on a specific redis module ABI. A build time test is added to ensure the upstream sources API version does not differ to one the redis package Provides:. The devel package now provides an rpm macros file for the %{redis_modules_abi} and %{redis_modules_dir}. Much of this is ideas from Haikel and Remi - thanks! Small cleanup - the _hardened_build macro is dropped as this has been the default since f22. --- macros.redis | 2 ++ redis.spec | 26 +++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 macros.redis diff --git a/macros.redis b/macros.redis new file mode 100644 index 0000000..439cc2c --- /dev/null +++ b/macros.redis @@ -0,0 +1,2 @@ +%redis_modules_abi 1 +%redis_modules_dir %{_libdir}/redis/modules diff --git a/redis.spec b/redis.spec index 388ec2c..48e7ab1 100644 --- a/redis.spec +++ b/redis.spec @@ -1,4 +1,3 @@ -%global _hardened_build 1 %global with_perftools 0 %if 0%{?fedora} >= 19 || 0%{?rhel} >= 7 @@ -14,7 +13,7 @@ %endif # Tests fail in mock, not in local build. -%global with_tests %{?_with_tests:1}%{!?_with_tests:0} +%global with_tests %{?_with_tests:1}%{!?_with_tests:0} Name: redis Version: 4.0.2 @@ -31,6 +30,7 @@ Source5: %{name}.init Source6: %{name}-shutdown Source7: %{name}-limit-systemd Source8: %{name}-limit-init +Source9: macros.%{name} # To refresh patches: # tar xf redis-xxx.tar.gz && cd redis-xxx && git init && git add . && git commit -m "%%{version} baseline" # git am %%{patches} @@ -73,6 +73,10 @@ Provides: bundled(hiredis) Provides: bundled(lua-libs) Provides: bundled(linenoise) +%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 often referred to as a data structure server since keys can contain strings, hashes, lists, sets and @@ -129,11 +133,20 @@ rm -frv deps/jemalloc sed -i -e '/cd jemalloc && /d' deps/Makefile sed -i -e 's|../deps/jemalloc/lib/libjemalloc.a|-ljemalloc -ldl|g' src/Makefile sed -i -e 's|-I../deps/jemalloc.*|-DJEMALLOC_NO_DEMANGLE -I/usr/include/jemalloc|g' src/Makefile + # Configuration file changes and additions sed -i -e 's|^logfile .*$|logfile /var/log/redis/redis.log|g' redis.conf sed -i -e '$ alogfile /var/log/redis/sentinel.log' sentinel.conf sed -i -e 's|^dir .*$|dir /var/lib/redis|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 + %if 0%{?with_perftools} %global malloc_flags MALLOC=tcmalloc %else @@ -151,6 +164,7 @@ make %{make_flags} install 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} @@ -196,6 +210,10 @@ 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 rpm macros for redis modules +mkdir -p %{buildroot}%{rpmmacrodir} +install -pDm644 %{S:9} %{buildroot}%{rpmmacrodir}/macros.%{name} + %check %if 0%{?with_tests} # https://github.com/antirez/redis/issues/1417 (for "taskset -c 1") @@ -257,7 +275,8 @@ fi %if 0%{?with_redistrib} %exclude %{_bindir}/%{name}-trib %endif -%exclude %{_includedir}/%{name}module.h +%exclude %{buildroot}%{rpmmacrodir} +%exclude %{_includedir} %{_bindir}/%{name}-* %{_libexecdir}/%{name}-* %{_mandir}/man1/%{name}* @@ -278,6 +297,7 @@ fi %files devel %license COPYING %{_includedir}/%{name}module.h +%{rpmmacrodir}/* %if 0%{?with_redistrib} %files trib From 0500a44e921be7dc4bdabba5a0219bdd5c317005 Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Wed, 1 Nov 2017 13:57:39 +1100 Subject: [PATCH 5/5] Addition of a redis-doc subpackage for Redis v4 onward This adds a redis-doc subpackage, containing the upstream docs (https://github.com/antirez/redis-doc/), as well as the existing man page content we've added. Care is taken to handle the movement of man page files between packages and the naming convention of the redis-doc source is also careful to follow the prefered Fedora conventions. Optional conversion of markdown to html is done by pandoc if available. In the future, it would be to modify the redis build to generate the redis src/help.h file using the content from redis-doc now that we have it. It's often out of date, I am noticing - seems to be updated in an ad-hoc fashion in upstream releases. --- .gitignore | 1 + redis.spec | 70 +++++++++++++++++++++++++++++++++++++++++++++++------- sources | 1 + 3 files changed, 63 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index adbbf5b..34c6d8e 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,4 @@ clog /redis-3.2.10.tar.gz /redis-3.2.11.tar.gz /redis-4.0.2.tar.gz +/redis-doc-69a5512.tar.gz diff --git a/redis.spec b/redis.spec index 48e7ab1..cbafbc4 100644 --- a/redis.spec +++ b/redis.spec @@ -6,6 +6,12 @@ %global with_redistrib 0 %endif +%if 0%{?fedora} >= 15 || 0%{?rhel} >= 6 +%global with_pandoc 1 +%else +%global with_pandoc 0 +%endif + %if 0%{?fedora} >= 19 || 0%{?rhel} >= 7 %global with_systemd 1 %else @@ -15,6 +21,11 @@ # Tests fail in mock, not in local build. %global with_tests %{?_with_tests:1}%{!?_with_tests:0} +# Commit IDs for the (unversioned) redis-doc repository +# https://fedoraproject.org/wiki/Packaging:SourceURL "Commit Revision" +%global doc_commit 69a5512ae6a4ec77d7b1d0af6aac2224e8e83f95 +%global short_doc_commit %(c=%{doc_commit}; echo ${c:0:7}) + Name: redis Version: 4.0.2 Release: 1%{?dist} @@ -31,6 +42,8 @@ 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} @@ -48,13 +61,14 @@ BuildRequires: jemalloc-devel %endif %if 0%{?with_tests} BuildRequires: procps-ng +BuildRequires: tcl +%endif +%if 0%{?with_pandoc} +BuildRequires: pandoc %endif %if 0%{?with_systemd} BuildRequires: systemd %endif -%if 0%{?with_tests} -BuildRequires: tcl -%endif # Required for redis-shutdown Requires: /bin/awk Requires: logrotate @@ -108,8 +122,20 @@ Summary: Development header for Redis module development Provides: %{name}-static = %{version}-%{release} %description devel -Header file required for building loadable Redis modules. Detailed API -documentation available at [http://redis-module-redoc.readthedocs.io/] +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. %if 0%{?with_redistrib} %package trib @@ -124,7 +150,9 @@ and removal, status checks, resharding, rebalancing, and other operations. %endif %prep +%setup -q -b 10 %setup -q +mv ../%{name}-doc-%{doc_commit} doc rm -frv deps/jemalloc %patch0001 -p1 %patch0002 -p1 @@ -147,6 +175,13 @@ if test "$api" != "%{redis_modules_abi}"; then exit 1 fi +%if 0%{?with_pandoc} +docs=`find doc -name \*.md | sed -e 's|.md$||g'` +for doc in $docs; do + pandoc --standalone --from markdown --to html --output $doc.html $doc.md +done +%endif + %if 0%{?with_perftools} %global malloc_flags MALLOC=tcmalloc %else @@ -210,6 +245,16 @@ 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 markdown and html pages +doc=$(echo %{buildroot}/%{_docdir}/%{name}) +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 +%if 0%{?with_pandoc} + install -Dpm644 $page.html $doc/$base.html +%endif +done + # Install rpm macros for redis modules mkdir -p %{buildroot}%{rpmmacrodir} install -pDm644 %{S:9} %{buildroot}%{rpmmacrodir}/macros.%{name} @@ -275,12 +320,12 @@ fi %if 0%{?with_redistrib} %exclude %{_bindir}/%{name}-trib %endif -%exclude %{buildroot}%{rpmmacrodir} +%exclude %{rpmmacrodir} %exclude %{_includedir} +%exclude %{_mandir} +%exclude %{_docdir} %{_bindir}/%{name}-* %{_libexecdir}/%{name}-* -%{_mandir}/man1/%{name}* -%{_mandir}/man5/%{name}* %if 0%{?with_systemd} %{_unitdir}/%{name}.service %{_unitdir}/%{name}-sentinel.service @@ -299,6 +344,12 @@ fi %{_includedir}/%{name}module.h %{rpmmacrodir}/* +%files doc +%{_mandir}/man1/%{name}* +%{_mandir}/man5/%{name}* +%docdir %{_docdir}/%{name} +%{_docdir}/%{name}/* + %if 0%{?with_redistrib} %files trib %license COPYING @@ -307,9 +358,10 @@ fi %changelog -* Wed Sep 27 2017 Nathan Scott - 4.0.2-1 +* Tue Oct 31 2017 Nathan Scott - 4.0.2-1 - Upstream 4.0.2 release. (RHBZ #1389592) - Add redis-devel for loadable module development. +- Add redis-doc for man pages and detailed documentation. - Provide redis-check-aof as a symlink to redis-server also now. * Tue Sep 26 2017 Nathan Scott - 3.2.11-1 diff --git a/sources b/sources index d11ef3b..af20ea9 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ SHA512 (redis-4.0.2.tar.gz) = 1458909c6fc16cff8ca5e6dddff23b988ee1e447f2d0bccf5941553b22bab6abb851732b3fe53dafb8a69d6c0939c3ce7e0686d51e03be720fb018c038d3b1b4 +SHA512 (redis-doc-69a5512.tar.gz) = 0b5a8f48dbddafcc0322f7740180d760ad470bbfb2e1653195f4cb7af786795bf40bd43f39691a2905929addb8a4efa498963d70974a0f0b9ea6e84ccf039760