Skip to content
This repository was archived by the owner on Jul 3, 2019. It is now read-only.

Commit 7d3de6a

Browse files
author
Remi Collet
committed
update to 3.0.1 (php 7, stable)
switch to pecl sources enable test suite open php-memcached-dev/php-memcached#319 fix test suite for 32bits build
1 parent 9eec12b commit 7d3de6a

File tree

4 files changed

+112
-37
lines changed

4 files changed

+112
-37
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ package*xml
55
/memcached-2.1.0.tgz
66
/memcached-2.2.0.tgz
77
/php-memcached-3.0.0-6ace07d.tar.gz
8+
/memcached-3.0.1.tgz

memcached-pr319.patch

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
From f8fd6228e34e1b49947890b060a501a6eab6978c Mon Sep 17 00:00:00 2001
2+
From: Remi Collet <[email protected]>
3+
Date: Thu, 9 Feb 2017 07:24:15 +0100
4+
Subject: [PATCH] ensure tests are ok for 32bits build
5+
6+
---
7+
tests/gh_90.phpt | 4 ++--
8+
tests/incrdecr.phpt | 6 +++---
9+
tests/incrdecr_bykey.phpt | 6 +++---
10+
3 files changed, 8 insertions(+), 8 deletions(-)
11+
12+
diff --git a/tests/gh_90.phpt b/tests/gh_90.phpt
13+
index 733b761..2a16f60 100644
14+
--- a/tests/gh_90.phpt
15+
+++ b/tests/gh_90.phpt
16+
@@ -12,7 +12,7 @@ $memcached = memc_get_instance (array (
17+
// Create a key for use as a lock. If this key already exists, wait till it doesn't exist.
18+
{
19+
$key = 'LockKey';
20+
- $lockToken = mt_rand(0, pow(2, 32)); //Random value betwen 0 and 2^32 for ownership verification
21+
+ $lockToken = mt_rand(0, mt_getrandmax()); //Random value for ownership verification
22+
23+
while (true)
24+
{
25+
@@ -88,4 +88,4 @@ array(10) {
26+
int(1)
27+
["9_%s"]=>
28+
int(1)
29+
-}
30+
\ No newline at end of file
31+
+}
32+
diff --git a/tests/incrdecr.phpt b/tests/incrdecr.phpt
33+
index cb3914a..b4e9469 100644
34+
--- a/tests/incrdecr.phpt
35+
+++ b/tests/incrdecr.phpt
36+
@@ -42,10 +42,10 @@ echo $php_errormsg, "\n";
37+
var_dump($m->get('foo'));
38+
39+
echo "Enormous offset\n";
40+
-$m->increment('foo', 4294967296);
41+
+$m->increment('foo', 0x7f000000);
42+
var_dump($m->get('foo'));
43+
44+
-$m->decrement('foo', 4294967296);
45+
+$m->decrement('foo', 0x7f000000);
46+
var_dump($m->get('foo'));
47+
48+
--EXPECT--
49+
@@ -68,5 +68,5 @@ int(1)
50+
Memcached::decrement(): offset cannot be a negative value
51+
int(1)
52+
Enormous offset
53+
-int(4294967297)
54+
+int(2130706433)
55+
int(1)
56+
diff --git a/tests/incrdecr_bykey.phpt b/tests/incrdecr_bykey.phpt
57+
index 809f3b8..8b931fa 100644
58+
--- a/tests/incrdecr_bykey.phpt
59+
+++ b/tests/incrdecr_bykey.phpt
60+
@@ -39,10 +39,10 @@ echo $php_errormsg, "\n";
61+
var_dump($m->get('foo'));
62+
63+
echo "Enormous offset\n";
64+
-$m->incrementByKey('foo', 'foo', 4294967296);
65+
+$m->incrementByKey('foo', 'foo', 0x7f000000);
66+
var_dump($m->get('foo'));
67+
68+
-$m->decrementByKey('foo', 'foo', 4294967296);
69+
+$m->decrementByKey('foo', 'foo', 0x7f000000);
70+
var_dump($m->get('foo'));
71+
72+
--EXPECT--
73+
@@ -62,5 +62,5 @@ int(1)
74+
Memcached::decrementByKey(): offset cannot be a negative value
75+
int(1)
76+
Enormous offset
77+
-int(4294967297)
78+
+int(2130706433)
79+
int(1)

php-pecl-memcached.spec

+31-36
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,30 @@
11
# Fedora spec file for php-pecl-memcached
22
#
3-
# Copyright (c) 2009-2016 Remi Collet
3+
# Copyright (c) 2009-2017 Remi Collet
44
# License: CC-BY-SA
55
# http://creativecommons.org/licenses/by-sa/4.0/
66
#
77
# Please, preserve the changelog entries
88
#
99

10-
%global with_zts 0%{?__ztsphp:1}
11-
%global with_tests 0%{?_with_tests:1}
10+
%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}}
11+
%global with_tests 0%{!?_without_tests:1}
1212
%global pecl_name memcached
1313
# After 40-igbinary, 40-json, 40-msgpack
1414
%global ini_name 50-%{pecl_name}.ini
15-
# https://github.com/php-memcached-dev/php-memcached/commits/php7
16-
%global gh_commit 6ace07da69a5ebc021e56a9d2f52cdc8897b4f23
17-
%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
18-
%global gh_date 20160217
19-
%global gh_owner php-memcached-dev
20-
%global gh_project php-memcached
2115

2216
Summary: Extension to work with the Memcached caching daemon
2317
Name: php-pecl-memcached
24-
Version: 3.0.0
25-
%if 0%{?gh_date:1}
26-
Release: 0.2.%{gh_date}git%{gh_short}%{?dist}
27-
Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}%{?prever}-%{gh_short}.tar.gz
28-
%else
29-
Release: 2%{?dist}
30-
Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz
31-
%endif
18+
Version: 3.0.1
19+
Release: 1%{?dist}
3220
License: PHP
3321
Group: Development/Languages
3422
URL: http://pecl.php.net/package/%{pecl_name}
3523

