[php-pecl-zendopcache/el6] update to 7.0.3 + cleanups

Remi Collet remi at fedoraproject.org
Mon Jan 20 14:47:42 UTC 2014


commit 5a64264876bd08f091e657502e291902943923d5
Author: Remi Collet <remi at fedoraproject.org>
Date:   Mon Jan 20 15:47:57 2014 +0100

    update to 7.0.3 +  cleanups

 .gitignore                |    1 +
 blacklist.inc             |    3 ++
 php-pecl-zendopcache.spec |   66 +++++++++------------------------------------
 php_cli_server.inc        |   47 ++++++++++++++++++++++++++++++++
 sources                   |    2 +-
 5 files changed, 65 insertions(+), 54 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index eccc3d8..7bae11b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 *spec~
 /zendopcache-7.0.1.tgz
 /zendopcache-7.0.2.tgz
+/zendopcache-7.0.3.tgz
diff --git a/blacklist.inc b/blacklist.inc
new file mode 100644
index 0000000..a9db751
--- /dev/null
+++ b/blacklist.inc
@@ -0,0 +1,3 @@
+<?php
+	echo "ok\n";
+?>
diff --git a/php-pecl-zendopcache.spec b/php-pecl-zendopcache.spec
index 2550cac..61e6f0a 100644
--- a/php-pecl-zendopcache.spec
+++ b/php-pecl-zendopcache.spec
@@ -1,6 +1,6 @@
 # spec file for php-pecl-zendopcache
 #
-# Copyright (c) 2013 Remi Collet
+# Copyright (c) 2013-2014 Remi Collet
 # License: CC-BY-SA
 # http://creativecommons.org/licenses/by-sa/3.0/
 #
@@ -9,13 +9,12 @@
 %{!?php_inidir: %{expand: %%global php_inidir %{_sysconfdir}/php.d}}
 %{!?__php:      %{expand: %%global __php      %{_bindir}/php}}
 %{!?__pecl:     %{expand: %%global __pecl     %{_bindir}/pecl}}
-%global with_zts   0%{?__ztsphp:1}
 %global proj_name  ZendOpcache
 %global pecl_name  zendopcache
 %global plug_name  opcache
 
 Name:          php-pecl-%{pecl_name}
-Version:       7.0.2
+Version:       7.0.3
 Release:       1%{?dist}
 Summary:       The Zend OPcache
 
@@ -28,6 +27,11 @@ Source0:       http://pecl.php.net/get/%{pecl_name}-%{version}.tgz
 Source1:       %{plug_name}.ini
 Source2:       %{plug_name}-default.blacklist
 
+# Missing in archive
+# https://github.com/zendtech/ZendOptimizerPlus/issues/162
+Source3:       https://raw2.github.com/zendtech/ZendOptimizerPlus/e8e28cd95c8aa660c28c2166da679b50deb50faa/tests/blacklist.inc
+Source4:       https://raw2.github.com/zendtech/ZendOptimizerPlus/e8e28cd95c8aa660c28c2166da679b50deb50faa/tests/php_cli_server.inc
+
 BuildRequires: php-devel >= 5.2.0
 BuildRequires: php-pear
 
@@ -63,20 +67,7 @@ bytecode optimization patterns that make code execution faster.
 %setup -q -c
 mv %{pecl_name}-%{version} NTS
 
-cd NTS
-
-# Sanity check, really often broken
-extver=$(sed -n '/#define ACCELERATOR_VERSION/{s/.* "//;s/".*$//;p}' ZendAccelerator.h)
-if test "x${extver}" != "x%{version}%{?prever:-%{prever}}"; then
-   : Error: Upstream extension version is ${extver}, expecting %{version}%{?prever:-%{prever}}.
-   exit 1
-fi
-cd ..
-
-%if %{with_zts}
-# Duplicate source tree for NTS / ZTS build
-cp -pr NTS ZTS
-%endif
+cp %{SOURCE3} %{SOURCE4} NTS/tests/
 
 
 %build
@@ -87,15 +78,6 @@ cd NTS
     --with-php-config=%{_bindir}/php-config
 make %{?_smp_mflags}
 
-%if %{with_zts}
-cd ../ZTS
-%{_bindir}/zts-phpize
-%configure \
-    --enable-optimizer-plus \
-    --with-php-config=%{_bindir}/zts-php-config
-make %{?_smp_mflags}
-%endif
-
 
 %install
 install -D -p -m 644 %{SOURCE1} %{buildroot}%{php_inidir}/%{plug_name}.ini
@@ -104,14 +86,6 @@ sed -e 's:@EXTPATH@:%{php_extdir}:' \
 
 make -C NTS install INSTALL_ROOT=%{buildroot}
 
