diff options
-rw-r--r-- | php-pecl-redis6.spec | 118 | ||||
-rw-r--r-- | redis-tests.patch | 31 |
2 files changed, 100 insertions, 49 deletions
diff --git a/php-pecl-redis6.spec b/php-pecl-redis6.spec index 255e41e..49df56f 100644 --- a/php-pecl-redis6.spec +++ b/php-pecl-redis6.spec @@ -3,26 +3,34 @@ # # remirepo spec file for php-pecl-redis6 # -# Copyright (c) 2012-2023 Remi Collet +# Copyright (c) 2012-2024 Remi Collet # License: CC-BY-SA-4.0 # http://creativecommons.org/licenses/by-sa/4.0/ # # 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 +%bcond_with valkey +%endif %global pecl_name redis -%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} # 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} -%global _configure ../%{sources}/configure Summary: Extension for communicating with the Redis key-value store Name: php-pecl-redis6 @@ -32,9 +40,13 @@ License: PHP-3.01 URL: https://pecl.php.net/package/redis Source0: https://pecl.php.net/get/%{sources}.tgz +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} @@ -43,12 +55,18 @@ 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} -BuildRequires: redis >= 7 +%if %{with valkey} +BuildRequires: valkey +%else +BuildRequires: redis +%endif %endif Requires: php(zend-abi) = %{php_zend_api} @@ -66,7 +84,7 @@ Provides: php-%{pecl_name}%{?_isa} = %{version} Provides: php-pecl(%{pecl_name}) = %{version} Provides: php-pecl(%{pecl_name})%{?_isa} = %{version} -%if 0%{?fedora} >= 40 || 0%{?rhel} >= 10 || "%{php_version}" > "8.3" +%if 0%{?fedora} >= 42 || 0%{?rhel} >= 10 || "%{php_version}" > "8.4" Obsoletes: php-pecl-%{pecl_name} < 6 Provides: php-pecl-%{pecl_name} = %{version}-%{release} Provides: php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release} @@ -89,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. @@ -103,6 +121,8 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml cd %{sources} +%patch -P0 -p1 + # Use system library rm -r liblzf @@ -114,11 +134,6 @@ if test "x${extver}" != "x%{upstream_version}%{?upstream_prever}"; then fi cd .. -mkdir NTS -%if %{with_zts} -mkdir ZTS -%endif - # Drop in the bit of configuration cat > %{ini_name} << 'EOF' ; Enable %{pecl_name} extension module @@ -167,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 @@ -181,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 \ @@ -192,34 +214,23 @@ peclconf() { cd %{sources} %{__phpize} +sed -e 's/INSTALL_ROOT/DESTDIR/' -i build/Makefile.global -cd ../NTS peclconf %{__phpconfig} -make %{?_smp_mflags} - -%if %{with_zts} -cd ../ZTS -peclconf %{__ztsphpconfig} -make %{?_smp_mflags} -%endif +%make_build %install -# Install the NTS stuff -make -C NTS install INSTALL_ROOT=%{buildroot} +# Install the configuration file install -D -m 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name} -%if %{with_zts} -# Install the ZTS stuff -make -C ZTS install INSTALL_ROOT=%{buildroot} -install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} -%endif - # Install the package XML file install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml -# Documentation cd %{sources} +%make_install + +# Documentation for i in $(grep 'role="doc"' ../package.xml | sed -e 's/^.*name="//;s/".*$//') do install -Dpm 644 $i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i done @@ -236,24 +247,26 @@ done --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ --modules | grep '^%{pecl_name}$' -%if %{with_zts} -%{__ztsphp} $DEPS \ - --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ - --modules | grep '^%{pecl_name}$' -%endif - %if %{with tests} cd %{sources}/tests : Launch redis server +%if %{with valkey} +SRV=%{_bindir}/valkey-server +CLI=%{_bindir}/valkey-cli +%else +SRV=%{_bindir}/redis-server +CLI=%{_bindir}/redis-cli +%endif + mkdir -p data -pidfile=$PWD/redis.pid +pidfile=$PWD/server.pid port=$(%{__php} -r 'echo 9000 + PHP_MAJOR_VERSION*100 + PHP_MINOR_VERSION*10 + PHP_INT_SIZE;') -%{_bindir}/redis-server \ +$SRV \ --bind 127.0.0.1 \ --port $port \ --daemonize yes \ - --logfile $PWD/redis.log \ + --logfile $PWD/server.log \ --dir $PWD/data \ --pidfile $pidfile @@ -269,10 +282,10 @@ $TEST_PHP_EXECUTABLE $TEST_PHP_ARGS TestRedis.php || ret=1 : Cleanup if [ -f $pidfile ]; then - %{_bindir}/redis-cli -p $port shutdown nosave + $CLI -p $port shutdown nosave sleep 2 fi -cat $PWD/redis.log +cat $PWD/server.log exit $ret %else @@ -287,13 +300,20 @@ exit $ret %{php_extdir}/%{pecl_name}.so %config(noreplace) %{php_inidir}/%{ini_name} -%if %{with_zts} -%{php_ztsextdir}/%{pecl_name}.so -%config(noreplace) %{php_ztsinidir}/%{ini_name} -%endif - %changelog +* Tue Sep 24 2024 Remi Collet <remi@remirepo.net> - 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 <remi@remirepo.net> - 6.0.2-3 +- cleanup and modernize spec file + +* Thu Jul 11 2024 Remi Collet <remi@remirepo.net> - 6.0.2-2 +- use valkey on Fedora 41 +- add upstream patch for PHP 8.4 + * Mon Oct 23 2023 Remi Collet <remi@remirepo.net> - 6.0.2-1 - update to 6.0.2 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 <remi@remirepo.net> +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)); |