24+
Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz
25+
26+
# https://github.com/php-memcached-dev/php-memcached/pull/319
27+
Patch0: %{pecl_name}-pr319.patch
3628

3729
BuildRequires: php-devel >= 7
3830
BuildRequires: php-pear
@@ -42,7 +34,7 @@ BuildRequires: php-pecl-igbinary-devel
4234
BuildRequires: php-pecl-msgpack-devel
4335
%endif
4436
BuildRequires: libevent-devel > 2
45-
BuildRequires: libmemcached-devel > 1
37+
BuildRequires: libmemcached-devel > 1.0.16
4638
BuildRequires: zlib-devel
4739
BuildRequires: cyrus-sasl-devel
4840
BuildRequires: fastlz-devel
@@ -77,20 +69,7 @@ It also provides a session handler (memcached).
7769

7870
%prep
7971
%setup -c -q
80-
81-
%if 0%{?gh_date:1}
82-
mv %{gh_project}-%{gh_commit} NTS
83-
sed -e '/PHP_MEMCACHED_VERSION/s/3.0.0b1/%{version}-dev/' -i NTS/php_memcached.h
84-
%{__php} -r '
85-
$pkg = simplexml_load_file("NTS/package.xml");
86-
$pkg->date = substr("%{gh_date}",0,4)."-".substr("%{gh_date}",4,2)."-".substr("%{gh_date}",6,2);
87-
$pkg->version->release = "%{version}dev";
88-
$pkg->stability->release = "devel";
89-
$pkg->asXML("package.xml");
90-
'
91-
%else
9272
mv %{pecl_name}-%{version}%{?prever} NTS
93-
%endif
9473

9574
# Don't install/register tests
9675
sed -e 's/role="test"/role="src"/' \
@@ -100,13 +79,17 @@ sed -e 's/role="test"/role="src"/' \
10079

10180
rm -r NTS/fastlz
10281

