From 84cd75cd26ca8e39333659e9ed00280a8a2c00d5 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 24 Sep 2024 15:14:31 +0200 Subject: update to 6.1.0RC2 fix test suite with redis 6.2 using patch from https://github.com/phpredis/phpredis/pull/2555 --- php-pecl-redis6.spec | 39 ++++++++++++----- redis-tests.patch | 31 ++++++++++++++ redis-upstream.patch | 116 --------------------------------------------------- 3 files changed, 60 insertions(+), 126 deletions(-) create mode 100644 redis-tests.patch delete mode 100644 redis-upstream.patch diff --git a/php-pecl-redis6.spec b/php-pecl-redis6.spec index 0fabe47..49df56f 100644 --- a/php-pecl-redis6.spec +++ b/php-pecl-redis6.spec @@ -10,9 +10,14 @@ # Please, preserve the changelog entries # +# For EL-9 +%{!?__phpize: %global __phpize %{_bindir}/phpize} +%{!?__phpconfig: %global __phpconfig %{_bindir}/php-config} + %bcond_without tests -%bcond_without igbinary -%bcond_without msgpack +%bcond_with igbinary +%bcond_with msgpack +%bcond_with liblzf %if 0%{?fedora} >= 41 || 0%{?rhel} >= 10 %bcond_without valkey %else @@ -23,25 +28,25 @@ # after 20-json, 40-igbinary and 40-msgpack %global ini_name 50-%{pecl_name}.ini -%global upstream_version 6.0.2 -#global upstream_prever RC2 +%global upstream_version 6.1.0 +%global upstream_prever RC2 %global sources %{pecl_name}-%{upstream_version}%{?upstream_prever} Summary: Extension for communicating with the Redis key-value store Name: php-pecl-redis6 Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}} -Release: 3%{?dist} +Release: 1%{?dist} License: PHP-3.01 URL: https://pecl.php.net/package/redis Source0: https://pecl.php.net/get/%{sources}.tgz -Patch0: %{pecl_name}-upstream.patch +Patch0: %{pecl_name}-tests.patch ExcludeArch: %{ix86} BuildRequires: make BuildRequires: gcc -BuildRequires: php-devel >= 7.2 +BuildRequires: php-devel >= 7.4 BuildRequires: php-pear BuildRequires: php-json %if %{with igbinary} @@ -50,15 +55,17 @@ BuildRequires: php-pecl-igbinary-devel %if %{with msgpack} BuildRequires: php-pecl-msgpack-devel >= 2.0.3 %endif +%if %{with liblzf} BuildRequires: pkgconfig(liblzf) +%endif BuildRequires: pkgconfig(libzstd) >= 1.3.0 BuildRequires: pkgconfig(liblz4) # to run Test suite %if %{with tests} %if %{with valkey} -BuildRequires: valkey >= 7 +BuildRequires: valkey %else -BuildRequires: redis >= 7 +BuildRequires: redis %endif %endif @@ -100,7 +107,7 @@ The phpredis extension provides an API for communicating with the Redis key-value store. This Redis client implements most of the latest Redis API. -As method only only works when also implemented on the server side, +As method only works when also implemented on the server side, some doesn't work with an old redis server version. @@ -175,6 +182,9 @@ extension = %{pecl_name}.so ;redis.session.lock_retries = 100 ;redis.session.lock_wait_time = 20000 ;redis.session.early_refresh = 0 +;redis.session.compression = none +;redis.session.compression_level = 3 + EOF @@ -189,8 +199,12 @@ peclconf() { %if %{with msgpack} --enable-redis-msgpack \ %endif +%if %{with liblzf} --enable-redis-lzf \ --with-liblzf \ +%else + --disable-redis-lzf \ +%endif --enable-redis-zstd \ --with-libzstd \ --enable-redis-lz4 \ @@ -288,6 +302,11 @@ exit $ret %changelog +* Tue Sep 24 2024 Remi Collet - 6.1.0~RC2-1 +- update to 6.1.0RC2 +- fix test suite with redis 6.2 using patch from + https://github.com/phpredis/phpredis/pull/2555 + * Mon Sep 16 2024 Remi Collet - 6.0.2-3 - cleanup and modernize spec file diff --git a/redis-tests.patch b/redis-tests.patch new file mode 100644 index 0000000..488ba09 --- /dev/null +++ b/redis-tests.patch @@ -0,0 +1,31 @@ +From cc1be32294a0b134e60be1476775e8d37dbf3f6a Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Tue, 24 Sep 2024 14:47:04 +0200 +Subject: [PATCH] fix 2 tests with redis 6.2 + +--- + tests/RedisTest.php | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/RedisTest.php b/tests/RedisTest.php +index 6bf0655939..a33a062f0f 100644 +--- a/tests/RedisTest.php ++++ b/tests/RedisTest.php +@@ -245,7 +245,7 @@ public function testBitcount() { + $this->redis->set('bitcountkey', hex2bin('10eb8939e68bfdb640260f0629f3')); + $this->assertEquals(1, $this->redis->bitcount('bitcountkey', 8, 8, false)); + +- if ( ! $this->is_keydb) { ++ if ( ! $this->is_keydb && $this->minVersionCheck('7.0')) { + /* key, start, end, BIT */ + $this->redis->set('bitcountkey', hex2bin('cd0e4c80f9e4590d888a10')); + $this->assertEquals(5, $this->redis->bitcount('bitcountkey', 0, 9, true)); +@@ -7625,7 +7625,7 @@ public function testCommand() { + $this->assertIsArray($commands); + $this->assertEquals(count($commands), $this->redis->command('count')); + +- if ( ! $this->is_keydb) { ++ if ( ! $this->is_keydb && $this->minVersionCheck('7.0')) { + $infos = $this->redis->command('info'); + $this->assertIsArray($infos); + $this->assertEquals(count($infos), count($commands)); diff --git a/redis-upstream.patch b/redis-upstream.patch deleted file mode 100644 index 03bd34f..0000000 --- a/redis-upstream.patch +++ /dev/null @@ -1,116 +0,0 @@ -From a51215ce2b22bcd1f506780c35b6833471e0b8cb Mon Sep 17 00:00:00 2001 -From: michael-grunder -Date: Mon, 18 Mar 2024 14:42:35 -0700 -Subject: [PATCH] Update random includes. - -PHP 8.4 has some breaking changes with respect to where PHP's random methods and -helpers are. This commit fixes those issues while staying backward compatible. - -Fixes #2463 ---- - backoff.c | 12 ++++++------ - library.c | 7 ++++++- - redis.c | 6 +++++- - 3 files changed, 17 insertions(+), 8 deletions(-) - -diff --git a/backoff.c b/backoff.c -index d0961fcfaf..1be04a8fe8 100644 ---- a/backoff.c -+++ b/backoff.c -@@ -1,14 +1,14 @@ - #include "common.h" - -+#if PHP_VERSION_ID < 80400 - #include -- --#if PHP_VERSION_ID >= 70100 --#include - #else -+#include -+#endif -+ -+#if PHP_VERSION_ID < 70100 - static zend_long php_mt_rand_range(zend_long min, zend_long max) { -- zend_long number = php_rand(); -- RAND_RANGE(number, min, max, PHP_RAND_MAX); -- return number; -+ return min + php_rand() % (max - min + 1) - } - #endif - -diff --git a/library.c b/library.c -index 3d65c8529d..f81556a9ed 100644 ---- a/library.c -+++ b/library.c -@@ -56,9 +56,14 @@ - #include - #endif - --#include - #include - -+#if PHP_VERSION_ID < 80400 -+#include -+#else -+#include -+#endif -+ - #define UNSERIALIZE_NONE 0 - #define UNSERIALIZE_KEYS 1 - #define UNSERIALIZE_VALS 2 -diff --git a/redis.c b/redis.c -index ec6f65d2ed..2330bf7edf 100644 ---- a/redis.c -+++ b/redis.c -@@ -27,12 +27,16 @@ - #include "redis_cluster.h" - #include "redis_commands.h" - #include "redis_sentinel.h" --#include - #include - #include - #include - #include - -+#if PHP_VERSION_ID < 80400 -+#include -+#else -+#include -+#endif - - #ifdef PHP_SESSION - #include -From c139de3abac1dd33b97ef0de5af41b6e3a78f7ab Mon Sep 17 00:00:00 2001 -From: michael-grunder -Date: Sat, 1 Jun 2024 13:09:30 -0700 -Subject: [PATCH] We don't need to use a ranom value for our ECHO liveness - challenge. - -A microsecond resolution timestamp combined with a monotonically -incremented counter should be sufficient. - -This also fixes PHP 8.4 compilation as PHP 8.4 doesn't seem to have -`php_rand()`. ---- - library.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/library.c b/library.c -index ce0cbda26..42a132c4c 100644 ---- a/library.c -+++ b/library.c -@@ -2886,11 +2886,13 @@ redis_sock_create(char *host, int host_len, int port, - } - - static int redis_uniqid(char *buf, size_t buflen) { -+ static unsigned long counter = 0; - struct timeval tv; -+ - gettimeofday(&tv, NULL); - - return snprintf(buf, buflen, "phpredis:%08lx%05lx:%08lx", -- (long)tv.tv_sec, (long)tv.tv_usec, (long)php_rand()); -+ (long)tv.tv_sec, (long)tv.tv_usec, counter++); - } - - static int redis_stream_liveness_check(php_stream *stream) { -- cgit