From e896d233f103cf5d0158023a5ae664dc0c4b5125 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 12 Dec 2017 13:54:44 +0100 Subject: switch from zend-loader to fedora/autoloader --- php-zendframework-zend-view.spec | 82 +++++++++++++++++++++++++++++----------- 1 file changed, 59 insertions(+), 23 deletions(-) diff --git a/php-zendframework-zend-view.spec b/php-zendframework-zend-view.spec index fb61cac..674be21 100644 --- a/php-zendframework-zend-view.spec +++ b/php-zendframework-zend-view.spec @@ -21,7 +21,7 @@ Name: php-%{gh_owner}-%{gh_project} Version: 2.9.0 -Release: 1%{?dist} +Release: 3%{?dist} Summary: Zend Framework %{library} component Group: Development/Libraries @@ -39,9 +39,9 @@ BuildRequires: php-dom BuildRequires: php-filter BuildRequires: php-pcre BuildRequires: php-spl -BuildRequires: php-composer(%{gh_owner}/zend-eventmanager) >= 2.5 -BuildRequires: php-composer(%{gh_owner}/zend-loader) >= 2.5 -BuildRequires: php-composer(%{gh_owner}/zend-stdlib) >= 2.5 +BuildRequires: php-autoloader(%{gh_owner}/zend-eventmanager) >= 2.5 +BuildRequires: php-autoloader(%{gh_owner}/zend-loader) >= 2.5 +BuildRequires: php-autoloader(%{gh_owner}/zend-stdlib) >= 2.5 # From composer, "require-dev": { # "phpunit/phpunit": "^5.7.15 || ^6.0.8", # "zendframework/zend-authentication": "^2.5", @@ -105,9 +105,9 @@ BuildRequires: php-composer(%{gh_owner}/zend-mvc-plugin-flashmessenger) BuildRequires: php-composer(%{gh_owner}/zend-mvc-i18n) BuildRequires: php-composer(%{gh_owner}/zend-mvc-console) %endif -# Autoloader -BuildRequires: php-composer(%{gh_owner}/zend-loader) >= 2.5 %endif +# Autoloader +BuildRequires: php-fedora-autoloader-devel # From composer, "require": { # "php": "^5.6 || ^7.0", @@ -116,12 +116,12 @@ BuildRequires: php-composer(%{gh_owner}/zend-loader) >= 2.5 # "zendframework/zend-stdlib": "^2.7 || ^3.0" Requires: php(language) >= 5.6 %if ! %{bootstrap} -Requires: php-composer(%{gh_owner}/zend-eventmanager) >= 2.6.2 -Requires: php-composer(%{gh_owner}/zend-eventmanager) < 4 -Requires: php-composer(%{gh_owner}/zend-loader) >= 2.5 -Requires: php-composer(%{gh_owner}/zend-loader) < 3 -Requires: php-composer(%{gh_owner}/zend-stdlib) >= 2.7 -Requires: php-composer(%{gh_owner}/zend-stdlib) < 4 +Requires: php-autoloader(%{gh_owner}/zend-eventmanager) >= 2.6.2 +Requires: php-autoloader(%{gh_owner}/zend-eventmanager) < 4 +Requires: php-autoloader(%{gh_owner}/zend-loader) >= 2.5 +Requires: php-autoloader(%{gh_owner}/zend-loader) < 3 +Requires: php-autoloader(%{gh_owner}/zend-stdlib) >= 2.7 +Requires: php-autoloader(%{gh_owner}/zend-stdlib) < 4 # From composer, "suggest": { # "zendframework/zend-authentication": "Zend\\Authentication component", # "zendframework/zend-escaper": "Zend\\Escaper component", @@ -152,6 +152,8 @@ Suggests: php-composer(%{gh_owner}/zend-servicemanager) Suggests: php-composer(%{gh_owner}/zend-uri) %endif %endif +# Autoloader +Requires: php-composer(fedora/autoloader) # From phpcompatinfo report for version 2.6.0 Requires: php-cli Requires: php-date @@ -163,6 +165,7 @@ Requires: php-spl Obsoletes: php-ZendFramework2-%{library} < 2.5 Provides: php-ZendFramework2-%{library} = %{version} Provides: php-composer(%{gh_owner}/%{gh_project}) = %{version} +Provides: php-autoloader(%{gh_owner}/%{gh_project}) = %{version} # for zf_templatemap_generator command Conflicts: php-zendframework < 2.5.3-3 @@ -182,7 +185,30 @@ mv LICENSE.md LICENSE %build -# Empty build section, nothing required +: Create autoloader +phpab --template fedora --output src/autoload.php src +cat << 'EOF' | tee -a src/autoload.php +\Fedora\Autoloader\Dependencies::required([ + '%{php_home}/Zend/EventManager/autoload.php', + '%{php_home}/Zend/Loader/autoload.php', + '%{php_home}/Zend/Stdlib/autoload.php', +]); +\Fedora\Autoloader\Dependencies::optional([ + '%{php_home}/Zend/Authentication/autoload.php', + '%{php_home}/Zend/Escaper/autoload.php', + '%{php_home}/Zend/Feed/autoload.php', + '%{php_home}/Zend/Filter/autoload.php', + '%{php_home}/Zend/Http/autoload.php', + '%{php_home}/Zend/I18n/autoload.php', + '%{php_home}/Zend/Json/autoload.php', + '%{php_home}/Zend/Mvc/autoload.php', + '%{php_home}/Zend/Navigation/autoload.php', + '%{php_home}/Zend/Paginator/autoload.php', + '%{php_home}/Zend/Permissions/Acl/autoload.php', + '%{php_home}/Zend/ServiceManager/autoload.php', + '%{php_home}/Zend/Uri/autoload.php', +]); +EOF %install @@ -204,20 +230,27 @@ rm test/Helper/UrlTest.php mkdir vendor cat << 'EOF' | tee vendor/autoload.php array( - 'namespaces' => array( - 'ZendTest\\%{library}' => dirname(__DIR__).'/test/', - 'Zend\\%{library}' => '%{buildroot}%{php_home}/Zend/%{library}' -)))); -require_once '%{php_home}/Zend/autoload.php'; +require_once '%{buildroot}%{php_home}/Zend/%{library}/autoload.php'; +# For BR without new autoloader +\Fedora\Autoloader\Dependencies::optional([ + '%{php_home}/Zend/Cache/autoload.php', + '%{php_home}/Zend/Config/autoload.php', + '%{php_home}/Zend/Console/autoload.php', + '%{php_home}/Zend/Log/autoload.php', + '%{php_home}/Zend/ModuleManager/autoload.php', + '%{php_home}/Zend/Router/autoload.php', + '%{php_home}/Zend/Serializer/autoload.php', + '%{php_home}/Zend/Session/autoload.php', + '%{php_home}/Zend/autoload.php', +]); +\Fedora\Autoloader\Autoload::addPsr4('ZendTest\\%{library}\\', dirname(__DIR__) . '/test'); EOF ret=0 -for cmd in php php56 php70 php71 php72; do +for cmd in "php %{phpunit}" "php56 %{_bindir}/phpunit" php70 php71 php72; do if which $cmd; then - $cmd %{_bindir}/phpunit || ret=1 + set $cmd + $1 ${2:-%{_bindir}/phpunit6} --verbose || ret=1 fi done exit $ret @@ -236,6 +269,9 @@ exit $ret %changelog +* Tue Dec 12 2017 Remi Collet - 2.9.0-3 +- switch from zend-loader to fedora/autoloader + * Tue Mar 21 2017 Remi Collet - 2.9.0-1 - Update to 2.9.0 - raise dependency on PHP 5.6 -- cgit