From 422951e88825496a715ef801e28e549fcbb590e3 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 28 Nov 2017 09:29:21 +0100 Subject: switch from zend-loader to fedora/autoloader --- php-zendframework-zend-code.spec | 44 ++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/php-zendframework-zend-code.spec b/php-zendframework-zend-code.spec index 47c81c2..7979315 100644 --- a/php-zendframework-zend-code.spec +++ b/php-zendframework-zend-code.spec @@ -21,7 +21,7 @@ Name: php-%{gh_owner}-%{gh_project} Version: 3.3.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Zend Framework %{library} component Group: Development/Libraries @@ -38,7 +38,7 @@ BuildRequires: php-pcre BuildRequires: php-reflection BuildRequires: php-spl BuildRequires: php-tokenizer -BuildRequires: php-composer(%{gh_owner}/zend-eventmanager) >= 2.6 +BuildRequires: php-autoloader(%{gh_owner}/zend-eventmanager) >= 2.6 # From composer, "require-dev": { # "ext-phar": "*", # "doctrine/annotations": "~1.0", @@ -47,26 +47,28 @@ BuildRequires: php-composer(%{gh_owner}/zend-eventmanager) >= 2.6 # "phpunit/phpunit": "^6.2.3", # "zendframework/zend-coding-standard": "^1.0.0" BuildRequires: php-composer(doctrine/annotations) >= 1.0 -BuildRequires: php-composer(%{gh_owner}/zend-stdlib) >= 2.7 +BuildRequires: php-autoloader(%{gh_owner}/zend-stdlib) >= 2.7 BuildRequires: phpunit6 >= 6.2.3 -# Autoloader -BuildRequires: php-composer(%{gh_owner}/zend-loader) >= 2.5 %endif +# Autoloader +BuildRequires: php-fedora-autoloader-devel # From composer, "require": { # "php": "^7.1", # "zendframework/zend-eventmanager": "^2.6 || ^3.0"" Requires: php(language) >= 7.1 %if ! %{bootstrap} -Requires: php-composer(%{gh_owner}/zend-eventmanager) >= 2.6 -Requires: php-composer(%{gh_owner}/zend-eventmanager) < 4 +Requires: php-autoloader(%{gh_owner}/zend-eventmanager) >= 2.6 +Requires: php-autoloader(%{gh_owner}/zend-eventmanager) < 4 # From composer, "suggest": { # "doctrine/annotations": "Doctrine\\Common\\Annotations >=1.0 for annotation features", # "zendframework/zend-stdlib": "Zend\\Stdlib component" %if 0%{?fedora} >= 21 Suggests: php-composer(doctrine/annotations) -Suggests: php-composer(%{gh_owner}/zend-stdlib) +Suggests: php-autoloader(%{gh_owner}/zend-stdlib) %endif +# Autoloader +Requires: php-composer(fedora/autoloader) %endif # From phpcompatinfo report for version 2.6.2 Requires: php-pcre @@ -77,6 +79,7 @@ Requires: php-tokenizer 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} %description @@ -97,7 +100,17 @@ 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', +]); +\Fedora\Autoloader\Dependencies::optional([ + '%{php_home}/Doctrine/Common/Annotations/autoload.php', + '%{php_home}/Zend/Stdlib/autoload.php', +]); +EOF %install @@ -110,14 +123,8 @@ cp -pr src %{buildroot}%{php_home}/Zend/%{library} 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'; +\Fedora\Autoloader\Autoload::addPsr4('ZendTest\\%{library}\\', dirname(__DIR__) . '/test'); EOF ret=0 @@ -141,6 +148,9 @@ exit $ret %changelog +* Tue Nov 28 2017 Remi Collet - 3.3.0-2 +- switch from zend-loader to fedora/autoloader + * Sat Oct 21 2017 Remi Collet - 3.3.0-1 - Update to 3.3.0 -- cgit