From c3080cca3dbf93f8700dab746a78309eb8905985 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 13 Dec 2017 12:04:48 +0100 Subject: switch from zend-loader to fedora/autoloader --- php-zendframework-zend-test.spec | 136 +++++++++++++++++++++++---------------- 1 file changed, 81 insertions(+), 55 deletions(-) diff --git a/php-zendframework-zend-test.spec b/php-zendframework-zend-test.spec index 9d47834..7ab42ab 100644 --- a/php-zendframework-zend-test.spec +++ b/php-zendframework-zend-test.spec @@ -21,7 +21,7 @@ Name: php-%{gh_owner}-%{gh_project} Version: 3.1.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Zend Framework %{library} component Group: Development/Libraries @@ -37,15 +37,15 @@ BuildRequires: php(language) >= 5.6 BuildRequires: php-composer(phpunit/phpunit) >= 4.0 BuildRequires: phpunit6 BuildRequires: php-pcre -BuildRequires: php-composer(%{gh_owner}/zend-console) >= 2.6 -BuildRequires: php-composer(%{gh_owner}/zend-dom) >= 2.6 -BuildRequires: php-composer(%{gh_owner}/zend-eventmanager) >= 2.6.2 -BuildRequires: php-composer(%{gh_owner}/zend-http) >= 2.5.4 -BuildRequires: php-composer(%{gh_owner}/zend-mvc) >= 3.0 -BuildRequires: php-composer(%{gh_owner}/zend-servicemanager) >= 2.7.5 -BuildRequires: php-composer(%{gh_owner}/zend-stdlib) >= 2.7 -BuildRequires: php-composer(%{gh_owner}/zend-uri) >= 2.5 -BuildRequires: php-composer(%{gh_owner}/zend-view) >= 2.6.3 +BuildRequires: php-autoloader(%{gh_owner}/zend-console) >= 2.6 +BuildRequires: php-autoloader(%{gh_owner}/zend-dom) >= 2.6 +BuildRequires: php-autoloader(%{gh_owner}/zend-eventmanager) >= 2.6.2 +BuildRequires: php-autoloader(%{gh_owner}/zend-http) >= 2.5.4 +BuildRequires: php-autoloader(%{gh_owner}/zend-mvc) >= 3.0 +BuildRequires: php-autoloader(%{gh_owner}/zend-servicemanager) >= 2.7.5 +BuildRequires: php-autoloader(%{gh_owner}/zend-stdlib) >= 2.7 +BuildRequires: php-autoloader(%{gh_owner}/zend-uri) >= 2.5 +BuildRequires: php-autoloader(%{gh_owner}/zend-view) >= 2.6.3 # From composer, "require-dev": { # "mikey179/vfsStream": "~1.2", # "symfony/finder": "^2.2", @@ -59,17 +59,18 @@ BuildRequires: php-composer(%{gh_owner}/zend-view) >= 2.6.3 # "zendframework/zend-session": "^2.6.2", # "zendframework/zend-validator": "^2.8" BuildRequires: php-composer(mikey179/vfsStream) >= 1.2 -BuildRequires: php-composer(%{gh_owner}/zend-i18n) >= 2.6 -BuildRequires: php-composer(%{gh_owner}/zend-log) >= 2.7.1 -BuildRequires: php-composer(%{gh_owner}/zend-modulemanager) >= 2.7.1 -BuildRequires: php-composer(%{gh_owner}/zend-serializer) >= 2.6.1 -BuildRequires: php-composer(%{gh_owner}/zend-session) >= 2.6.2 -BuildRequires: php-composer(%{gh_owner}/zend-mvc-plugin-flashmessenger) >= 0.1.0 -BuildRequires: php-composer(%{gh_owner}/zend-mvc-console) >= 1.1.8 -BuildRequires: php-composer(%{gh_owner}/zend-validator) >= 2.8 -# Autoloader -BuildRequires: php-composer(%{gh_owner}/zend-loader) >= 2.5 +BuildRequires: php-symfony-finder +BuildRequires: php-autoloader(%{gh_owner}/zend-i18n) >= 2.6 +BuildRequires: php-autoloader(%{gh_owner}/zend-log) >= 2.7.1 +BuildRequires: php-autoloader(%{gh_owner}/zend-modulemanager) >= 2.7.1 +BuildRequires: php-autoloader(%{gh_owner}/zend-mvc-console) >= 1.1.8 +BuildRequires: php-autoloader(%{gh_owner}/zend-mvc-plugin-flashmessenger) >= 0.1.0 +BuildRequires: php-autoloader(%{gh_owner}/zend-serializer) >= 2.6.1 +BuildRequires: php-autoloader(%{gh_owner}/zend-session) >= 2.6.2 +BuildRequires: php-autoloader(%{gh_owner}/zend-validator) >= 2.8 %endif +# Autoloader +BuildRequires: php-fedora-autoloader-devel # From composer, "require": { # "php": "^5.6 || ^7.0", @@ -94,31 +95,34 @@ Requires: php-composer(phpunit/phpunit) >= 4.0 Requires: php-composer(sebastian/version) >= 1.0.4 Requires: php-composer(sebastian/version) < 3 %if ! %{bootstrap} -Requires: php-composer(%{gh_owner}/zend-console) >= 2.6 -Requires: php-composer(%{gh_owner}/zend-console) < 3 -Requires: php-composer(%{gh_owner}/zend-dom) >= 2.6 -Requires: php-composer(%{gh_owner}/zend-dom) < 3 -Requires: php-composer(%{gh_owner}/zend-eventmanager) >= 2.6.2 -Requires: php-composer(%{gh_owner}/zend-eventmanager) < 4 -Requires: php-composer(%{gh_owner}/zend-http) >= 2.5.4 -Requires: php-composer(%{gh_owner}/zend-http) < 3 -Requires: php-composer(%{gh_owner}/zend-mvc) >= 3.0 -Requires: php-composer(%{gh_owner}/zend-mvc) < 4 -Requires: php-composer(%{gh_owner}/zend-servicemanager) >= 2.7.5 -Requires: php-composer(%{gh_owner}/zend-servicemanager) < 4 -Requires: php-composer(%{gh_owner}/zend-stdlib) >= 2.7 -Requires: php-composer(%{gh_owner}/zend-stdlib) < 4 -Requires: php-composer(%{gh_owner}/zend-uri) >= 2.5 -Requires: php-composer(%{gh_owner}/zend-uri) < 3 -Requires: php-composer(%{gh_owner}/zend-view) >= 2.6.3 -Requires: php-composer(%{gh_owner}/zend-view) < 3 +Requires: php-autoloader(%{gh_owner}/zend-console) >= 2.6 +Requires: php-autoloader(%{gh_owner}/zend-console) < 3 +Requires: php-autoloader(%{gh_owner}/zend-dom) >= 2.6 +Requires: php-autoloader(%{gh_owner}/zend-dom) < 3 +Requires: php-autoloader(%{gh_owner}/zend-eventmanager) >= 2.6.2 +Requires: php-autoloader(%{gh_owner}/zend-eventmanager) < 4 +Requires: php-autoloader(%{gh_owner}/zend-http) >= 2.5.4 +Requires: php-autoloader(%{gh_owner}/zend-http) < 3 +Requires: php-autoloader(%{gh_owner}/zend-mvc) >= 3.0 +Requires: php-autoloader(%{gh_owner}/zend-mvc) < 4 +Requires: php-autoloader(%{gh_owner}/zend-servicemanager) >= 2.7.5 +Requires: php-autoloader(%{gh_owner}/zend-servicemanager) < 4 +Requires: php-autoloader(%{gh_owner}/zend-stdlib) >= 2.7 +Requires: php-autoloader(%{gh_owner}/zend-stdlib) < 4 +Requires: php-autoloader(%{gh_owner}/zend-uri) >= 2.5 +Requires: php-autoloader(%{gh_owner}/zend-uri) < 3 +Requires: php-autoloader(%{gh_owner}/zend-view) >= 2.6.3 +Requires: php-autoloader(%{gh_owner}/zend-view) < 3 %endif +# Autoloader +Requires: php-composer(fedora/autoloader) # From phpcompatinfo report for version 2.5.1 Requires: php-pcre 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 @@ -134,7 +138,11 @@ Documentation: https://zendframework.github.io/%{gh_project}/ %prep %setup -q -n %{gh_project}-%{gh_commit} -: Create dependency autoloader +mv LICENSE.md LICENSE + + +%build +: Create dependency autoloader - deprecated mv autoload/*.php src cat << 'EOF' | tee autoload.php @@ -142,11 +150,22 @@ cat << 'EOF' | tee autoload.php require_once __DIR__ . '/%{library}/phpunit-class-aliases.php'; EOF -mv LICENSE.md LICENSE - - -%build -# Empty build section, nothing required +: Generate autoloader +phpab --template fedora --output src/autoload.php src +cat << 'EOF' | tee -a src/autoload.php +\Fedora\Autoloader\Dependencies::required([ + __DIR__ . '/phpunit-class-aliases.php', + '%{php_home}/Zend/Console/autoload.php', + '%{php_home}/Zend/Dom/autoload.php', + '%{php_home}/Zend/EventManager/autoload.php', + '%{php_home}/Zend/Http/autoload.php', + '%{php_home}/Zend/Mvc/autoload.php', + '%{php_home}/Zend/ServiceManager/autoload.php', + '%{php_home}/Zend/Stdlib/autoload.php', + '%{php_home}/Zend/Uri/autoload.php', + '%{php_home}/Zend/View/autoload.php', +]); +EOF %install @@ -161,19 +180,23 @@ install -m644 autoload.php %{buildroot}%{php_home}/Zend/%{library}-autoload.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'; +\Fedora\Autoloader\Dependencies::required([ + '%{php_home}/org/bovigo/vfs/autoload.php', + '%{php_home}/Symfony/Component/Finder/autoload.php', + '%{php_home}/Zend/I18n/autoload.php', + '%{php_home}/Zend/Log/autoload.php', + '%{php_home}/Zend/ModuleManager/autoload.php', + '%{php_home}/Zend/Serializer/autoload.php', + '%{php_home}/Zend/Mvc/Console/autoload.php', + '%{php_home}/Zend/Mvc/Plugin/FlashMessenger/autoload.php', + '%{php_home}/Zend/Serializer/autoload.php', + '%{php_home}/Zend/Session/autoload.php', + '%{php_home}/Zend/Validator/autoload.php', +]); +\Fedora\Autoloader\Autoload::addPsr4('ZendTest\\%{library}\\', dirname(__DIR__) . '/test'); EOF -# 7.2: https://github.com/zendframework/zend-session/issues/74 ret=0 for cmd in php php56 php70 php71 php72; do if which $cmd; then @@ -201,6 +224,9 @@ exit $ret %changelog +* Wed Dec 13 2017 Remi Collet - 3.1.1-2 +- switch from zend-loader to fedora/autoloader + * Mon Oct 30 2017 Remi Collet - 3.1.1-1 - Update to 3.1.1 - add autoloader for class aliases -- cgit