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
2216Summary: Extension to work with the Memcached caching daemon
2317Name: 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 }
3220License: PHP
3321Group: Development/Languages
3422URL: 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
3729BuildRequires: php-devel >= 7
3830BuildRequires: php-pear
@@ -42,7 +34,7 @@ BuildRequires: php-pecl-igbinary-devel
4234BuildRequires: php-pecl-msgpack-devel
4335%endif
4436BuildRequires: libevent-devel > 2
45- BuildRequires: libmemcached-devel > 1
37+ BuildRequires: libmemcached-devel > 1.0.16
4638BuildRequires: zlib-devel
4739BuildRequires: cyrus-sasl-devel
4840BuildRequires: 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
9272mv %{pecl_name }-%{version }%{?prever } NTS
93- %endif
9473
9574# Don't install/register tests
9675sed -e 's/role= "test"/role= "src"/' \
@@ -100,13 +79,17 @@ sed -e 's/role="test"/role="src"/' \
10079
10180rm -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)
10587if 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
10991fi
92+ cd ..
11093
11194cat > %{ini_name } << 'EOF'
11295; Enable %{pecl_name } extension module
@@ -182,7 +165,7 @@ make install -C ZTS INSTALL_ROOT=%{buildroot}
182165install -D -m 644 %{ini_name } %{buildroot }%{php_ztsinidir }/%{ini_name }
183166%endif
184167
185- # Test & Documentation
168+ # Documentation
186169cd NTS
187170for i in $(grep 'role= "doc"' ../package.xml | sed -e 's/^.*name= "//;s/".*$//')
188171do 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+
211197ret= 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
217205pushd NTS
@@ -220,7 +208,7 @@ TEST_PHP_EXECUTABLE=%{__php} \
220208TEST_PHP_ARGS= "$OPT -d extension= $PWD/modules/%{pecl_name }.so" \
221209NO_INTERACTION= 1 \
222210REPORT_EXIT_STATUS= 1 \
223- %{__php} -n run-tests.php || ret= 1
211+ %{__php} -n run-tests.php --show-diff || ret= 1
224212popd
225213
226214%if %{with_zts }
@@ -231,7 +219,7 @@ TEST_PHP_EXECUTABLE=%{__ztsphp} \
231219TEST_PHP_ARGS= "$OPT -d extension= $PWD/modules/%{pecl_name }.so" \
232220NO_INTERACTION= 1 \
233221REPORT_EXIT_STATUS= 1 \
234- %{__ztsphp} -n run-tests.php || ret= 1
222+ %{__ztsphp} -n run-tests.php --show-diff || ret= 1
235223popd
236224%endif
237225
@@ -259,6 +247,13 @@ exit $ret
259247
260248
261249%changelog
250+ * Thu Feb 9 2017 Remi Collet <remi@fedoraproject.org> - 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 <remi@fedoraproject.org> - 3.0.0-0.2.20160217git6ace07d
263258- rebuild for https://fedoraproject.org/wiki/Changes/php71
264259
0 commit comments