-%if %{with_zts}
-install -D -p -m 644 %{SOURCE1} %{buildroot}%{php_ztsinidir}/%{plug_name}.ini
-sed -e 's:@EXTPATH@:%{php_ztsextdir}:' \
-    -i %{buildroot}%{php_ztsinidir}/%{plug_name}.ini
-
-make -C ZTS install INSTALL_ROOT=%{buildroot}
-%endif
-
 # The default Zend OPcache blacklist file
 install -D -p -m 644 %{SOURCE2} %{buildroot}%{php_inidir}/%{plug_name}-default.blacklist
 
@@ -131,19 +105,6 @@ NO_INTERACTION=1 \
 REPORT_EXIT_STATUS=1 \
 %{__php} -n run-tests.php
 
-%if %{with_zts}
-cd ../ZTS
-%{__ztsphp} \
-    -n -d zend_extension=%{buildroot}%{php_ztsextdir}/%{plug_name}.so \
-    -m | grep "Zend OPcache"
-
-TEST_PHP_EXECUTABLE=%{__ztsphp} \
-TEST_PHP_ARGS="-n -d zend_extension=%{buildroot}%{php_ztsextdir}/%{plug_name}.so" \
-NO_INTERACTION=1 \
-REPORT_EXIT_STATUS=1 \
-%{__ztsphp} -n run-tests.php
-%endif
-
 
 %post
 %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || :
@@ -160,16 +121,15 @@ fi
 %config(noreplace) %{php_inidir}/%{plug_name}-default.blacklist
 %config(noreplace) %{php_inidir}/%{plug_name}.ini
 %{php_extdir}/%{plug_name}.so
-
-%if %{with_zts}
-%config(noreplace) %{php_ztsinidir}/%{plug_name}.ini
-%{php_ztsextdir}/%{plug_name}.so
-%endif
-
 %{pecl_xmldir}/%{name}.xml
 
 
 %changelog
+* Mon Jan 20 2014 Remi Collet <rcollet at redhat.com> - 7.0.3-1
+- Update to 7.0.3
+- open https://github.com/zendtech/ZendOptimizerPlus/issues/162
+- cleanup the zts stuff
+
 * Wed Jun  5 2013 Remi Collet <rcollet at redhat.com> - 7.0.2-1
 - update to 7.0.2
 - add spec License = CC-BY-SA
diff --git a/php_cli_server.inc b/php_cli_server.inc
new file mode 100644
index 0000000..0878bfa
--- /dev/null
+++ b/php_cli_server.inc
@@ -0,0 +1,47 @@
+<?php
+define ("PHP_CLI_SERVER_HOSTNAME", "localhost");
+define ("PHP_CLI_SERVER_PORT", 8964);
+define ("PHP_CLI_SERVER_ADDRESS", PHP_CLI_SERVER_HOSTNAME.":".PHP_CLI_SERVER_PORT);
+
+function php_cli_server_start($ini = "") {
+	$php_executable = getenv('TEST_PHP_EXECUTABLE');
+	$doc_root = __DIR__;
+
+	$descriptorspec = array(
+		0 => STDIN,
+		1 => STDOUT,
+		2 => STDERR,
+	);
+
+	if (substr(PHP_OS, 0, 3) == 'WIN') {
+		$cmd = "{$php_executable} -t {$doc_root} $ini -S " . PHP_CLI_SERVER_ADDRESS;
+		$handle = proc_open(addslashes($cmd), $descriptorspec, $pipes, $doc_root, NULL, array("bypass_shell" => true,  "suppress_errors" => true));
+	} else {
+		$cmd = "exec {$php_executable} -t {$doc_root} $ini -S " . PHP_CLI_SERVER_ADDRESS . " 2>/dev/null";
+		$handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root);
+	}
+	
+	// note: even when server prints 'Listening on localhost:8964...Press Ctrl-C to quit.'
+	//       it might not be listening yet...need to wait until fsockopen() call returns
+    $i = 0;
+    while (($i++ < 30) && !($fp = @fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT))) {
+        usleep(10000);
+    }
+
+    if ($fp) {
+        fclose($fp);
+    }
+
+	register_shutdown_function(
+		function($handle) {
+			proc_terminate($handle);
+		},
+			$handle
+		);
+	// don't bother sleeping, server is already up
+	// server can take a variable amount of time to be up, so just sleeping a guessed amount of time
+	// does not work. this is why tests sometimes pass and sometimes fail. to get a reliable pass
+	// sleeping doesn't work.
+}
+?>
+
diff --git a/sources b/sources
index 42fb163..9184a23 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-a175166ac32544051bd3277cc00a7b5d  zendopcache-7.0.2.tgz
+a25679504ae75bf0813acafc99991a95  zendopcache-7.0.3.tgz


More information about the scm-commits mailing list