]> git.pld-linux.org Git - packages/php-pecl-memcache.git/blobdiff - php-pecl-memcache.spec
up to 4.0.4
[packages/php-pecl-memcache.git] / php-pecl-memcache.spec
index 7af57f62b7d060c52ad2de8b69768dfeb2996cb2..90c4c3058f89af0d01f58da75214205de7d178b0 100644 (file)
@@ -1,26 +1,59 @@
-%define                _modname        memcache
-%define                _status         stable
-%define                _sysconfdir     /etc/php
-%define                extensionsdir   %(php-config --extension-dir 2>/dev/null)
-Summary:       %{_modname} - a memcached extension
-Summary(pl):   %{_modname} - rozszerzenie memcached
-Name:          php-pecl-%{_modname}
-Version:       2.0.4
+#
+# Conditional build:
+%bcond_without tests           # build without tests
+
+%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:       4.0.4
 Release:       1
 Release:       1
-License:       PHP 2.02
+License:       PHP 3.01
 Group:         Development/Languages/PHP
 Group:         Development/Languages/PHP
-Source0:       http://pecl.php.net/get/%{_modname}-%{version}.tgz
-# Source0-md5: 35d46450ae9728856a2cc98cb8ec053c
-URL:           http://pecl.php.net/package/memcache/
-BuildRequires: php-devel >= 3:5.0.0
-BuildRequires: rpmbuild(macros) >= 1.322
+Source0:       https://github.com/websupport-sk/pecl-memcache/archive/%{version}/%{modname}-%{version}.tar.gz
+# Source0-md5: 612c575eccc18d98484b72c0cff6907a
+Source1:       %{modname}.ini
+Source2:       %{modname}-apache.conf
+Source3:       %{modname}-lighttpd.conf
+Source4:       config.php
+Patch0:                %{modname}-webapp.patch
+URL:           https://github.com/websupport-sk/pecl-memcache/
+BuildRequires: %{php_name}-devel >= 3:7.0.0
+BuildRequires: %{php_name}-xml
+BuildRequires: php-packagexml2cl
+BuildRequires: rpm-php-pearprov >= 4.4.2-11
+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_extension}
-Requires:      %{_sysconfdir}/conf.d
-Requires:      php-zlib
-#Sugests:      memcached
-Obsoletes:     php-pear-%{_modname}
+Requires:      %{php_name}-session
+Requires:      %{php_name}-zlib
+Suggests:      memcached
+Provides:      php(memcache) = %{version}
+Obsoletes:     php-pecl-memcache < 3.0.8-5
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
+%define                _webapps        /etc/webapps
+%define                _webapp         %{modname}
+%define                _sysconfdir     %{_webapps}/%{_webapp}
+%define                _appdir         %{_datadir}/%{_webapp}
+
+# bad depsolver
+%define                _noautopear     pear
+
+# put it together for rpmbuild
+%define                _noautoreq      %{?_noautophp} %{?_noautopear}
+
 %description
 Memcached is a caching daemon designed especially for dynamic web
 applications to decrease database load by storing objects in memory.
 %description
 Memcached is a caching daemon designed especially for dynamic web
 applications to decrease database load by storing objects in memory.
@@ -28,56 +61,178 @@ applications to decrease database load by storing objects in memory.
 This extension allows you to work with memcached through handy OO and
 procedural interfaces.
 
 This extension allows you to work with memcached through handy OO and
 procedural interfaces.
 
-In PECL status of this extension is: %{_status}.
-
-%description -l pl
+%description -l pl.UTF-8
 Memcached to zaprojektowany dla dynamicznych aplikacji internetowych
 Memcached to zaprojektowany dla dynamicznych aplikacji internetowych
-daemon cachuj±cy maj±cy za zadanie zmniejszenie obci±¿enia bazy danych
-przez przechowywanie w pamiêci obiektów.
+daemon cachujący mający za zadanie zmniejszenie obciążenia bazy danych
+przez przechowywanie w pamięci obiektów.
 
 
-To rozszerzenie umo¿liwia pracê z memcached za pomoc± porêcznego
+To rozszerzenie umożliwia pracę z memcached za pomocą poręcznego
 zorientowanego obiektowo (oraz przez procedury) interfejsu.
 
 zorientowanego obiektowo (oraz przez procedury) interfejsu.
 
-To rozszerzenie ma w PECL status: %{_status}.
+%package web
+Summary:       Web interface for memcache
+Group:         Libraries
+# does not require extension itself
+Requires:      php(core) >= %{php_min_version}
+Requires:      php(date)
+Requires:      php(gd)
+Requires:      php(pcre)
+Requires:      webapps
+Requires:      webserver(php) >= 5.0
+%if "%{_rpmversion}" >= "5"
+BuildArch:     noarch
+%endif
+
+%description web
+Via this web interface script you can manage and view statistics of
+memcache.
 
 %prep
 
 %prep
