From 060ccef5bee3a846078e6f2ba7d7b52145ebc54b Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sun, 10 Jun 2012 07:06:04 +0200 Subject: repo reorg --- Makefile | 4 + memcache-php54.patch | 51 +++++++++++ php-pecl-memcache.spec | 229 +++++++++++++++++++++++++++++++++++++++++++++++++ xml2changelog | 40 +++++++++ 4 files changed, 324 insertions(+) create mode 100644 Makefile create mode 100644 memcache-php54.patch create mode 100644 php-pecl-memcache.spec create mode 100644 xml2changelog diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1e65467 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +SRCDIR := $(shell pwd) +NAME := $(shell basename $(SRCDIR)) +include ../common/Makefile + diff --git a/memcache-php54.patch b/memcache-php54.patch new file mode 100644 index 0000000..be9f200 --- /dev/null +++ b/memcache-php54.patch @@ -0,0 +1,51 @@ +diff -up memcache-3.0.6/memcache.c.orig memcache-3.0.6/memcache.c +--- memcache-3.0.6/memcache.c.orig 2011-11-13 10:54:04.230073555 +0100 ++++ memcache-3.0.6/memcache.c 2011-11-13 10:55:41.867315825 +0100 +@@ -718,7 +718,11 @@ mmc_t *mmc_find_persistent(const char *h + mmc_server_free(mmc TSRMLS_CC); + mmc = NULL; + } else { ++#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5) ++ zend_list_insert(mmc, le_memcache_server TSRMLS_CC); ++#else + zend_list_insert(mmc, le_memcache_server); ++#endif + } + } + else if (le->type != le_memcache_server || le->ptr == NULL) { +@@ -735,7 +739,11 @@ mmc_t *mmc_find_persistent(const char *h + mmc = NULL; + } + else { ++#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5) ++ zend_list_insert(mmc, le_memcache_server TSRMLS_CC); ++#else + zend_list_insert(mmc, le_memcache_server); ++#endif + } + } + else { +@@ -775,7 +783,11 @@ static mmc_t *php_mmc_pool_addserver( + if (zend_hash_find(Z_OBJPROP_P(mmc_object), "connection", sizeof("connection"), (void **)&connection) == FAILURE) { + pool = mmc_pool_new(TSRMLS_C); + pool->failure_callback = &php_mmc_failure_callback; ++#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5) ++ list_id = zend_list_insert(pool, le_memcache_pool TSRMLS_CC); ++#else + list_id = zend_list_insert(pool, le_memcache_pool); ++#endif + add_property_resource(mmc_object, "connection", list_id); + } + else { +@@ -836,7 +848,11 @@ static void php_mmc_connect(INTERNAL_FUN + int list_id; + mmc_pool_t *pool = mmc_pool_new(TSRMLS_C); + pool->failure_callback = &php_mmc_failure_callback; ++#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5) ++ list_id = zend_list_insert(pool, le_memcache_pool TSRMLS_CC); ++#else + list_id = zend_list_insert(pool, le_memcache_pool); ++#endif + mmc_object = return_value; + object_init_ex(mmc_object, memcache_ce); + add_property_resource(mmc_object, "connection", list_id); diff --git a/php-pecl-memcache.spec b/php-pecl-memcache.spec new file mode 100644 index 0000000..8ec62c4 --- /dev/null +++ b/php-pecl-memcache.spec @@ -0,0 +1,229 @@ +%{!?phpname: %{expand: %%global phpname php}} +%{!?__pecl: %{expand: %%global __pecl %{_bindir}/pecl}} +%{!?php_extdir: %{expand: %%global php_extdir %(%{phpbindir}/php-config --extension-dir)}} + +%global pecl_name memcache + +Summary: Extension to work with the Memcached caching daemon +Name: %{phpname}-pecl-memcache +Version: 3.0.6 +Release: 3%{?dist} +License: PHP +Group: Development/Languages +URL: http://pecl.php.net/package/%{pecl_name} + +Source: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz +Source2: xml2changelog + +# https://bugs.php.net/60284 +Patch0: memcache-php54.patch + +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildRequires: %{phpname}-devel >= 4.3.11, %{phpname}-pear, zlib-devel + +Requires(post): %{__pecl} +Requires(postun): %{__pecl} +Requires: %{phpname}(zend-abi) = %{php_zend_api} +Requires: %{phpname}(api) = %{php_core_api} + +Provides: %{phpname}-pecl(%{pecl_name}) = %{version}-%{release} + + +# RPM 4.8 +%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$} +%{?filter_setup} +# RPM 4.9 +%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}%{_libdir}/.*\\.so$ + + +%description +Memcached is a caching daemon designed especially for +dynamic web applications to decrease database load by +storing objects in memory. + +This extension allows you to work with memcached through +handy OO and procedural interfaces. + +Memcache can be used as a PHP session handler. + + +%prep +%setup -c -q + +%patch0 -p0 -b .php54 + +%{__php} -n %{SOURCE2} package.xml | tee CHANGELOG | head -n 5 + +cat >%{pecl_name}.ini << 'EOF' +; ----- Enable %{pecl_name} extension module +extension=%{pecl_name}.so + +; ----- Options for the %{pecl_name} module + +; Whether to transparently failover to other servers on errors +;memcache.allow_failover=1 +; Data will be transferred in chunks of this size +;memcache.chunk_size=32768 +; Autocompress large data +;memcache.compress_threshold=20000 +; The default TCP port number to use when connecting to the memcached server +;memcache.default_port=11211 +; Hash function {crc32, fnv} +;memcache.hash_function=crc32 +; Hash strategy {standard, consistent} +;memcache.hash_strategy=consistent +; Defines how many servers to try when setting and getting data. +;memcache.max_failover_attempts=20 +; The protocol {ascii, binary} : You need a memcached >= 1.3.0 to use the binary protocol +; The binary protocol results in less traffic and is more efficient +;memcache.protocol=ascii +; Redundancy : When enabled the client sends requests to N servers in parallel +;memcache.redundancy=1 +;memcache.session_redundancy=2 +; Lock Timeout +;memcache.lock_timeout = 15 + +; ----- Options to use the memcache session handler + +; Use memcache as a session handler +;session.save_handler=memcache +; Defines a comma separated of server urls to use for session storage +;session.save_path="tcp://localhost:11211?persistent=1&weight=1&timeout=1&retry_interval=15" +EOF + +# avoid spurious-executable-perm +find . -type f -exec chmod -x {} \; + +cp -r %{pecl_name}-%{version} %{pecl_name}-%{version}-zts + + +%build +cd %{pecl_name}-%{version} +%{_bindir}/phpize +%configure --with-php-config=%{_bindir}/php-config +make %{?_smp_mflags} + +cd ../%{pecl_name}-%{version}-zts +%{_bindir}/zts-phpize +%configure --with-php-config=%{_bindir}/zts-php-config +make %{?_smp_mflags} + + +%install +rm -rf %{buildroot} + +make -C %{pecl_name}-%{version} \ + install INSTALL_ROOT=%{buildroot} + +make -C %{pecl_name}-%{version}-zts \ + install INSTALL_ROOT=%{buildroot} + +# Drop in the bit of configuration +install -D -m 644 %{pecl_name}.ini %{buildroot}%{php_inidir}/%{pecl_name}.ini +install -D -m 644 %{pecl_name}.ini %{buildroot}%{php_ztsinidir}/%{pecl_name}.ini + +# Install XML package description +install -Dpm 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml + + +%check +# simple module load test +%{__php} --no-php-ini \ + --define extension_dir=%{pecl_name}-%{version}/modules \ + --define extension=%{pecl_name}.so \ + --modules | grep %{pecl_name} + +%{__ztsphp} --no-php-ini \ + --define extension_dir=%{pecl_name}-%{version}-zts/modules \ + --define extension=%{pecl_name}.so \ + --modules | grep %{pecl_name} + + +%clean +rm -rf %{buildroot} + + +%post +%{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : + + +%postun +if [ $1 -eq 0 ] ; then + %{pecl_uninstall} %{pecl_name} >/dev/null || : +fi + + +%files +%defattr(-, root, root, -) +%doc CHANGELOG %{pecl_name}-%{version}/CREDITS %{pecl_name}-%{version}/README +%doc %{pecl_name}-%{version}/example.php %{pecl_name}-%{version}/memcache.php +%config(noreplace) %{php_inidir}/%{pecl_name}.ini +%config(noreplace) %{php_ztsinidir}/%{pecl_name}.ini +%{php_extdir}/%{pecl_name}.so +%{php_ztsextdir}/%{pecl_name}.so +%{pecl_xmldir}/%{name}.xml + + +%changelog +* Sun Nov 13 2011 Remi Collet - 3.0.6-3 +- build against php 5.4 +- add patch for ZTS build, see https://bugs.php.net/60284 + +* Mon Oct 03 2011 Remi Collet 3.0.6-2 +- clean spec for latest macros +- build zts extension + +* Mon Apr 11 2011 Remi Collet 3.0.6-1 +- update to 3.0.6 + +* Wed Feb 09 2011 Fedora Release Engineering - 3.0.5-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Mon Dec 27 2010 Remi Collet 3.0.5-3 +- relocate using phpname macro + +* Sat Oct 23 2010 Remi Collet 3.0.5-2 +- add filter_provides to avoid private-shared-object-provides memcache.so + +* Tue Oct 05 2010 Remi Collet 3.0.5-1 +- update to 3.0.5 + +* Thu Sep 30 2010 Remi Collet 3.0.4-4 +- patch for bug #599305 (upstream #17566) +- add minimal load test in %%check + +* Sun Jul 26 2009 Fedora Release Engineering - 3.0.4-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Sun Jul 12 2009 Remi Collet 3.0.4-2 +- rebuild for new PHP 5.3.0 ABI (20090626) + +* Sat Feb 28 2009 Remi Collet 3.0.4-1 +- new version 3.0.4 + +* Tue Jan 13 2009 Remi Collet 3.0.3-1 +- new version 3.0.3 + +* Fri Sep 11 2008 Remi Collet 3.0.2-1 +- new version 3.0.2 + +* Fri Sep 11 2008 Remi Collet 2.2.4-1 +- new version 2.2.4 (bug fixes) + +* Sat Feb 9 2008 Remi Collet 2.2.3-1 +- new version + +* Thu Jan 10 2008 Remi Collet 2.2.2-1 +- new version + +* Thu Nov 01 2007 Remi Collet 2.2.1-1 +- new version + +* Sat Sep 22 2007 Remi Collet 2.2.0-1 +- new version +- add new INI directives (hash_strategy + hash_function) to config +- add BR on php-devel >= 4.3.11 + +* Mon Aug 20 2007 Remi Collet 2.1.2-1 +- initial RPM + diff --git a/xml2changelog b/xml2changelog new file mode 100644 index 0000000..eb6bd31 --- /dev/null +++ b/xml2changelog @@ -0,0 +1,40 @@ += "2"){ // Package.xml V 2.0 + printf("*** Version %s (%s) - API %s (%s) - %s\n\n%s\n\n", + $xml->version->release, $xml->stability->release, + $xml->version->api, $xml->stability->api, + $xml->date, $xml->notes); + $new=$xml->version->release; + + if (isset($xml->changelog->release) && count($xml->changelog->release)) { + $tab = array(); + foreach($xml->changelog->release as $rel) { + $old=$rel->version->release; + if ("$old" != "$new") { + $tab[''.$rel->date] = $rel; + } + } + krsort($tab); + foreach($tab as $rel) { + printf("*** Version %s (%s) - API %s (%s) - %s\n\n%s\n\n", + $rel->version->release, $rel->stability->release, + $rel->version->api, $rel->stability->api, + $rel->date, $rel->notes); + } + } +} else { // Package.xml V 1.0 + printf("* Version %s (%s) - %s\n\n%s\n\n", + $xml->release->version, $xml->release->state, $xml->release->date, $xml->release->notes); + + foreach($xml->changelog->release as $rel) + printf("* Version %s (%s) - %s\n\n%s\n\n", + $rel->version, $rel->state, $rel->date, $rel->notes); +} +?> -- cgit