diff options
Diffstat (limited to 'php-symfony-psr-http-message-bridge.spec')
-rw-r--r-- | php-symfony-psr-http-message-bridge.spec | 134 |
1 files changed, 77 insertions, 57 deletions
diff --git a/php-symfony-psr-http-message-bridge.spec b/php-symfony-psr-http-message-bridge.spec index 38acc15..aed1ecc 100644 --- a/php-symfony-psr-http-message-bridge.spec +++ b/php-symfony-psr-http-message-bridge.spec @@ -1,9 +1,8 @@ # remirepo spec file for php-symfony-psr-http-message-bridge, from: # -# # Fedora spec file for php-symfony-psr-http-message-bridge # -# Copyright (c) 2015 Shawn Iwinski <shawn.iwinski@gmail.com> +# Copyright (c) 2015-2017 Shawn Iwinski <shawn.iwinski@gmail.com> # # License: MIT # http://opensource.org/licenses/MIT @@ -13,8 +12,8 @@ %global github_owner symfony %global github_name psr-http-message-bridge -%global github_version 0.2 -%global github_commit dc7e308e1dc2898a46776e2221a643cb08315453 +%global github_version 1.0.0 +%global github_commit 66085f246d3893cbdbcec5f5ad15ac60546cf0de %global composer_vendor symfony %global composer_project psr-http-message-bridge @@ -25,7 +24,8 @@ %global psr_http_message_min_ver 1.0 %global psr_http_message_max_ver 2.0 # "symfony/http-foundation": "~2.3|~3.0" -%global symfony_min_ver %{?el6:2.3.31}%{!?el6:2.7.3} +# NOTE: Min version not 2.3 because autoloader required +%global symfony_min_ver %{?el6:2.3.31}%{!?el6:2.7.1} %global symfony_max_ver 4.0 %global with_zend_diactoros 0%{!?el6:1} @@ -37,7 +37,7 @@ Name: php-%{composer_vendor}-%{composer_project} Version: %{github_version} -Release: 2%{?github_release}%{?dist} +Release: 3%{?github_release}%{?dist} Summary: Symfony PSR HTTP message bridge Group: Development/Libraries @@ -45,114 +45,123 @@ License: MIT URL: https://github.com/%{github_owner}/%{github_name} Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +# Fix test suite with !el6 and zendframework/zend-diactoros +# https://github.com/symfony/psr-http-message-bridge/pull/31 +Patch0: %{name}-upstream-pull-31.patch + BuildArch: noarch # Tests %if %{with_tests} %if %{with_zend_diactoros} BuildRequires: php-composer(zendframework/zend-diactoros) %endif -BuildRequires: %{_bindir}/phpunit +BuildRequires: php-composer(phpunit/phpunit) ## composer.json -BuildRequires: php(language) >= %{php_min_ver} -BuildRequires: php-composer(psr/http-message) >= %{psr_http_message_min_ver} +BuildRequires: php(language) >= %{php_min_ver} +BuildRequires: php-composer(psr/http-message) < %{psr_http_message_max_ver} +BuildRequires: php-composer(psr/http-message) >= %{psr_http_message_min_ver} +BuildRequires: php-composer(symfony/http-foundation) < %{symfony_max_ver} BuildRequires: php-composer(symfony/http-foundation) >= %{symfony_min_ver} -## phpcompatinfo (computed from version 0.2) +## phpcompatinfo (computed from version 1.0.0) BuildRequires: php-date BuildRequires: php-reflection BuildRequires: php-spl ## Autoloader -BuildRequires: php-composer(symfony/class-loader) +BuildRequires: php-composer(fedora/autoloader) %endif # composer.json -Requires: php(language) >= %{php_min_ver} -Requires: php-composer(psr/http-message) >= %{psr_http_message_min_ver} -Requires: php-composer(psr/http-message) < %{psr_http_message_max_ver} -Requires: php-composer(symfony/http-foundation) >= %{symfony_min_ver} +Requires: php(language) >= %{php_min_ver} +Requires: php-composer(psr/http-message) < %{psr_http_message_max_ver} +Requires: php-composer(psr/http-message) >= %{psr_http_message_min_ver} Requires: php-composer(symfony/http-foundation) < %{symfony_max_ver} -# phpcompatinfo (computed from version 0.2) +Requires: php-composer(symfony/http-foundation) >= %{symfony_min_ver} +# phpcompatinfo (computed from version 1.0.0) Requires: php-date Requires: php-spl # Autoloader -Requires: php-composer(symfony/class-loader) +Requires: php-composer(fedora/autoloader) + +# Weak dependencies +%if 0%{?fedora} >= 21 +Suggests: php-composer(psr/http-message-implementation) +%if %{with_zend_diactoros} +Suggests: php-composer(zendframework/zend-diactoros) +%endif +%endif # Composer Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} %description Provides integration for PSR7. -%if %{with_zend_diactoros} -Optional: -* php-zendframework-zend-diactoros: To use the Zend Diactoros factory -%endif + +Autoloader: %{phpdir}/Symfony/Bridge/PsrHttpMessage/autoload.php %prep %setup -qn %{github_name}-%{github_commit} +%if 0%{!?el6:1} +%patch0 -p1 +%endif + + +%build : Create autoloader cat <<'AUTOLOAD' | tee autoload.php <?php /** * Autoloader for %{name} and its' dependencies - * - * Created by %{name}-%{version}-%{release} - * - * @return \Symfony\Component\ClassLoader\ClassLoader + * (created by %{name}-%{version}-%{release}). */ +require_once '%{phpdir}/Fedora/Autoloader/autoload.php'; -if (!isset($fedoraClassLoader) || !($fedoraClassLoader instanceof \Symfony\Component\ClassLoader\ClassLoader)) { - if (!class_exists('Symfony\\Component\\ClassLoader\\ClassLoader', false)) { - require_once '%{phpdir}/Symfony/Component/ClassLoader/ClassLoader.php'; - } - - $fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader(); - $fedoraClassLoader->register(); -} +\Fedora\Autoloader\Autoload::addPsr4('Symfony\\Bridge\\PsrHttpMessage\\', __DIR__); -$fedoraClassLoader->addPrefix('Symfony\\Bridge\\PsrHttpMessage\\', dirname(dirname(dirname(__DIR__)))); +\Fedora\Autoloader\Dependencies::required(array( + '%{phpdir}/Psr/Http/Message/autoload.php', + array( + '%{phpdir}/Symfony3/Component/HttpFoundation/autoload.php', + '%{phpdir}/Symfony/Component/HttpFoundation/autoload.php', + ), +)); +AUTOLOAD -require_once '%{phpdir}/Psr/Http/Message/autoload.php'; -require_once '%{phpdir}/Symfony/Component/HttpFoundation/autoload.php'; %if %{with_zend_diactoros} +cat <<'AUTOLOAD' | tee -a autoload.php -if (file_exists('%{phpdir}/Zend/Diactoros/autoload.php')) { - require_once '%{phpdir}/Zend/Diactoros/autoload.php'; -} -%endif - -return $fedoraClassLoader; +\Fedora\Autoloader\Dependencies::optional(array( + '%{phpdir}/Zend/Diactoros/autoload.php', +)); AUTOLOAD - - -%build -# Empty build section, nothing required +%endif %install -rm -rf %{buildroot} - mkdir -p %{buildroot}%{phpdir}/Symfony/Bridge/PsrHttpMessage cp -rp *.php Factory Tests %{buildroot}%{phpdir}/Symfony/Bridge/PsrHttpMessage/ %check %if %{with_tests} -: Run tests -%{_bindir}/phpunit --verbose \ - --bootstrap %{buildroot}%{phpdir}/Symfony/Bridge/PsrHttpMessage/autoload.php +: Upstream tests +RETURN_CODE=0 +PHPUNIT=$(which phpunit) +for PHP_EXEC in "" %{?rhel:php54 php55} php56 php70 php71 php72; do + if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then + $PHP_EXEC $PHPUNIT --verbose \ + --bootstrap %{buildroot}%{phpdir}/Symfony/Bridge/PsrHttpMessage/autoload.php \ + || RETURN_CODE=1 + fi +done +exit $RETURN_CODE %else : Tests skipped %endif -%clean -rm -rf %{buildroot} - - %files -%defattr(-,root,root,-) %{!?_licensedir:%global license %%doc} %license LICENSE %doc *.md @@ -162,6 +171,17 @@ rm -rf %{buildroot} %changelog +* Thu Sep 21 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.0.0-3 +- Allow Symfony 3 +- Modify tests +- Apply patch to fix test suite with !el6 and zendframework/zend-diactoros + +* Sat Apr 15 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.0.0-1 +- Update to 1.0.0 (RHBZ #1370802) +- Add max versions to BuildRequires +- Switch autoloader to php-composer(fedora/autoloader) +- Test with SCLs if available + * Wed Aug 5 2015 Remi Collet <remi@remirepo.net> - 0.2-2 - backport for #remirepo |