-%setup -q -c
+%setup -qc
+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'
+memcache->addServer() [tests/019.phpt]
+memcache->set()/memcache->get() with multiple keys and load balancing [tests/020.phpt]
+memcache->getExtendedStats() [tests/022.phpt]
+memcache_get_extended_stats() [tests/022a.phpt]
+memcache->delete() with load balancing [tests/023.phpt]
+memcache->increment() with load balancing [tests/025.phpt]
+memcache->delete() with load balancing [tests/026.phpt]
+memcache->addServer() adding server in failed mode [tests/031.phpt]
+memcache->getServerStatus(), memcache->setServerParams() [tests/032.phpt]
+memcache::connect() with unix domain socket [tests/035.phpt]
+ini_set('session.save_handler') [tests/036.phpt]
+ini_set('session.save_path') [tests/036b.phpt]
+memcache->increment()/decrement() with multiple keys [tests/040.phpt]
+memcache->delete() with multiple keys [tests/041.phpt]
+memcache->set() with multiple values [tests/042.phpt]
+ini_set('memcache.redundancy') [tests/043.phpt]
+ini_set('memcache.session_redundancy') [tests/044.phpt]
+ini_set('memcache.session_redundancy') [tests/044b.phpt]
+hash strategies and functions [tests/046.phpt]
+ini_set('session.save_handler') with unix domain socket [tests/053.phpt]
+memcache multi host save path function [tests/bug73539.phpt]
+session_regenerate_id() should not cause fatal error [tests/githubbug13.phpt]
+EOF
 
 %build
 
 %build
-cd %{_modname}-%{version}
+packagexml2cl package.xml > ChangeLog
 phpize
 %configure \
        --with-zlib-dir=/usr
 %{__make}
 
 phpize
 %configure \
        --with-zlib-dir=/usr
 %{__make}
 
+%if %{with tests}
+# 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
 rm -rf $RPM_BUILD_ROOT
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_sysconfdir}/conf.d,%{extensionsdir}}
-
-install %{_modname}-%{version}/modules/%{_modname}.so $RPM_BUILD_ROOT%{extensionsdir}
-cat <<'EOF' > $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/%{_modname}.ini
-; Enable %{_modname} extension module
-extension=%{_modname}.so
-;memcache.allow_failover=1
-;memcache.chunk_size=8192
-;memcache.default_port=11211
-EOF
+install -d $RPM_BUILD_ROOT{%{php_sysconfdir}/conf.d,%{php_extensiondir},%{_examplesdir}/%{name}-%{version}}
+install -p modules/%{modname}.so $RPM_BUILD_ROOT%{php_extensiondir}
+# we use "session_" prefix in inifile to get loader *after* session extension
+cp -p %{SOURCE1} $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/session_%{modname}.ini
+cp -p example.php $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
+
+install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{_appdir}}
+cp -p memcache.php $RPM_BUILD_ROOT%{_appdir}
+cp -p %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/config.php
+cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf
+cp -p $RPM_BUILD_ROOT%{_sysconfdir}/{apache,httpd}.conf
+cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/lighttpd.conf
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %post
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %post
-[ ! -f /etc/apache/conf.d/??_mod_php.conf ] || %service -q apache restart
-[ ! -f /etc/httpd/httpd.conf/??_mod_php.conf ] || %service -q httpd restart
+%php_webserver_restart
 
 %postun
 if [ "$1" = 0 ]; then
 
 %postun
 if [ "$1" = 0 ]; then
-       [ ! -f /etc/apache/conf.d/??_mod_php.conf ] || %service -q apache restart
-       [ ! -f /etc/httpd/httpd.conf/??_mod_php.conf ] || %service -q httpd restart
+       %php_webserver_restart
 fi
 
 fi
 
+%triggerpostun -- %{name} < 3.0.4-2
+if [ -f %{php_sysconfdir}/conf.d/%{modname}.ini.rpmsave ]; then
+       echo >&2 "Restoring old config: %{modname}.ini.rpmsave -> session_%{modname}.ini in %{php_sysconfdir}/conf.d"
+       cp -f %{php_sysconfdir}/conf.d/session_%{modname}.ini{,.rpmnew}
+       mv -f %{php_sysconfdir}/conf.d/{%{modname}.ini.rpmsave,session_%{modname}.ini}
+       %php_webserver_restart
+fi
+
+%triggerin web -- apache1 < 1.3.37-3, apache1-base
+%webapp_register apache %{_webapp}
+
+%triggerun web -- apache1 < 1.3.37-3, apache1-base
+%webapp_unregister apache %{_webapp}
+
+%triggerin web -- apache < 2.2.0, apache-base
+%webapp_register httpd %{_webapp}
+
+%triggerun web -- apache < 2.2.0, apache-base
+%webapp_unregister httpd %{_webapp}
+
+%triggerin web -- lighttpd
+%webapp_register lighttpd %{_webapp}
+
+%triggerun web -- lighttpd
+%webapp_unregister lighttpd %{_webapp}
+
 %files
 %defattr(644,root,root,755)
 %files
 %defattr(644,root,root,755)
-%doc %{_modname}-%{version}/{CREDITS,README}
-%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/%{_modname}.ini
-%attr(755,root,root) %{extensionsdir}/%{_modname}.so
+%doc CREDITS README ChangeLog
+%config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/session_%{modname}.ini
+%attr(755,root,root) %{php_extensiondir}/%{modname}.so
+%{_examplesdir}/%{name}-%{version}
+
+%files web
+%defattr(644,root,root,755)
+%dir %attr(750,root,http) %{_sysconfdir}
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apache.conf
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lighttpd.conf
+%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/config.php
+%{_appdir}
This page took 0.036515 seconds and 4 git commands to generate.