From 3a5c839916b4c60813efb943316adabb22ccd103 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 13 Dec 2017 12:21:21 +0100 Subject: switch from zend-loader to fedora/autoloader --- php-zendframework-zend-form.spec | 115 ++++++++++++++++++++++++--------------- 1 file changed, 70 insertions(+), 45 deletions(-) diff --git a/php-zendframework-zend-form.spec b/php-zendframework-zend-form.spec index 3a813ab..47e6b1e 100644 --- a/php-zendframework-zend-form.spec +++ b/php-zendframework-zend-form.spec @@ -23,7 +23,7 @@ Name: php-%{gh_owner}-%{gh_project} Version: 2.11.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Zend Framework %{library} component Group: Development/Libraries @@ -42,9 +42,9 @@ BuildRequires: php-pcre BuildRequires: php-spl # Temporary, see https://github.com/zendframework/zend-math/issues/23 BuildRequires: php-mcrypt -BuildRequires: php-composer(%{gh_owner}/zend-inputfilter) >= 2.8 -BuildRequires: php-composer(%{gh_owner}/zend-hydrator) >= 1.0 -BuildRequires: php-composer(%{gh_owner}/zend-stdlib) >= 2.7 +BuildRequires: php-autoloader(%{gh_owner}/zend-inputfilter) >= 2.8 +BuildRequires: php-autoloader(%{gh_owner}/zend-hydrator) >= 1.0 +BuildRequires: php-autoloader(%{gh_owner}/zend-stdlib) >= 2.7 # From composer, "require-dev": { # "doctrine/annotations": "~1.0", # "zendframework/zend-cache": "^2.6.1", @@ -63,18 +63,18 @@ BuildRequires: php-composer(%{gh_owner}/zend-stdlib) >= 2.7 # "phpunit/phpunit": "^5.7.23 || ^6.5.3", # "zendframework/zend-coding-standard": "~1.0.0" BuildRequires: php-composer(doctrine/annotations) >= 1.0 -BuildRequires: php-composer(%{gh_owner}/zend-cache) >= 2.6.1 -BuildRequires: php-composer(%{gh_owner}/zend-captcha) >= 2.7.1 -BuildRequires: php-composer(%{gh_owner}/zend-code) >= 2.6 -BuildRequires: php-composer(%{gh_owner}/zend-escaper) >= 2.5 -BuildRequires: php-composer(%{gh_owner}/zend-eventmanager) >= 2.6.2 -BuildRequires: php-composer(%{gh_owner}/zend-filter) >= 2.6 -BuildRequires: php-composer(%{gh_owner}/zend-i18n) >= 2.6 -BuildRequires: php-composer(%{gh_owner}/zend-servicemanager) >= 2.7.5 -BuildRequires: php-composer(%{gh_owner}/zend-session) >= 2.8.1 -BuildRequires: php-composer(%{gh_owner}/zend-text) >= 2.6 -BuildRequires: php-composer(%{gh_owner}/zend-validator) >= 2.6 -BuildRequires: php-composer(%{gh_owner}/zend-view) >= 2.6.2 +BuildRequires: php-autoloader(%{gh_owner}/zend-cache) >= 2.6.1 +BuildRequires: php-autoloader(%{gh_owner}/zend-captcha) >= 2.7.1 +BuildRequires: php-autoloader(%{gh_owner}/zend-code) >= 2.6 +BuildRequires: php-autoloader(%{gh_owner}/zend-escaper) >= 2.5 +BuildRequires: php-autoloader(%{gh_owner}/zend-eventmanager) >= 2.6.2 +BuildRequires: php-autoloader(%{gh_owner}/zend-filter) >= 2.6 +BuildRequires: php-autoloader(%{gh_owner}/zend-i18n) >= 2.6 +BuildRequires: php-autoloader(%{gh_owner}/zend-servicemanager) >= 2.7.5 +BuildRequires: php-autoloader(%{gh_owner}/zend-session) >= 2.8.1 +BuildRequires: php-autoloader(%{gh_owner}/zend-text) >= 2.6 +BuildRequires: php-autoloader(%{gh_owner}/zend-validator) >= 2.6 +BuildRequires: php-autoloader(%{gh_owner}/zend-view) >= 2.6.2 %if 0 %global phpunit %{_bindir}/phpunit6 BuildRequires: phpunit6 >= 6.5.3 @@ -84,11 +84,9 @@ BuildRequires: php-phpunit-PHPUnit >= 5.7.23 %endif # Missing BuildRequires: php-composer(ircmaxell/random-lib) -# Autoloader -#BuildRequires: php-composer(%{gh_owner}/zend-loader) >= 2.5 -# For dependencies autoloader -BuildRequires: php-zendframework-zend-loader >= 2.5.1-3 %endif +# Autoloader +BuildRequires: php-fedora-autoloader-devel # From composer, "require": { # "php": "^5.6 || ^7.0", @@ -97,12 +95,12 @@ BuildRequires: php-zendframework-zend-loader >= 2.5.1-3 # "zendframework/zend-stdlib": "^2.7 || ^3.0" Requires: php(language) >= 5.6 %if ! %{bootstrap} -Requires: php-composer(%{gh_owner}/zend-inputfilter) >= 2.8 -Requires: php-composer(%{gh_owner}/zend-inputfilter) < 3 -Requires: php-composer(%{gh_owner}/zend-hydrator) >= 1.1 -Requires: php-composer(%{gh_owner}/zend-hydrator) < 3 -Requires: php-composer(%{gh_owner}/zend-stdlib) >= 2.7 -Requires: php-composer(%{gh_owner}/zend-stdlib) < 4 +Requires: php-autoloader(%{gh_owner}/zend-inputfilter) >= 2.8 +Requires: php-autoloader(%{gh_owner}/zend-inputfilter) < 3 +Requires: php-autoloader(%{gh_owner}/zend-hydrator) >= 1.1 +Requires: php-autoloader(%{gh_owner}/zend-hydrator) < 3 +Requires: php-autoloader(%{gh_owner}/zend-stdlib) >= 2.7 +Requires: php-autoloader(%{gh_owner}/zend-stdlib) < 4 # From composer, "suggest": { # "zendframework/zend-captcha": "^2.7.1, required for using CAPTCHA form elements", # "zendframework/zend-code": "^2.6 || ^3.0, required to use zend-form annotations support", @@ -112,15 +110,17 @@ Requires: php-composer(%{gh_owner}/zend-stdlib) < 4 # "zendframework/zend-view": "^2.6.2, required for using the zend-form view helpers", # "zendframework/zendservice-recaptcha": "in order to use the ReCaptcha form element" %if 0%{?fedora} >= 21 -Suggests: php-composer(%{gh_owner}/zend-captcha) -Suggests: php-composer(%{gh_owner}/zend-code) -Suggests: php-composer(%{gh_owner}/zend-eventmanager) -Suggests: php-composer(%{gh_owner}/zend-i18n) -Suggests: php-composer(%{gh_owner}/zend-servicemanager) -Suggests: php-composer(%{gh_owner}/zend-view) -Suggests: php-composer(%{gh_owner}/zendservice-recaptcha) +Suggests: php-autoloader(%{gh_owner}/zend-captcha) +Suggests: php-autoloader(%{gh_owner}/zend-code) +Suggests: php-autoloader(%{gh_owner}/zend-eventmanager) +Suggests: php-autoloader(%{gh_owner}/zend-i18n) +Suggests: php-autoloader(%{gh_owner}/zend-servicemanager) +Suggests: php-autoloader(%{gh_owner}/zend-view) +Suggests: php-autoloader(%{gh_owner}/zendservice-recaptcha) %endif %endif +# Autoloader +Requires: php-composer(fedora/autoloader) # From phpcompatinfo report for version 2.6.0 Requires: php-date Requires: php-intl @@ -130,6 +130,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 @@ -148,7 +149,26 @@ 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::optional([ + '%{php_home}/Zend/Captcha/autoload.php', + '%{php_home}/Zend/Code/autoload.php', + '%{php_home}/Zend/EventManager/autoload.php', + '%{php_home}/Zend/I18n/autoload.php', + '%{php_home}/Zend/ServiceManager/autoload.php', + '%{php_home}/Zend/View/autoload.php', + '%{php_home}/ZendService/ReCaptcha/autoload.php', +]); +# Polyfill must be loaded after ServiceManager +\Fedora\Autoloader\Dependencies::required([ + '%{php_home}/Zend/InputFilter/autoload.php', + '%{php_home}/Zend/Hydrator/autoload.php', + '%{php_home}/Zend/Stdlib/autoload.php', + __DIR__ . '/formElementManagerPolyfill.php', +]); +EOF %install @@ -156,7 +176,9 @@ mkdir -p %{buildroot}%{php_home}/Zend/ cp -pr src %{buildroot}%{php_home}/Zend/%{library} cp -p autoload/formElementManagerPolyfill.php \ - %{buildroot}%{php_home}/Zend/%{library}-autoload.php + %{buildroot}%{php_home}/Zend/%{library} +ln -s %{library}/formElementManagerPolyfill.php \ + %{buildroot}%{php_home}/Zend/%{library}-autoload.php %check @@ -164,16 +186,16 @@ cp -p autoload/formElementManagerPolyfill.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}/Zend/Cache/autoload.php', + '%{php_home}/Zend/Escaper/autoload.php', + '%{php_home}/Zend/Filter/autoload.php', + '%{php_home}/Zend/Session/autoload.php', + '%{php_home}/Zend/Text/autoload.php', + '%{php_home}/Zend/Validator/autoload.php', +]); +\Fedora\Autoloader\Autoload::addPsr4('ZendTest\\%{library}\\', dirname(__DIR__) . '/test'); EOF ret=0 @@ -199,6 +221,9 @@ exit $ret %changelog +* Tue Dec 12 2017 Remi Collet - 2.11.0-2 +- switch from zend-loader to fedora/autoloader + * Thu Dec 7 2017 Remi Collet - 2.11.0-1 - Update to 2.11.0 - temporarily switch back to phpunit v5 -- cgit