]> git.pld-linux.org Git - packages/php-pecl-memcache.git/blame - php-pecl-memcache.spec
- drop obsolete and outdated manual inclusion of rpm macros
[packages/php-pecl-memcache.git] / php-pecl-memcache.spec
CommitLineData
8dfd8797
ER
1#
2# Conditional build:
3%bcond_without tests # build without tests
4
3917ea3d 5%define php_name php%{?php_suffix}
a9222c27 6%define modname memcache
afdaa3d2 7%define php_min_version 5.0.0
7362daf0 8%define commit e702b5f91
a9222c27
ER
9Summary: %{modname} - a memcached extension
10Summary(pl.UTF-8): %{modname} - rozszerzenie memcached
3917ea3d 11Name: %{php_name}-pecl-%{modname}
3ed64542 12Version: 4.0.5.1
f148f58d 13Release: 1
d7d5fbe6 14License: PHP 3.01
15f9ce79 15Group: Development/Languages/PHP
3ed64542
ER
16Source0: https://pecl.php.net/get/memcache-%{version}.tgz
17# Source0-md5: 0b11dcaa218872b7645d2c3425ce7fe8
20995d54 18Source1: %{modname}.ini
afdaa3d2
ER
19Source2: %{modname}-apache.conf
20Source3: %{modname}-lighttpd.conf
21Source4: config.php
22Patch0: %{modname}-webapp.patch
cb9f58e6 23Patch1: tests.patch
3ed64542 24URL: https://pecl.php.net/package/memcache
f00d6003 25BuildRequires: %{php_name}-devel >= 3:7.0.0
746511d0
ER
26BuildRequires: %{php_name}-pcre
27BuildRequires: %{php_name}-session
28BuildRequires: %{php_name}-simplexml
29BuildRequires: %{php_name}-spl
241a36be 30BuildRequires: %{php_name}-xml
fae887d4 31BuildRequires: php-packagexml2cl
afdaa3d2 32BuildRequires: rpm-php-pearprov >= 4.4.2-11
62a21c7f 33BuildRequires: rpmbuild(macros) >= 1.650
8dfd8797
ER
34%if %{with tests}
35BuildRequires: %{php_name}-cli
b1a4ab93 36BuildRequires: memcached
8dfd8797 37%endif
0bee29d4 38%{?requires_php_extension}
3917ea3d
ER
39Requires: %{php_name}-session
40Requires: %{php_name}-zlib
afdaa3d2 41Suggests: memcached
bd3aaaff 42Provides: php(memcache) = %{version}
41a892be 43Obsoletes: php-pecl-memcache < 3.0.8-5
15f9ce79
AG
44BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
45
afdaa3d2
ER
46%define _webapps /etc/webapps
47%define _webapp %{modname}
48%define _sysconfdir %{_webapps}/%{_webapp}
49%define _appdir %{_datadir}/%{_webapp}
50
51# bad depsolver
52%define _noautopear pear
53
54# put it together for rpmbuild
55%define _noautoreq %{?_noautophp} %{?_noautopear}
56
15f9ce79
AG
57%description
58Memcached is a caching daemon designed especially for dynamic web
59applications to decrease database load by storing objects in memory.
60
61This extension allows you to work with memcached through handy OO and
62procedural interfaces.
63
6dd6de29 64%description -l pl.UTF-8
15f9ce79 65Memcached to zaprojektowany dla dynamicznych aplikacji internetowych
6dd6de29
JR
66daemon cachujący mający za zadanie zmniejszenie obciążenia bazy danych
67przez przechowywanie w pamięci obiektów.
15f9ce79 68
6dd6de29 69To rozszerzenie umożliwia pracę z memcached za pomocą poręcznego
15f9ce79
AG
70zorientowanego obiektowo (oraz przez procedury) interfejsu.
71
afdaa3d2
ER
72%package web
73Summary: Web interface for memcache
74Group: Libraries
09120ee3 75# does not require extension itself
fae887d4 76Requires: php(core) >= %{php_min_version}
3917ea3d
ER
77Requires: php(date)
78Requires: php(gd)
79Requires: php(pcre)
afdaa3d2
ER
80Requires: webapps
81Requires: webserver(php) >= 5.0
3917ea3d
ER
82%if "%{_rpmversion}" >= "5"
83BuildArch: noarch
84%endif
afdaa3d2
ER
85
86%description web
87Via this web interface script you can manage and view statistics of
88memcache.
89
15f9ce79 90%prep
10d2ed2a 91%setup -qc
3ed64542 92mv %{modname}-*/* .
afdaa3d2 93%patch0 -p1
cb9f58e6 94%patch1 -p1
15f9ce79 95
746511d0
ER
96cat <<'EOF' > run-tests.sh
97#!/bin/sh
98export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
99exec %{__make} test \
100 PHP_EXECUTABLE=%{__php} \
101%if "%php_major_version.%php_minor_version" >= "7.4"
102 PHP_TEST_SHARED_SYSTEM_EXTENSIONS="simplexml session" \
103%else
104 PHP_TEST_SHARED_SYSTEM_EXTENSIONS="pcre spl simplexml session" \
105%endif
106 RUN_TESTS_SETTINGS="-q $*"
107EOF
108chmod +x run-tests.sh
109
85fa36ce 110# skip failed tests
a92c0265
ER
111die() {
112 echo >&2 "$*"
113 exit 1
114}
85fa36ce
ER
115xfail() {
116 set +x
117 while read s; do
118 t=$(echo "$s" | sed -rne 's/.+\[(.+)\]/\1/p')
119
a92c0265 120 test -f "$t" || die "Missing $t"
85fa36ce
ER
121 echo >&2 "XFAIL: $s"
122 cat >> $t <<-EOF
123
124 --XFAIL--
125 Skip
126 EOF
127 done
128}
129
130xfail <<'EOF'
31f4af49
ER
131memcache->addServer() [tests/019.phpt]
132memcache->set()/memcache->get() with multiple keys and load balancing [tests/020.phpt]
133memcache->getExtendedStats() [tests/022.phpt]
134memcache_get_extended_stats() [tests/022a.phpt]
135memcache->delete() with load balancing [tests/023.phpt]
136memcache->increment() with load balancing [tests/025.phpt]
137memcache->delete() with load balancing [tests/026.phpt]
138memcache->addServer() adding server in failed mode [tests/031.phpt]
139memcache->getServerStatus(), memcache->setServerParams() [tests/032.phpt]
140memcache::connect() with unix domain socket [tests/035.phpt]
141ini_set('session.save_handler') [tests/036.phpt]
142ini_set('session.save_path') [tests/036b.phpt]
143memcache->increment()/decrement() with multiple keys [tests/040.phpt]
144memcache->delete() with multiple keys [tests/041.phpt]
145memcache->set() with multiple values [tests/042.phpt]
146ini_set('memcache.redundancy') [tests/043.phpt]
147ini_set('memcache.session_redundancy') [tests/044.phpt]
31f4af49
ER
148hash strategies and functions [tests/046.phpt]
149ini_set('session.save_handler') with unix domain socket [tests/053.phpt]
150memcache multi host save path function [tests/bug73539.phpt]
151session_regenerate_id() should not cause fatal error [tests/githubbug13.phpt]
85fa36ce 152EOF
b1a4ab93 153
15f9ce79 154%build
6c6304c8 155packagexml2cl package.xml > ChangeLog
15f9ce79 156phpize
172c079e
AG
157%configure \
158 --with-zlib-dir=/usr
15f9ce79
AG
159%{__make}
160
8dfd8797
ER
161# simple module load test
162%{__php} -n -q \
163 -d extension_dir=modules \
746511d0 164%if "%php_major_version.%php_minor_version" >= "7.4"
9600d334 165 -d extension=%{php_extensiondir}/simplexml.so \
746511d0
ER
166 -d extension=%{php_extensiondir}/session.so \
167%else
168 -d extension=%{php_extensiondir}/pcre.so \
ef0230c6 169 -d extension=%{php_extensiondir}/spl.so \
746511d0 170 -d extension=%{php_extensiondir}/simplexml.so \
8dfd8797 171 -d extension=%{php_extensiondir}/session.so \
746511d0 172%endif
8dfd8797
ER
173 -d extension=%{modname}.so \
174 -m > modules.log
175grep %{modname} modules.log
e7368be2 176
746511d0 177%if %{with tests}
b1a4ab93 178# Launch the Memcached service and stop it on exit
cb9f58e6 179domainsocket=$PWD/memcached.sock
b1a4ab93 180%{_sbindir}/memcached -p 11211 -U 11211 -d -P $PWD/memcached.pid
cb9f58e6
ER
181%{_sbindir}/memcached -s $domainsocket -d -P $PWD/memcached-udp.pid
182trap 'kill $(cat memcached.pid memcached-udp.pid)' EXIT INT
b1a4ab93 183
746511d0 184./run-tests.sh --show-diff
8dfd8797
ER
185%endif
186
15f9ce79
AG
187%install
188rm -rf $RPM_BUILD_ROOT
a9222c27 189install -d $RPM_BUILD_ROOT{%{php_sysconfdir}/conf.d,%{php_extensiondir},%{_examplesdir}/%{name}-%{version}}
20995d54
ER
190install -p modules/%{modname}.so $RPM_BUILD_ROOT%{php_extensiondir}
191# we use "session_" prefix in inifile to get loader *after* session extension
10d2ed2a
ER
192cp -p %{SOURCE1} $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/session_%{modname}.ini
193cp -p example.php $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
afdaa3d2
ER
194
195install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{_appdir}}
10d2ed2a
ER
196cp -p memcache.php $RPM_BUILD_ROOT%{_appdir}
197cp -p %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/config.php
198cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf
199cp -p $RPM_BUILD_ROOT%{_sysconfdir}/{apache,httpd}.conf
200cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/lighttpd.conf
15f9ce79
AG
201
202%clean
203rm -rf $RPM_BUILD_ROOT
204
205%post
86295f4f 206%php_webserver_restart
15f9ce79 207
0bee29d4
ER
208%postun
209if [ "$1" = 0 ]; then
86295f4f 210 %php_webserver_restart
15f9ce79
AG
211fi
212
c69936a3
ER
213%triggerpostun -- %{name} < 3.0.4-2
214if [ -f %{php_sysconfdir}/conf.d/%{modname}.ini.rpmsave ]; then
215 echo >&2 "Restoring old config: %{modname}.ini.rpmsave -> session_%{modname}.ini in %{php_sysconfdir}/conf.d"
216 cp -f %{php_sysconfdir}/conf.d/session_%{modname}.ini{,.rpmnew}
217 mv -f %{php_sysconfdir}/conf.d/{%{modname}.ini.rpmsave,session_%{modname}.ini}
218 %php_webserver_restart
219fi
220
afdaa3d2
ER
221%triggerin web -- apache1 < 1.3.37-3, apache1-base
222%webapp_register apache %{_webapp}
223
224%triggerun web -- apache1 < 1.3.37-3, apache1-base
225%webapp_unregister apache %{_webapp}
226
fbc0c377 227%triggerin web -- apache < 2.2.0, apache-base
afdaa3d2
ER
228%webapp_register httpd %{_webapp}
229
fbc0c377 230%triggerun web -- apache < 2.2.0, apache-base
afdaa3d2
ER
231%webapp_unregister httpd %{_webapp}
232
233%triggerin web -- lighttpd
234%webapp_register lighttpd %{_webapp}
235
236%triggerun web -- lighttpd
237%webapp_unregister lighttpd %{_webapp}
238
15f9ce79
AG
239%files
240%defattr(644,root,root,755)
6c6304c8 241%doc CREDITS README ChangeLog
c69936a3 242%config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/session_%{modname}.ini
a9222c27
ER
243%attr(755,root,root) %{php_extensiondir}/%{modname}.so
244%{_examplesdir}/%{name}-%{version}
afdaa3d2
ER
245
246%files web
247%defattr(644,root,root,755)
248%dir %attr(750,root,http) %{_sysconfdir}
249%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apache.conf
250%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf
251%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lighttpd.conf
1ec0934f 252%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/config.php
afdaa3d2 253%{_appdir}
This page took 0.101213 seconds and 4 git commands to generate.