summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2017-02-09 07:47:33 +0100
committerRemi Collet <fedora@famillecollet.com>2017-02-09 07:47:33 +0100
commitc52f0a87b5c5ad2d581c201bcb9af100c8c3d49c (patch)
tree3b0ed05a1fb5d1f5aa3cb930bc6e7c46d945fcbd
parent88edf72b92fa74b779624fff946626407dec55ab (diff)
php-pecl-memcached: rebuild drom pecl sources + enable tests suite
-rw-r--r--memcached-pr3.patch42
-rw-r--r--memcached-pr319.patch79
-rw-r--r--php-pecl-memcached-php7.spec (renamed from php-pecl-memcached-dev.spec)72
3 files changed, 103 insertions, 90 deletions
diff --git a/memcached-pr3.patch b/memcached-pr3.patch
deleted file mode 100644
index 5e0e194..0000000
--- a/memcached-pr3.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From 5c49c02dfd0b12f46ba2909aaec31938c6e96728 Mon Sep 17 00:00:00 2001
-From: Remi Collet <fedora@famillecollet.com>
-Date: Wed, 2 Mar 2016 11:37:50 +0100
-Subject: [PATCH] Fix build with igbinary
-
-Using https://github.com/igbinary/igbinary7
----
- php_memcached.c | 10 ++++++++--
- 1 file changed, 8 insertions(+), 2 deletions(-)
-
-diff --git a/php_memcached.c b/php_memcached.c
-index 9195bfc..09df000 100644
---- a/php_memcached.c
-+++ b/php_memcached.c
-@@ -3088,11 +3088,17 @@ zend_bool s_serialize_value (enum memcached_serializer serializer, zval *value,
- */
- #ifdef HAVE_MEMCACHED_IGBINARY
- case SERIALIZER_IGBINARY:
-- if (igbinary_serialize((uint8_t **) &buf->c, &buf->len, value) != 0) {
-+ {
-+ char *s;
-+ size_t l;
-+ if (igbinary_serialize((uint8_t **) &s, &l, value) != 0) {
- php_error_docref(NULL, E_WARNING, "could not serialize value with igbinary");
- return 0;
- }
-+ smart_str_setl(buf, s, l);
-+ efree(s);
- MEMC_VAL_SET_TYPE(*flags, MEMC_VAL_IS_IGBINARY);
-+ }
- break;
- #endif
-
-@@ -3306,7 +3312,7 @@ zend_bool s_unserialize_value (enum memcached_serializer serializer, int val_typ
-
- case MEMC_VAL_IS_IGBINARY:
- #ifdef HAVE_MEMCACHED_IGBINARY
-- if (igbinary_unserialize((uint8_t *)payload, payload_len, &value)) {
-+ if (igbinary_unserialize((const uint8_t *)payload, payload_len, value)) {
- ZVAL_FALSE(value);
- php_error_docref(NULL, E_WARNING, "could not unserialize value with igbinary");
- return 0;
diff --git a/memcached-pr319.patch b/memcached-pr319.patch
new file mode 100644
index 0000000..6c6ec15
--- /dev/null
+++ b/memcached-pr319.patch
@@ -0,0 +1,79 @@
+From f8fd6228e34e1b49947890b060a501a6eab6978c Mon Sep 17 00:00:00 2001
+From: Remi Collet <fedora@famillecollet.com>
+Date: Thu, 9 Feb 2017 07:24:15 +0100
+Subject: [PATCH] ensure tests are ok for 32bits build
+
+---
+ tests/gh_90.phpt | 4 ++--
+ tests/incrdecr.phpt | 6 +++---
+ tests/incrdecr_bykey.phpt | 6 +++---
+ 3 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/tests/gh_90.phpt b/tests/gh_90.phpt
+index 733b761..2a16f60 100644
+--- a/tests/gh_90.phpt
++++ b/tests/gh_90.phpt
+@@ -12,7 +12,7 @@ $memcached = memc_get_instance (array (
+ // Create a key for use as a lock. If this key already exists, wait till it doesn't exist.
+ {
+ $key = 'LockKey';
+- $lockToken = mt_rand(0, pow(2, 32)); //Random value betwen 0 and 2^32 for ownership verification
++ $lockToken = mt_rand(0, mt_getrandmax()); //Random value for ownership verification
+
+ while (true)
+ {
+@@ -88,4 +88,4 @@ array(10) {
+ int(1)
+ ["9_%s"]=>
+ int(1)
+-}
+\ No newline at end of file
++}
+diff --git a/tests/incrdecr.phpt b/tests/incrdecr.phpt
+index cb3914a..b4e9469 100644
+--- a/tests/incrdecr.phpt
++++ b/tests/incrdecr.phpt
+@@ -42,10 +42,10 @@ echo $php_errormsg, "\n";
+ var_dump($m->get('foo'));
+
+ echo "Enormous offset\n";
+-$m->increment('foo', 4294967296);
++$m->increment('foo', 0x7f000000);
+ var_dump($m->get('foo'));
+
+-$m->decrement('foo', 4294967296);
++$m->decrement('foo', 0x7f000000);
+ var_dump($m->get('foo'));
+
+ --EXPECT--
+@@ -68,5 +68,5 @@ int(1)
+ Memcached::decrement(): offset cannot be a negative value
+ int(1)
+ Enormous offset
+-int(4294967297)
++int(2130706433)
+ int(1)
+diff --git a/tests/incrdecr_bykey.phpt b/tests/incrdecr_bykey.phpt
+index 809f3b8..8b931fa 100644
+--- a/tests/incrdecr_bykey.phpt
++++ b/tests/incrdecr_bykey.phpt
+@@ -39,10 +39,10 @@ echo $php_errormsg, "\n";
+ var_dump($m->get('foo'));
+
+ echo "Enormous offset\n";
+-$m->incrementByKey('foo', 'foo', 4294967296);
++$m->incrementByKey('foo', 'foo', 0x7f000000);
+ var_dump($m->get('foo'));
+
+-$m->decrementByKey('foo', 'foo', 4294967296);
++$m->decrementByKey('foo', 'foo', 0x7f000000);
+ var_dump($m->get('foo'));
+
+ --EXPECT--
+@@ -62,5 +62,5 @@ int(1)
+ Memcached::decrementByKey(): offset cannot be a negative value
+ int(1)
+ Enormous offset
+-int(4294967297)
++int(2130706433)
+ int(1)
diff --git a/php-pecl-memcached-dev.spec b/php-pecl-memcached-php7.spec
index 9ecf946..8027ef8 100644
--- a/php-pecl-memcached-dev.spec
+++ b/php-pecl-memcached-php7.spec
@@ -19,33 +19,23 @@
%global with_fastlz 1
%global with_igbin 1
%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}}
-%global with_tests %{?_with_tests:1}%{!?_with_tests:0}
+%global with_tests 0%{!?_without_tests:1}
%global pecl_name memcached
-# https://github.com/php-memcached-dev/php-memcached/commits/php7
-%global gh_commit 71f20e19253f27d6deaeab200007bd4cf9d8aec4
-%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
-#global gh_date 20161207
-%global gh_owner php-memcached-dev
-%global gh_project php-memcached
-#global prever RC1
-#global intver rc1
-%if "%{php_version}" < "5.6"
-# After igbinary, json, msgpack
-%global ini_name z-%{pecl_name}.ini
-%else
# After 40-igbinary, 40-json, 40-msgpack
-%global ini_name 50-%{pecl_name}.ini
-%endif
+%global ini_name 50-%{pecl_name}.ini
Summary: Extension to work with the Memcached caching daemon
Name: %{?sub_prefix}php-pecl-memcached
Version: 3.0.1
-Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
License: PHP
Group: Development/Languages
URL: http://pecl.php.net/package/%{pecl_name}
-Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}%{?prever}-%{gh_short}.tar.gz
+Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz
+
+# https://github.com/php-memcached-dev/php-memcached/pull/319
+Patch0: %{pecl_name}-pr319.patch
BuildRequires: %{?scl_prefix}php-devel >= 7
BuildRequires: %{?scl_prefix}php-pear
@@ -65,27 +55,9 @@ BuildRequires: fastlz-devel
BuildRequires: memcached
%endif
-%if 0%{?scl:1} && 0%{?fedora} < 15 && 0%{?rhel} < 7 && "%{?scl_vendor}" != "remi"
-# Filter in the SCL collection
-%{?filter_requires_in: %filter_requires_in %{_libdir}/.*\.so}
-# libvent from SCL as not available in system
-BuildRequires: %{?sub_prefix}libevent-devel > 2
-Requires: %{?sub_prefix}libevent%{_isa} > 2
-BuildRequires: %{?sub_prefix}libmemcached-devel > 1
-Requires: %{?sub_prefix}libmemcached-libs%{_isa} > 1
-%if %{with_fastlz}
-Requires: fastlz%{_isa}
-%endif
-Requires: cyrus-sasl-lib%{_isa}
-%else
BuildRequires: libevent-devel >= 2.0.2
-%if 0%{?rhel} == 5
-BuildRequires: libmemcached-devel > 1
-%else
# To ensure use of libmemcached-last for --enable-memcached-protocol
BuildRequires: libmemcached-devel >= 1.0.16
-%endif
-%endif
Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api}
Requires: %{?scl_prefix}php(api) = %{php_core_api}
@@ -153,16 +125,7 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO
%prep
%setup -c -q
-mv %{gh_project}-%{gh_commit} NTS
-%{__php} -r '
- $pkg = simplexml_load_file("NTS/package.xml");
-%if 0%{?gh_date:1}
- $pkg->date = substr("%{gh_date}",0,4)."-".substr("%{gh_date}",4,2)."-".substr("%{gh_date}",6,2);
- $pkg->version->release = "%{version}dev";
- $pkg->stability->release = "devel";
-%endif
- $pkg->asXML("package.xml");
-'
+mv %{pecl_name}-%{version} NTS
# Don't install/register tests
sed -e 's/role="test"/role="src"/' \
@@ -170,6 +133,8 @@ sed -e 's/role="test"/role="src"/' \
-i package.xml
cd NTS
+%patch0 -p1 -b .pr319
+
%if %{with_fastlz}
rm -r fastlz
sed -e '/name=.fastlz/d' -i ../package.xml
@@ -316,10 +281,15 @@ OPT="-n"
%endif
%if %{with_tests}
+# XFAIL and very slow so no value
+rm ?TS/tests/expire.phpt
+
ret=0
: Launch the Memcached service
-memcached -p 11211 -U 11211 -d -P $PWD/memcached.pid
+port=$(%{__php} -r 'echo 10000 + PHP_MAJOR_VERSION*100 + PHP_MINOR_VERSION*10 + PHP_INT_SIZE;')
+memcached -p $port -U $port -d -P $PWD/memcached.pid
+sed -e "s/11211/$port/" -i ?TS/tests/*
: Run the upstream test Suite for NTS extension
pushd NTS
@@ -328,7 +298,7 @@ TEST_PHP_EXECUTABLE=%{__php} \
TEST_PHP_ARGS="$OPT -d extension=$PWD/modules/%{pecl_name}.so" \
NO_INTERACTION=1 \
REPORT_EXIT_STATUS=1 \
-%{__php} -n run-tests.php --show-diff tests/*phpt || ret=1
+%{__php} -n run-tests.php --show-diff || ret=1
popd
%if %{with_zts}
@@ -339,7 +309,7 @@ TEST_PHP_EXECUTABLE=%{__ztsphp} \
TEST_PHP_ARGS="$OPT -d extension=$PWD/modules/%{pecl_name}.so" \
NO_INTERACTION=1 \
REPORT_EXIT_STATUS=1 \
-%{__ztsphp} -n run-tests.php --show-diff tests/*phpt || ret=1
+%{__ztsphp} -n run-tests.php --show-diff || ret=1
popd
%endif
@@ -367,6 +337,12 @@ exit $ret
%changelog
+* Thu Feb 9 2017 Remi Collet <remi@fedoraproject.org> - 3.0.1-2
+- switch to pecl sources
+- enable test suite
+- open https://github.com/php-memcached-dev/php-memcached/pull/319
+ fix test suite for 32bits build
+
* Tue Feb 7 2017 Remi Collet <remi@fedoraproject.org> - 3.0.1-1
- update to 3.0.1 (php 7, stable)