From 0f0fc523d603b2d936a1b046647a23dde1d236fe Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 11 Dec 2017 13:51:10 +0100 Subject: switch from zend-loader to fedora/autoloader --- php-zendframework-zend-file.spec | 64 +++++++++++++++++++++++++--------------- 1 file changed, 40 insertions(+), 24 deletions(-) diff --git a/php-zendframework-zend-file.spec b/php-zendframework-zend-file.spec index 769a42b..d78bdc8 100644 --- a/php-zendframework-zend-file.spec +++ b/php-zendframework-zend-file.spec @@ -21,7 +21,7 @@ Name: php-%{gh_owner}-%{gh_project} Version: 2.7.1 -Release: 1%{?dist} +Release: 4%{?dist} Summary: Zend Framework %{library} component Group: Development/Libraries @@ -39,7 +39,7 @@ BuildRequires: php-hash BuildRequires: php-pcre BuildRequires: php-spl BuildRequires: php-tokenizer -BuildRequires: php-composer(%{gh_owner}/zend-stdlib) >= 2.5 +BuildRequires: php-autoloader(%{gh_owner}/zend-stdlib) >= 2.5 # From composer, "require-dev": { # "fabpot/php-cs-fixer": "1.7.*", # "phpunit/phpunit": "~4.0", @@ -50,34 +50,36 @@ BuildRequires: php-composer(%{gh_owner}/zend-stdlib) >= 2.5 # "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3", # "zendframework/zend-session": "^2.6.2", # "zendframework/zend-validator": "^2.6" -BuildRequires: php-composer(%{gh_owner}/zend-filter) >= 2.6.1 -BuildRequires: php-composer(%{gh_owner}/zend-i18n) >= 2.6 -BuildRequires: php-composer(%{gh_owner}/zend-progressbar) >= 2.5.2 -BuildRequires: php-composer(%{gh_owner}/zend-servicemanager) >= 2.7.5 -BuildRequires: php-composer(%{gh_owner}/zend-session) >= 2.6.2 -BuildRequires: php-composer(%{gh_owner}/zend-validator) >= 2.6 +BuildRequires: php-autoloader(%{gh_owner}/zend-filter) >= 2.6.1 +BuildRequires: php-autoloader(%{gh_owner}/zend-i18n) >= 2.6 +BuildRequires: php-autoloader(%{gh_owner}/zend-progressbar) >= 2.5.2 +BuildRequires: php-autoloader(%{gh_owner}/zend-servicemanager) >= 2.7.5 +BuildRequires: php-autoloader(%{gh_owner}/zend-session) >= 2.6.2 +BuildRequires: php-autoloader(%{gh_owner}/zend-validator) >= 2.6 BuildRequires: php-composer(phpunit/phpunit) >= 4.0 -# Autoloader -BuildRequires: php-composer(%{gh_owner}/zend-loader) >= 2.5 %endif +# Autoloader +BuildRequires: php-fedora-autoloader-devel # From composer, "require": { # "php": "^5.5 || ^7.0", # "zendframework/zend-stdlib": "^2.7 || ^3.0" Requires: php(language) >= 5.5 %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-filter": "Zend\\Filter component", # "zendframework/zend-i18n": "Zend\\I18n component", # "zendframework/zend-validator": "Zend\\Validator component" %if 0%{?fedora} >= 21 -Suggests: php-composer(%{gh_owner}/zend-filter) -Suggests: php-composer(%{gh_owner}/zend-i18n) -Suggests: php-composer(%{gh_owner}/zend-validator) +Suggests: php-autoloader(%{gh_owner}/zend-filter) +Suggests: php-autoloader(%{gh_owner}/zend-i18n) +Suggests: php-autoloader(%{gh_owner}/zend-validator) %endif %endif +# Autoloader +Requires: php-composer(fedora/autoloader) # From phpcompatinfo report for version 2.6.0 Requires: php-fileinfo Requires: php-hash @@ -89,6 +91,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 @@ -104,7 +107,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/ProgressBar/autoload.php', + '%{php_home}/Zend/I18n/autoload.php', + '%{php_home}/Zend/Validator/autoload.php', +]); +EOF %install @@ -117,14 +131,13 @@ 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\Dependencies::required([ + '%{php_home}/Zend/Filter/autoload.php', + '%{php_home}/Zend/ServiceManager/autoload.php', + '%{php_home}/Zend/Session/autoload.php', +]); +\Fedora\Autoloader\Autoload::addPsr4('ZendTest\\%{library}\\', dirname(__DIR__) . '/test'); EOF ret=0 @@ -148,6 +161,9 @@ exit $ret %changelog +* Mon Dec 11 2017 Remi Collet - 2.7.1-4 +- switch from zend-loader to fedora/autoloader + * Wed Jan 11 2017 Remi Collet - 2.7.1-1 - update to 2.7.1 -- cgit