From 627d2d45a0cdf9860e7f70c325da10fbb85473d0 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sat, 23 Sep 2017 07:56:47 +0200 Subject: v1.4.1 from Fedora --- php-SymfonyCmfRouting.spec | 151 ++++++++++++++++++++++++--------------------- 1 file changed, 81 insertions(+), 70 deletions(-) (limited to 'php-SymfonyCmfRouting.spec') diff --git a/php-SymfonyCmfRouting.spec b/php-SymfonyCmfRouting.spec index f4d4e5c..9eb1784 100644 --- a/php-SymfonyCmfRouting.spec +++ b/php-SymfonyCmfRouting.spec @@ -12,8 +12,8 @@ %global github_owner symfony-cmf %global github_name routing -%global github_version 1.4.0 -%global github_commit b93704ca098334f56e9b317932f21a4362e620db +%global github_version 1.4.1 +%global github_commit fb1e7f85ff8c6866238b7e73a490a0a0243ae8ac %global composer_vendor symfony-cmf %global composer_project routing @@ -26,9 +26,8 @@ # "symfony/http-kernel": "^2.2|3.*" # "symfony/routing": "^2.2|3.*" ## NOTE: Min version not 2.2 because autoloaders required -## NOTE: Max version not 4.0 to force version 2 %global symfony_min_ver 2.7.1 -%global symfony_max_ver 3.0 +%global symfony_max_ver 4.0 # "psr/log": "1.*" ## NOTE: Min version not 1.0 because autoloader required %global psr_log_min_ver 1.0.1 @@ -49,37 +48,45 @@ License: MIT URL: http://symfony.com/doc/master/cmf/book/routing.html Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch # Tests %if %{with_tests} BuildRequires: php-composer(phpunit/phpunit) ## composer.json -BuildRequires: php(language) >= %{php_min_ver} -BuildRequires: php-composer(psr/log) >= %{psr_log_min_ver} -BuildRequires: php-composer(symfony/config) >= %{symfony_min_ver} +BuildRequires: php(language) >= %{php_min_ver} +BuildRequires: php-composer(psr/log) < %{psr_log_max_ver} +BuildRequires: php-composer(psr/log) >= %{psr_log_min_ver} +BuildRequires: php-composer(symfony/config) < %{symfony_max_ver} +BuildRequires: php-composer(symfony/config) >= %{symfony_min_ver} +BuildRequires: php-composer(symfony/dependency-injection) < %{symfony_max_ver} BuildRequires: php-composer(symfony/dependency-injection) >= %{symfony_min_ver} -BuildRequires: php-composer(symfony/event-dispatcher) >= %{symfony_min_ver} -BuildRequires: php-composer(symfony/http-kernel) >= %{symfony_min_ver} -BuildRequires: php-composer(symfony/routing) >= %{symfony_min_ver} -## phpcompatinfo (computed from version 1.4.0) +BuildRequires: php-composer(symfony/event-dispatcher) < %{symfony_max_ver} +BuildRequires: php-composer(symfony/event-dispatcher) >= %{symfony_min_ver} +BuildRequires: php-composer(symfony/http-kernel) < %{symfony_max_ver} +BuildRequires: php-composer(symfony/http-kernel) >= %{symfony_min_ver} +BuildRequires: php-composer(symfony/routing) < %{symfony_max_ver} +BuildRequires: php-composer(symfony/routing) >= %{symfony_min_ver} +## phpcompatinfo (computed from version 1.4.1) BuildRequires: php-pcre 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/log) >= %{psr_log_min_ver} -Requires: php-composer(psr/log) < %{psr_log_max_ver} +Requires: php(language) >= %{php_min_ver} +Requires: php-composer(psr/log) >= %{psr_log_min_ver} +Requires: php-composer(psr/log) < %{psr_log_max_ver} Requires: php-composer(symfony/http-kernel) >= %{symfony_min_ver} Requires: php-composer(symfony/http-kernel) < %{symfony_max_ver} -Requires: php-composer(symfony/routing) >= %{symfony_min_ver} -Requires: php-composer(symfony/routing) < %{symfony_max_ver} -# phpcompatinfo (computed from version 1.4.0) +Requires: php-composer(symfony/routing) >= %{symfony_min_ver} +Requires: php-composer(symfony/routing) < %{symfony_max_ver} +# phpcompatinfo (computed from version 1.4.1) Requires: php-pcre Requires: php-spl +# Autoloader +Requires: php-composer(fedora/autoloader) + # composer.json: optional %if 0%{?fedora} > 21 Suggests: php-composer(symfony/event-dispatcher) @@ -100,6 +107,8 @@ It provides: Even though it has Symfony in its name, the Routing component does not need the full Symfony2 Framework and can be used in standalone projects. +Autoloader: %{phpdir}/Symfony/Cmf/Component/Routing/autoload.php + %prep %setup -qn %{github_name}-%{github_commit} @@ -112,35 +121,29 @@ cat <<'AUTOLOAD' | tee autoload.php /** * Autoloader for %{name} and its' dependencies * (created by %{name}-%{version}-%{release}). - * - * @return \Symfony\Component\ClassLoader\ClassLoader */ - -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(); -} - -$fedoraClassLoader->addPrefix( - 'Symfony\\Cmf\\Component\\Routing\\', - dirname(dirname(dirname(dirname(__DIR__)))) -); - -// Required dependencies -require_once '%{phpdir}/Psr/Log/autoload.php'; -require_once '%{phpdir}/Symfony/Component/HttpKernel/autoload.php'; -require_once '%{phpdir}/Symfony/Component/Routing/autoload.php'; - -// Optional dependency -if (file_exists('%{phpdir}/Symfony/Component/EventDispatcher/autoload.php')) { - require_once '%{phpdir}/Symfony/Component/EventDispatcher/autoload.php'; -} - -return $fedoraClassLoader; +require_once '%{phpdir}/Fedora/Autoloader/autoload.php'; + +\Fedora\Autoloader\Autoload::addPsr4('Symfony\\Cmf\\Component\\Routing\\', __DIR__); + +\Fedora\Autoloader\Dependencies::required(array( + '%{phpdir}/Psr/Log/autoload.php', + array( + '%{phpdir}/Symfony3/Component/HttpKernel/autoload.php', + '%{phpdir}/Symfony/Component/HttpKernel/autoload.php', + ), + array( + '%{phpdir}/Symfony3/Component/Routing/autoload.php', + '%{phpdir}/Symfony/Component/Routing/autoload.php', + ), +)); + +\Fedora\Autoloader\Dependencies::optional(array( + array( + '%{phpdir}/Symfony3/Component/EventDispatcher/autoload.php', + '%{phpdir}/Symfony/Component/EventDispatcher/autoload.php', + ), +)); AUTOLOAD @@ -154,44 +157,46 @@ cp -rp * %{buildroot}%{phpdir}/Symfony/Cmf/Component/Routing/ : Create tests bootstrap cat <<'BOOTSTRAP' | tee bootstrap.php addPrefix( +require_once '%{buildroot}%{phpdir}/Symfony/Cmf/Component/Routing/autoload.php'; + +\Fedora\Autoloader\Autoload::addPsr4( 'Symfony\\Cmf\\Component\\Routing\\Test\\', - '%{buildroot}%{phpdir}' + '%{buildroot}%{phpdir}/Symfony/Cmf/Component/Routing/Test' ); -$fedoraClassLoader->addPrefix( +\Fedora\Autoloader\Autoload::addPsr4( 'Symfony\\Cmf\\Component\\Routing\\Tests\\', - '%{buildroot}%{phpdir}' + '%{buildroot}%{phpdir}/Symfony/Cmf/Component/Routing/Tests' ); -require_once '%{phpdir}/Symfony/Component/Config/autoload.php'; -require_once '%{phpdir}/Symfony/Component/DependencyInjection/autoload.php'; +\Fedora\Autoloader\Dependencies::required(array( + array( + '%{phpdir}/Symfony3/Component/Config/autoload.php', + '%{phpdir}/Symfony/Component/Config/autoload.php', + ), + array( + '%{phpdir}/Symfony3/Component/DependencyInjection/autoload.php', + '%{phpdir}/Symfony/Component/DependencyInjection/autoload.php', + ), +)); BOOTSTRAP -run=0 -ret=0 -if which php56; then - php56 %{_bindir}/phpunit --bootstrap bootstrap.php || ret=1 - run=1 -fi -if which php71; then - php71 %{_bindir}/phpunit --bootstrap bootstrap.php || ret=1 - run=1 -fi -if [ $run -eq 0 ]; then -%{_bindir}/phpunit --verbose --bootstrap bootstrap.php -fi -exit $ret +: 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 bootstrap.php || RETURN_CODE=1 + fi + done +exit $RETURN_CODE %else : Tests skipped %endif %files -%defattr(-,root,root,-) %{!?_licensedir:%global license %%doc} %license LICENSE %doc CHANGELOG.md @@ -208,6 +213,12 @@ exit $ret %changelog +* Fri Sep 22 2017 Shawn Iwinski - 1.4.1-1 +- Update to 1.4.1 +- Allow Symfony 3 +- Add max versions to BuildRequires +- Switch autloader to fedora/autoloader + * Thu Nov 03 2016 Shawn Iwinski - 1.4.0-1 - Updated to 1.4.0 (RHBZ #1297159) -- cgit