From 6a01628db9a941d60b8013e7c0c517bb07ff96b7 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 2 Oct 2013 07:20:19 +0200 Subject: php-pecl-varnish: 1.1.0 --- LICENSE | 26 -------------- config.m4 | 55 ----------------------------- php-pecl-varnish.spec | 95 ++++++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 83 insertions(+), 93 deletions(-) delete mode 100644 LICENSE delete mode 100644 config.m4 diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 971d7ec..0000000 --- a/LICENSE +++ /dev/null @@ -1,26 +0,0 @@ -Copyright (c) 2011-2013 Anatol Belski -All rights reserved. - -Author: Anatol Belski - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -SUCH DAMAGE. - diff --git a/config.m4 b/config.m4 deleted file mode 100644 index eceb62d..0000000 --- a/config.m4 +++ /dev/null @@ -1,55 +0,0 @@ - PHP_ARG_WITH(varnish, for varnish support, - [ --with-varnish Include varnish support]) - -if test "$PHP_VARNISH" != "no"; then - - AC_CHECK_HEADER(fcntl.h) - AC_CHECK_HEADER(sys/types.h) - AC_CHECK_HEADER(sys/socket.h) - AC_CHECK_HEADER(netinet/in.h) - AC_CHECK_HEADER(arpa/inet.h) - AC_CHECK_HEADER(netdb.h) - - dnl # --with-varnish -> check with-path - SEARCH_PATH="$PHP_VARNISH /usr/local /usr" - SEARCH_FOR="varnishapi.h" - AC_MSG_CHECKING([for varnish files in default path]) - for i in $SEARCH_PATH ; do - if test -r $i/include/varnish/$SEARCH_FOR; then - VARNISH_INCDIR=$i/include/varnish - VARNISH_LIBDIR=$i/$PHP_LIBDIR - elif test -r $i/include/$SEARCH_FOR; then - VARNISH_INCDIR=$i/include - VARNISH_LIBDIR=$i/$PHP_LIBDIR - fi - done - - if test -z "$VARNISH_INCDIR"; then - AC_MSG_RESULT([not found]) - AC_MSG_ERROR([Please reinstall the varnish distribution]) - else - AC_MSG_RESULT(headers found in $VARNISH_INCDIR) - fi - - PHP_ADD_INCLUDE($VARNISH_INCDIR) - AC_CHECK_HEADER([$VARNISH_INCDIR/varnishapi.h], [], AC_MSG_ERROR('varnishapi.h' header not found)) - AC_CHECK_HEADER([$VARNISH_INCDIR/vcli.h], [], AC_MSG_ERROR('vcli.h' header not found)) - AC_CHECK_HEADER([$VARNISH_INCDIR/vsl.h], [], AC_MSG_ERROR('vsl.h' header not found)) - - LIBNAME=varnishapi - LIBSYMBOL=VSM_New - - PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL, - [ - PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $VARNISH_LIBDIR, VARNISH_SHARED_LIBADD) - AC_DEFINE(HAVE_VARNISHAPILIB,1,[ ]) - ],[ - AC_MSG_ERROR([wrong varnishapi lib version or lib not found]) - ],[ - -L$VARNISH_LIBDIR -lm - ]) - - PHP_SUBST(VARNISH_SHARED_LIBADD) - - PHP_NEW_EXTENSION(varnish, varnish.c adm.c varnish_lib.c sha2.c exception.c stat.c log.c, $ext_shared) -fi diff --git a/php-pecl-varnish.spec b/php-pecl-varnish.spec index e5e9987..f295600 100644 --- a/php-pecl-varnish.spec +++ b/php-pecl-varnish.spec @@ -9,33 +9,34 @@ %{!?php_inidir: %{expand: %%global php_inidir %{_sysconfdir}/php.d}} %{!?__pecl: %{expand: %%global __pecl %{_bindir}/pecl}} -%global with_zts 0%{?__ztsphp:1} -%global pecl_name varnish +%global with_zts 0%{?__ztsphp:1} +%global pecl_name varnish +%global with_tests %{?_with_tests:1}%{!?_with_tests:0} Summary: Varnish Cache bindings Name: php-pecl-%{pecl_name} -Version: 1.0.0 +Version: 1.1.0 Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} License: BSD Group: Development/Languages URL: http://pecl.php.net/package/%{pecl_name} Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz -# will be in next version -# http://svn.php.net/viewvc/pecl/varnish/trunk/LICENSE?view=co -Source1: LICENSE -# http://svn.php.net/viewvc/pecl/varnish/trunk/config.m4?view=co -Source2: config.m4 - BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: php-devel > 5.3 BuildRequires: php-pear +BuildRequires: php-hash BuildRequires: varnish-libs-devel > 3 +# For tests +%if %{with_tests} +BuildRequires: varnish +%endif Requires(post): %{__pecl} Requires(postun): %{__pecl} Requires: php(zend-abi) = %{php_zend_api} Requires: php(api) = %{php_core_api} +Requires: php-hash%{?_isa} Provides: php-%{pecl_name} = %{version} Provides: php-%{pecl_name}%{?_isa} = %{version} @@ -58,7 +59,6 @@ through TCP socket or shared memory. mv %{pecl_name}-%{version} NTS cd NTS -cp %{SOURCE1} %{SOURCE2} . # Sanity check, really often broken extver=$(sed -n '/#define PHP_VARNISH_EXT_VERSION/{s/.* "//;s/".*$//;p}' php_varnish.h) @@ -129,6 +129,8 @@ fi %check +ret=0 + : Minimal load test for NTS extension php --no-php-ini \ --define extension=NTS/modules/%{pecl_name}.so \ @@ -141,8 +143,70 @@ php --no-php-ini \ --modules | grep %{pecl_name} %endif -# Don't run upstream test suite which requires some varnish -# server and configuration +%if %{with_tests} +cd NTS + +: Run a varnish server for test suite +sed -n '/secret/{s/.* "//;s/".*$//;p}' \ + tests/config.php-dist | tail -n 1 | tee /tmp/secret + +if [ 0%{?__isa_bits} -eq 64 ]; then + PORTUSR=6085 + PORTADM=6086 +else + PORTUSR=6081 + PORTADM=6082 +fi +%{_sbindir}/varnishd \ + -b 127.0.0.1:80 \ + -P /tmp/varnish.pid \ + -S /tmp/secret \ + -s file,/tmp,1G \ + -n /tmp/vtest \ + -a :$PORTUSR \ + -T :$PORTADM + +export VARNISH_TEST_IPV4=1 +export VARNISH_TEST_IPV6=1 +export VARNISH_TEST_SECRET=1 +export VARNISH_TEST_SHM=0 + +: Upstream test suite for NTS extension +sed -e 's:/var/lib/varnish/silent:/tmp/vtest:' \ + -e "s/6081/$PORTUSR/" \ + -e "s/6082/$PORTADM/" \ + tests/config.php-dist | tee tests/config.php + +TEST_PHP_EXECUTABLE=%{_bindir}/php \ +TEST_PHP_ARGS="-n -d extension=$PWD/modules/%{pecl_name}.so" \ +NO_INTERACTION=1 \ +REPORT_EXIT_STATUS=1 \ +%{_bindir}/php -n run-tests.php || ret=1 + +%if %{with_zts} +cd ../ZTS + +: Upstream test suite for ZTS extension +sed -e 's:/var/lib/varnish/silent:/tmp/vtest:' \ + -e "s/6081/$PORTUSR/" \ + -e "s/6082/$PORTADM/" \ + tests/config.php-dist | tee tests/config.php + +TEST_PHP_EXECUTABLE=%{__ztsphp} \ +TEST_PHP_ARGS="-n -d extension=$PWD/modules/%{pecl_name}.so" \ +NO_INTERACTION=1 \ +REPORT_EXIT_STATUS=1 \ +%{__ztsphp} -n run-tests.php || ret=1 +%endif + +: Stop the test server +[ -s /tmp/varnish.pid ] && kill $(cat /tmp/varnish.pid) +rm -rf /tmp/{secret,varnish.pid,vtest} + +exit $ret +%else +: Upstream test suite disabled, missing '--with tests' option. +%endif %clean @@ -163,5 +227,12 @@ rm -rf %{buildroot} %changelog +* Wed Oct 02 2013 Remi Collet - 1.1.0-1 +- Update to 1.1.0 +- License now provided in upstream sources +- Drop merged patch for configure +- Use sha256 from hash extension instead of bundled copy +- Add option --with tests to run upstream test suite + * Mon Sep 30 2013 Remi Collet - 1.0.0-1 - initial package -- cgit