From 0500a44e921be7dc4bdabba5a0219bdd5c317005 Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Wed, 1 Nov 2017 13:57:39 +1100 Subject: [PATCH] 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