%define php_name php%{?php_suffix}
%define modname memcache
%define php_min_version 5.0.0
+%define commit e702b5f91
%include /usr/lib/rpm/macros.php
Summary: %{modname} - a memcached extension
Summary(pl.UTF-8): %{modname} - rozszerzenie memcached
Name: %{php_name}-pecl-%{modname}
-Version: 3.0.9
+Version: 4.0.3
Release: 1
License: PHP 3.01
Group: Development/Languages/PHP
-#Source0: http://pecl.php.net/get/%{modname}-%{version}.tgz
-Source0: https://github.com/websupport-sk/pecl-memcache/archive/NON_BLOCKING_IO_php7.tar.gz
-# Source0-md5: 7751d8191302a726449d7c6506b8783d
+Source0: https://github.com/websupport-sk/pecl-memcache/archive/%{version}/%{modname}-%{version}.tar.gz
+# Source0-md5: 21a001ef690a1397a8b62990254cc8c2
Source1: %{modname}.ini
Source2: %{modname}-apache.conf
Source3: %{modname}-lighttpd.conf
Source4: config.php
Patch0: %{modname}-webapp.patch
-URL: http://pecl.php.net/package/memcache/
+URL: https://github.com/websupport-sk/pecl-memcache/
BuildRequires: %{php_name}-devel >= 3:5.0.0
BuildRequires: %{php_name}-xml
BuildRequires: php-packagexml2cl
BuildRequires: rpmbuild(macros) >= 1.650
%if %{with tests}
BuildRequires: %{php_name}-cli
+BuildRequires: %{php_name}-pcre
BuildRequires: %{php_name}-session
+BuildRequires: %{php_name}-simplexml
+BuildRequires: %{php_name}-spl
+BuildRequires: memcached
%endif
%{?requires_php_extension}
Requires: %{php_name}-session
mv pecl-%{modname}-*/{.??*,*} .
%patch0 -p1
+# skip failed tests
+xfail() {
+ set +x
+ while read s; do
+ t=$(echo "$s" | sed -rne 's/.+\[(.+)\]/\1/p')
+
+ test -f "$t"
+ echo >&2 "XFAIL: $s"
+ cat >> $t <<-EOF
+
+ --XFAIL--
+ Skip
+ EOF
+ done
+}
+
+xfail <<'EOF'
+EOF
+
%build
packagexml2cl package.xml > ChangeLog
phpize
# simple module load test
%{__php} -n -q \
-d extension_dir=modules \
+ -d extension=%{php_extensiondir}/pcre.so \
+ -d extension=%{php_extensiondir}/simplexml.so \
+ -d extension=%{php_extensiondir}/spl.so \
-d extension=%{php_extensiondir}/session.so \
-d extension=%{modname}.so \
-m > modules.log
grep %{modname} modules.log
+
+cat <<'EOF' > run-tests.sh
+#!/bin/sh
+export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
+exec %{__make} test \
+ PHP_EXECUTABLE=%{__php} \
+ PHP_TEST_SHARED_SYSTEM_EXTENSIONS="pcre simplexml spl session" \
+ RUN_TESTS_SETTINGS="-q $*"
+EOF
+chmod +x run-tests.sh
+
+# Launch the Memcached service and stop it on exit
+%{_sbindir}/memcached -p 11211 -U 11211 -d -P $PWD/memcached.pid
+trap 'kill $(cat memcached.pid)' EXIT INT
+
+./run-tests.sh
%endif
%install