summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2013-04-30 13:54:07 +0200
committerRemi Collet <fedora@famillecollet.com>2013-04-30 13:54:07 +0200
commit8ddc3a2194ea4800d4e44ba8254b96023792312d (patch)
treee12ec0e532ce1a8de7856c0257604e3abfd75e00
parent81d68c1412c83a16c2e787fc8e284efb5a9cb092 (diff)
rename php-redis to php-pecl-redis and update to 2.2.3
-rw-r--r--php-redis.spec88
1 files changed, 54 insertions, 34 deletions
diff --git a/php-redis.spec b/php-redis.spec
index e1ee4c2..477f9b7 100644
--- a/php-redis.spec
+++ b/php-redis.spec
@@ -1,9 +1,10 @@
-%global ext_name redis
+%{!?php_inidir: %{expand: %%global php_inidir %{_sysconfdir}/php.d}}
+%{!?__pecl: %{expand: %%global __pecl %{_bindir}/pecl}}
+
+%global pecl_name redis
%global with_zts 0%{?__ztsphp:1}
-%global gitver 6f7087f
-%global gitrel 38
-%if 0%{?fedora} >= 16 || 0%{?rhel} >= 5
+%if 0%{?fedora} >= 18
%ifarch ppc64
# redis have ExcludeArch: ppc64
%global with_test 0
@@ -16,32 +17,30 @@
%endif
Summary: Extension for communicating with the Redis key-value store
-Name: php-%{ext_name}
-Version: 2.2.2
-Release: 5%{?gitver:.git%{gitver}}%{?dist}.2
+Name: php-%{pecl_name}
+Version: 2.2.3
+Release: 1%{?dist}.1
License: PHP
Group: Development/Languages
URL: https://github.com/nicolasff/phpredis
-%if 0%{?gitver:1}
-# wget https://github.com/nicolasff/phpredis/tarball/6f7087fbfe2b96a2fb36abb7005b70d86329c83d
-Source0: nicolasff-phpredis-%{version}-%{gitrel}-g%{gitver}.tar.gz
-%else
-# wget https://github.com/nicolasff/phpredis/tarball/2.2.2 -O php-redis-2.2.2.tgz
-Source0: %{name}-%{version}.tgz
-%endif
+Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz
+# No test in pecl archive - https://github.com/nicolasff/phpredis/issues/332
+Source1: https://github.com/nicolasff/phpredis/archive/%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: php-devel
BuildRequires: php-pecl-igbinary-devel
# to run Test suite
%if %{with_test}
-BuildRequires: redis >= 2.4.0
+BuildRequires: redis >= 2.6
%endif
Requires: php(zend-abi) = %{php_zend_api}
Requires: php(api) = %{php_core_api}
# php-pecl-igbinary missing php-pecl(igbinary)%{?_isa}
Requires: php-pecl-igbinary%{?_isa}
+Provides: php-pecl(%{pecl_name}) = %{version}
+Provides: php-pecl(%{pecl_name})%{?_isa} = %{version}
# Filter private shared object
%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$}
@@ -58,10 +57,11 @@ some doesn't work with an old redis server version.
%prep
-%setup -q -c
+%setup -q -c -a 1
# rename source folder
-mv *redis* nts
+mv %{pecl_name}-%{version} nts
+mv phpredis-%{version}/tests nts/tests
# Sanity check, really often broken
extver=$(sed -n '/#define PHP_REDIS_VERSION/{s/.* "//;s/".*$//;p}' nts/php_redis.h)
@@ -76,13 +76,13 @@ cp -pr nts zts
%endif
# Drop in the bit of configuration
-cat > %{ext_name}.ini << 'EOF'
-; Enable %{ext_name} extension module
-extension = %{ext_name}.so
+cat > %{pecl_name}.ini << 'EOF'
+; Enable %{pecl_name} extension module
+extension = %{pecl_name}.so
; phpredis can be used to store PHP sessions.
; To do this, uncomment and configure below
-;session.save_handler = %{ext_name}
+;session.save_handler = %{pecl_name}
;session.save_path = "tcp://host1:6379?weight=1, tcp://host2:6379?weight=2&timeout=2.5, tcp://host3:6379?weight=2"
EOF
@@ -111,16 +111,22 @@ make %{?_smp_mflags}
%install
rm -rf %{buildroot}
+# for short circuit
+rm -f ?ts/modules/igbinary.so
+
# Install the NTS stuff
make -C nts install INSTALL_ROOT=%{buildroot}
-install -D -m 644 %{ext_name}.ini %{buildroot}%{_sysconfdir}/php.d/%{ext_name}.ini
+install -D -m 644 %{pecl_name}.ini %{buildroot}%{php_inidir}/%{pecl_name}.ini
# Install the ZTS stuff
%if %{with_zts}
make -C zts install INSTALL_ROOT=%{buildroot}
-install -D -m 644 %{ext_name}.ini %{buildroot}%{php_ztsinidir}/%{ext_name}.ini
+install -D -m 644 %{pecl_name}.ini %{buildroot}%{php_ztsinidir}/%{pecl_name}.ini
%endif
+# Install the package XML file
+install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml
+
%check
# simple module load test
@@ -128,16 +134,16 @@ ln -sf %{php_extdir}/igbinary.so nts/modules/igbinary.so
php --no-php-ini \
--define extension_dir=nts/modules \
--define extension=igbinary.so \
- --define extension=%{ext_name}.so \
- --modules | grep %{ext_name}
+ --define extension=%{pecl_name}.so \
+ --modules | grep %{pecl_name}
%if %{with_zts}
ln -sf %{php_ztsextdir}/igbinary.so zts/modules/igbinary.so
%{__ztsphp} --no-php-ini \
--define extension_dir=zts/modules \
--define extension=igbinary.so \
- --define extension=%{ext_name}.so \
- --modules | grep %{ext_name}
+ --define extension=%{pecl_name}.so \
+ --modules | grep %{pecl_name}
%endif
%if %{with_test}
@@ -168,7 +174,7 @@ ret=0
php --no-php-ini \
--define extension_dir=../modules \
--define extension=igbinary.so \
- --define extension=%{ext_name}.so \
+ --define extension=%{pecl_name}.so \
TestRedis.php || ret=1
# Cleanup
@@ -183,25 +189,39 @@ exit $ret
%endif
+%post
+%{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || :
+
+
+%postun
+if [ $1 -eq 0 ] ; then
+ %{pecl_uninstall} %{pecl_name} >/dev/null || :
+fi
+
+
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
-%doc nts/COPYING nts/CREDITS nts/README.markdown
-%doc nts/arrays.markdown nts/serialize.list
+%doc nts/{COPYING,CREDITS,README.markdown,arrays.markdown}
+%{pecl_xmldir}/%{name}.xml
-%config(noreplace) %{_sysconfdir}/php.d/%{ext_name}.ini
-%{php_extdir}/%{ext_name}.so
+%{php_extdir}/%{pecl_name}.so
+%config(noreplace) %{php_inidir}/%{pecl_name}.ini
%if %{with_zts}
-%{php_ztsextdir}/%{ext_name}.so
-%config(noreplace) %{php_ztsinidir}/%{ext_name}.ini
+%{php_ztsextdir}/%{pecl_name}.so
+%config(noreplace) %{php_ztsinidir}/%{pecl_name}.ini
%endif
%changelog
+* Tue Apr 30 2013 Remi Collet <remi@fedoraproject.org> - 2.2.3-1
+- update to 2.2.3
+- upstream moved to pecl
+
* Tue Sep 11 2012 Remi Collet <remi@fedoraproject.org> - 2.2.2-5.git6f7087f
- more docs and improved description