Refactor some patches out of redis.spec

For cases where we have two ways of doing one thing (using
a patch or sed-based modification of files), rework these
such that we're only using one method.  Allows several of
the patches to be dropped.

Described in https://github.com/antirez/redis/issues/1417
is a method for allowing integration/replication-psync to
be reliably run - start using it, and drop the patch that
was disabling that test.

Other small side-effects of this commit:
- the build warning about "jemalloc not found" is fixed;
- CFLAGS additions are now consistently handled (for deps
  as well) - using the upstream-provided mechanism for
  compiler flag propogation.
This commit is contained in:
Nathan Scott 2017-08-28 20:07:21 +10:00
parent dc361d6b75
commit 9f0877ed49
8 changed files with 18 additions and 186 deletions

View File

@ -1,34 +0,0 @@
From cbd4460b0c1a8614644171904e3522ffbe001b48 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ha=C3=AFkel=20Gu=C3=A9mar?= <hguemar@fedoraproject.org>
Date: Fri, 5 Dec 2014 14:11:15 +0100
Subject: [PATCH 1/7] redis 3.2.3: redis conf
---
redis.conf | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/redis.conf b/redis.conf
index 22e00bc..2bcddb8 100644
--- a/redis.conf
+++ b/redis.conf
@@ -160,7 +160,7 @@ loglevel notice
# Specify the log file name. Also the empty string can be used to force
# Redis to log on the standard output. Note that if you use standard
# output for logging but daemonize, logs will be sent to /dev/null
-logfile ""
+logfile /var/log/redis/redis.log
# To enable logging to the system logger, just set 'syslog-enabled' to yes,
# and optionally update the other syslog parameters to suit your needs.
@@ -244,7 +244,7 @@ dbfilename dump.rdb
# The Append Only File will also be created inside this directory.
#
# Note that you must specify a directory here, not a file name.
-dir ./
+dir /var/lib/redis
################################# REPLICATION #################################
--
2.9.3

View File

@ -1,53 +0,0 @@
From efdb3b41171d335511af511b0a0cdf43cde2144a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ha=C3=AFkel=20Gu=C3=A9mar?= <hguemar@fedoraproject.org>
Date: Mon, 8 Dec 2014 10:02:54 +0100
Subject: [PATCH 2/7] redis 3.2.3: deps library fPIC performance tuning
---
deps/Makefile | 2 +-
deps/geohash-int/Makefile | 2 +-
deps/linenoise/Makefile | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/deps/Makefile b/deps/Makefile
index 1c10bce..14839de 100644
--- a/deps/Makefile
+++ b/deps/Makefile
@@ -59,7 +59,7 @@ ifeq ($(uname_S),SunOS)
LUA_CFLAGS= -D__C99FEATURES__=1
endif
-LUA_CFLAGS+= -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' $(CFLAGS)
+LUA_CFLAGS+= -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' $(CFLAGS) -fPIC
LUA_LDFLAGS+= $(LDFLAGS)
# lua's Makefile defines AR="ar rcu", which is unusual, and makes it more
# challenging to cross-compile lua (and redis). These defines make it easier
diff --git a/deps/geohash-int/Makefile b/deps/geohash-int/Makefile
index b7c2595..d8b5b40 100644
--- a/deps/geohash-int/Makefile
+++ b/deps/geohash-int/Makefile
@@ -2,7 +2,7 @@ STD=
WARN= -Wall
OPT= -O2
-R_CFLAGS= $(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS)
+R_CFLAGS= $(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS) -fPIC
R_LDFLAGS= $(LDFLAGS)
DEBUG= -g
diff --git a/deps/linenoise/Makefile b/deps/linenoise/Makefile
index 1dd894b..712f2a6 100644
--- a/deps/linenoise/Makefile
+++ b/deps/linenoise/Makefile
@@ -2,7 +2,7 @@ STD=
WARN= -Wall
OPT= -Os
-R_CFLAGS= $(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS)
+R_CFLAGS= $(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS) -fPIC
R_LDFLAGS= $(LDFLAGS)
DEBUG= -g
--
2.9.3

View File

@ -1,27 +0,0 @@
From 028b374759921656cb8a1e46198c8abbb62a4f0d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ha=C3=AFkel=20Gu=C3=A9mar?= <hguemar@fedoraproject.org>
Date: Mon, 8 Dec 2014 10:03:40 +0100
Subject: [PATCH 3/7] redis 2.8.18: use system jemalloc
---
src/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Makefile b/src/Makefile
index fdbe36a..6c27dd9 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -104,8 +104,8 @@ endif
ifeq ($(MALLOC),jemalloc)
DEPENDENCY_TARGETS+= jemalloc
- FINAL_CFLAGS+= -DUSE_JEMALLOC -I../deps/jemalloc/include
- FINAL_LIBS+= ../deps/jemalloc/lib/libjemalloc.a
+ FINAL_CFLAGS+= -DUSE_JEMALLOC -DJEMALLOC_NO_DEMANGLE -I/usr/include/jemalloc
+ FINAL_LIBS+= -ljemalloc -ldl
endif
REDIS_CC=$(QUIET_CC)$(CC) $(FINAL_CFLAGS)
--
2.9.3