82+
cd NTS
83+
%patch0 -p1 -b .pr319
84+
10385
# Chech version as upstream often forget to update this
104-
extver=$(sed -n '/#define PHP_MEMCACHED_VERSION/{s/.* "//;s/".*$//;p}' NTS/php_memcached.h)
86+
extver=$(sed -n '/#define PHP_MEMCACHED_VERSION/{s/.* "//;s/".*$//;p}' php_memcached.h)
10587
if test "x${extver}" != "x%{version}%{?gh_date:-dev}%{?intver}"; then
10688
: Error: Upstream HTTP version is now ${extver}, expecting %{version}.
10789
: Update the pdover macro and rebuild.
10890
exit 1
10991
fi
92+
cd ..
11093

11194
cat > %{ini_name} << 'EOF'
11295
; Enable %{pecl_name} extension module
@@ -182,7 +165,7 @@ make install -C ZTS INSTALL_ROOT=%{buildroot}
182165
install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name}
183166
%endif
184167

185-
# Test & Documentation
168+
# Documentation
186169
cd NTS
187170
for i in $(grep 'role="doc"' ../package.xml | sed -e 's/^.*name="//;s/".*$//')
188171
do install -Dpm 644 $i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i
@@ -208,10 +191,15 @@ OPT="-n"
208191
%endif
209192

210193
%if %{with_tests}
194+
# XFAIL and very slow so no value
195+
rm ?TS/tests/expire.phpt
196+
211197
ret=0
212198

213199
: Launch the Memcached service
214-
memcached -p 11211 -U 11211 -d -P $PWD/memcached.pid
200+
port=$(%{__php} -r 'echo 10000 + PHP_MAJOR_VERSION*100 + PHP_MINOR_VERSION*10 + PHP_INT_SIZE;')
201+
memcached -p $port -U $port -d -P $PWD/memcached.pid
202+
sed -e "s/11211/$port/" -i ?TS/tests/*
215203

216204
: Run the upstream test Suite for NTS extension
217205
pushd NTS
@@ -220,7 +208,7 @@ TEST_PHP_EXECUTABLE=%{__php} \
220208
TEST_PHP_ARGS="$OPT -d extension=$PWD/modules/%{pecl_name}.so" \
221209
NO_INTERACTION=1 \
222210
REPORT_EXIT_STATUS=1 \
223-
%{__php} -n run-tests.php || ret=1
211+
%{__php} -n run-tests.php --show-diff || ret=1
224212
popd
225213

226214
%if %{with_zts}
@@ -231,7 +219,7 @@ TEST_PHP_EXECUTABLE=%{__ztsphp} \
231219
TEST_PHP_ARGS="$OPT -d extension=$PWD/modules/%{pecl_name}.so" \
232220
NO_INTERACTION=1 \
233221
REPORT_EXIT_STATUS=1 \
234-
%{__ztsphp} -n run-tests.php || ret=1
222+
%{__ztsphp} -n run-tests.php --show-diff || ret=1
235223
popd
236224
%endif
237225

@@ -259,6 +247,13 @@ exit $ret
259247

260248

261249
%changelog
250+
* Thu Feb 9 2017 Remi Collet <[email protected]> - 3.0.1-1
251+
- update to 3.0.1 (php 7, stable)
252+
- switch to pecl sources
253+
- enable test suite
254+
- open https://github.com/php-memcached-dev/php-memcached/pull/319
255+
fix test suite for 32bits build
256+
262257
* Mon Nov 14 2016 Remi Collet <[email protected]> - 3.0.0-0.2.20160217git6ace07d
263258
- rebuild for https://fedoraproject.org/wiki/Changes/php71
264259

sources

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
773cfe454e8eee2a17797b1bfafb1dcd php-memcached-3.0.0-6ace07d.tar.gz
1+
SHA512 (memcached-3.0.1.tgz) = 3411a846ba429e539cc44753aadce5ef33e0583cfc6f4302152f10c5f46a399918af8c0d196c631778670a24617d1c514d155a67248bc4e1f6579f24958632ea

0 commit comments

Comments
 (0)