From 2f76dbeedfe837436c8d3e49dbaedcfbef132470 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 12 Dec 2017 07:52:39 +0100 Subject: switch from zend-loader to fedora/autoloader --- php-zendframework-zend-db.spec | 51 +++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/php-zendframework-zend-db.spec b/php-zendframework-zend-db.spec index f5e2f73..3643cc6 100644 --- a/php-zendframework-zend-db.spec +++ b/php-zendframework-zend-db.spec @@ -42,16 +42,16 @@ BuildRequires: php-date BuildRequires: php-pcre BuildRequires: php-pdo BuildRequires: php-spl -BuildRequires: php-composer(%{gh_owner}/zend-stdlib) >= 2.7 +BuildRequires: php-autoloader(%{gh_owner}/zend-stdlib) >= 2.7 # From composer, "require-dev": { # "phpunit/phpunit": "^5.7.25 || ^6.4.4", # "zendframework/zend-coding-standard": "~1.0.0", # "zendframework/zend-eventmanager": "^2.6.2 || ^3.0", # "zendframework/zend-hydrator": ""^1.1 || ^2.1", # "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3" -BuildRequires: php-composer(%{gh_owner}/zend-eventmanager) >= 2.6.2 -BuildRequires: php-composer(%{gh_owner}/zend-hydrator) >= 1.1 -BuildRequires: php-composer(%{gh_owner}/zend-servicemanager) >= 2.7.5 +BuildRequires: php-autoloader(%{gh_owner}/zend-eventmanager) >= 2.6.2 +BuildRequires: php-autoloader(%{gh_owner}/zend-hydrator) >= 1.1 +BuildRequires: php-autoloader(%{gh_owner}/zend-servicemanager) >= 2.7.5 %if 0%{?fedora} >= 26 %global phpunit %{_bindir}/phpunit6 BuildRequires: phpunit6 >= 6.4.4 @@ -59,26 +59,28 @@ BuildRequires: phpunit6 >= 6.4.4 %global phpunit %{_bindir}/phpunit BuildRequires: php-phpunit-PHPUnit >= 5.7.25 %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", # "zendframework/zend-stdlib": "^2.7 || ^3.0" Requires: php(language) >= 5.6 %if ! %{bootstrap} -Requires: php-composer(%{gh_owner}/zend-stdlib) >= 2.7 -Requires: php-composer(%{gh_owner}/zend-stdlib) < 4 +Requires: php-autoloader(%{gh_owner}/zend-stdlib) >= 2.7 +Requires: php-autoloader(%{gh_owner}/zend-stdlib) < 4 # From composer, "suggest": { # "zendframework/zend-eventmanager": "Zend\\EventManager component", # "zendframework/zend-servicemanager": "Zend\\ServiceManager component" %if 0%{?fedora} >= 21 -Suggests: php-composer(%{gh_owner}/zend-eventmanager) -Suggests: php-composer(%{gh_owner}/zend-hydrator) -Suggests: php-composer(%{gh_owner}/zend-servicemanager) +Suggests: php-autoloader(%{gh_owner}/zend-eventmanager) +Suggests: php-autoloader(%{gh_owner}/zend-hydrator) +Suggests: php-autoloader(%{gh_owner}/zend-servicemanager) %endif %endif +# Autoloader +Requires: php-composer(fedora/autoloader) # From phpcompatinfo report for version 2.6.2 Requires: php-date Requires: php-pcre @@ -88,6 +90,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} %description @@ -106,7 +109,18 @@ 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([ + '%{php_home}/Zend/Stdlib/autoload.php', +]); +\Fedora\Autoloader\Dependencies::optional([ + '%{php_home}/Zend/EventManager/autoload.php', + '%{php_home}/Zend/Hydrator/autoload.php', + '%{php_home}/Zend/ServiceManager/autoload.php', +]); +EOF %install @@ -121,14 +135,8 @@ 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 @@ -153,6 +161,9 @@ exit $ret %changelog +* Mon Dec 11 2017 Remi Collet - 2.9.1-2 +- switch from zend-loader to fedora/autoloader + * Fri Dec 8 2017 Remi Collet - 2.9.1-1 - Update to 2.9.1 -- cgit