View File

@ -1,24 +0,0 @@
From a39e81c428eac6745a1aa7d87ca64d78e335b2c3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ha=C3=AFkel=20Gu=C3=A9mar?= <hguemar@fedoraproject.org>
Date: Mon, 8 Dec 2014 10:04:18 +0100
Subject: [PATCH 4/7] redis 2.8.18: disable test failed on slow machine
---
tests/test_helper.tcl | 1 -
1 file changed, 1 deletion(-)
diff --git a/tests/test_helper.tcl b/tests/test_helper.tcl
index 9a6e673..0891619 100644
--- a/tests/test_helper.tcl
+++ b/tests/test_helper.tcl
@@ -36,7 +36,6 @@ set ::all_tests {
integration/replication-2
integration/replication-3
integration/replication-4
- integration/replication-psync
integration/aof
integration/rdb
integration/convert-zipmap-hash-on-load
--
2.9.3

View File

@ -1,29 +0,0 @@
From 8aa7a039b6b23f7e9fdb9a459e975f216dd8fdba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ha=C3=AFkel=20Gu=C3=A9mar?= <hguemar@fedoraproject.org>
Date: Sat, 13 Sep 2014 14:03:04 +0200
Subject: [PATCH 5/7] redis 2.8.18: sentinel configuration file fix
---
sentinel.conf | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/sentinel.conf b/sentinel.conf
index 0e1b266..428e7b6 100644
--- a/sentinel.conf
+++ b/sentinel.conf
@@ -130,6 +130,12 @@ sentinel parallel-syncs mymaster 1
# Default is 3 minutes.
sentinel failover-timeout mymaster 180000
+#
+# Specify the log file name. Also the empty string can be used to force
+# Redis to log on the standard output. Note that if you use standard
+# output for logging but daemonize, logs will be sent to /dev/null
+logfile /var/log/redis/sentinel.log
+
# SCRIPTS EXECUTION
#
# sentinel notification-script and sentinel reconfig-script are used in order
--
2.9.3

View File

@ -18,7 +18,7 @@
Name: redis
Version: 3.2.10
Release: 2%{?dist}
Release: 3%{?dist}
Summary: A persistent key-value database
License: BSD
URL: http://redis.io
@ -37,17 +37,10 @@ Source8: %{name}-limit-init
# Then refresh your patches
# git format-patch HEAD~<number of expected patches>
# Update configuration for Fedora
Patch0001: 0001-redis-3.2.3-redis-conf.patch
Patch0002: 0002-redis-3.2.3-deps-library-fPIC-performance-tuning.patch
Patch0003: 0003-redis-2.8.18-use-system-jemalloc.patch
# tests/integration/replication-psync.tcl failed on slow machines(GITHUB #1417)
Patch0004: 0004-redis-2.8.18-disable-test-failed-on-slow-machine.patch
# Fix sentinel configuration to use a different log file than redis
Patch0005: 0005-redis-2.8.18-sentinel-configuration-file-fix.patch
# https://github.com/antirez/redis/pull/3491 - man pages
Patch0006: 0006-1st-man-pageis-for-redis-cli-redis-benchmark-redis-c.patch
Patch0001: 0001-1st-man-pageis-for-redis-cli-redis-benchmark-redis-c.patch
# https://github.com/antirez/redis/pull/3494 - symlink
Patch0007: 0007-install-redis-check-rdb-as-a-symlink-instead-of-dupl.patch
Patch0002: 0002-install-redis-check-rdb-as-a-symlink-instead-of-dupl.patch
%if 0%{?with_perftools}
BuildRequires: gperftools-devel
%else
@ -119,24 +112,26 @@ and removal, status checks, resharding, rebalancing, and other operations.
rm -frv deps/jemalloc
%patch0001 -p1
%patch0002 -p1
%patch0003 -p1
%patch0004 -p1
%patch0005 -p1
%patch0006 -p1
%patch0007 -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}|g' deps/Makefile
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}|g' deps/linenoise/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
@ -146,7 +141,7 @@ sed -i -e '$ asupervised systemd|g' sentinel.conf
make %{?_smp_mflags} \
DEBUG="" \
LDFLAGS="%{?__global_ldflags}" \
CFLAGS+="%{optflags}" \
CFLAGS+="%{optflags} -fPIC" \
LUA_LDFLAGS+="%{?__global_ldflags}" \
%if 0%{?with_perftools}
MALLOC=tcmalloc \
@ -206,7 +201,8 @@ ln -s redis.conf.5 %{buildroot}%{_mandir}/man5/redis-sentinel.conf.5
%check
%if 0%{?with_tests}
make test ||:
# https://github.com/antirez/redis/issues/1417 (for "taskset -c 1")
taskset -c 1 make test ||:
make test-sentinel ||:
%endif
@ -289,6 +285,9 @@ fi
%changelog
* Mon Aug 28 2017 Nathan Scott <nathans@redhat.com> - 3.2.10-3
- Switch to using Type=notify for Redis systemd services (RHBZ #1172841)
* Mon Aug 14 2017 Nathan Scott <nathans@redhat.com> - 3.2.10-2
- Add redis-trib based on patch from Sebastian Saletnik. (RHBZ #1215654)