diff options
-rw-r--r-- | composer.json | 4 | ||||
-rw-r--r-- | php-silex.spec | 292 |
2 files changed, 167 insertions, 129 deletions
diff --git a/composer.json b/composer.json index 17fd3e3..c2aada7 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "require-dev": { "symfony/security": "~2.3|3.0.*", "symfony/config": "~2.3|3.0.*", - "symfony/locale": "~2.3|3.0.*", + "symfony/intl": "~2.3|3.0.*", "symfony/form": "~2.3|3.0.*", "symfony/browser-kit": "~2.3|3.0.*", "symfony/css-selector": "~2.3|3.0.*", @@ -40,7 +40,7 @@ "symfony/translation": "~2.3|3.0.*", "symfony/twig-bridge": "~2.3|3.0.*", "symfony/validator": "~2.3|3.0.*", - "twig/twig": "~1.8|~2.0", + "twig/twig": "~1.28|~2.0", "doctrine/dbal": "~2.2", "swiftmailer/swiftmailer": "~5", "monolog/monolog": "^1.4.1" diff --git a/php-silex.spec b/php-silex.spec index b38e94d..d305f35 100644 --- a/php-silex.spec +++ b/php-silex.spec @@ -2,7 +2,7 @@ # # Fedora spec file for php-silex # -# Copyright (c) 2015-2016 Shawn Iwinski <shawn.iwinski@gmail.com> +# Copyright (c) 2015-2017 Shawn Iwinski <shawn.iwinski@gmail.com> # # License: MIT # http://opensource.org/licenses/MIT @@ -12,37 +12,58 @@ %global github_owner silexphp %global github_name Silex -%global github_version 1.3.5 -%global github_commit 374c7e04040a6f781c90f7d746726a5daa78e783 +%global github_version 1.3.6 +%global github_commit ff8aa6bc2e066e14b07e0c63e9bd9dd1458af136 %global composer_vendor silex %global composer_project silex # "php": ">=5.3.9" -%global php_min_ver 5.3.9 +%global php_min_ver 5.3.9 # "doctrine/dbal": "~2.2" # NOTE: Min version not 2.2 because autoloader required %global doctrine_dbal_min_ver 2.5.4 %global doctrine_dbal_max_ver 3.0 # "monolog/monolog": "^1.4.1" # NOTE: Min version not 1.4.1 because autoloader required -%global monolog_min_ver 1.15.0 -%global monolog_max_ver 2.0.0 +%global monolog_min_ver 1.15.0 +%global monolog_max_ver 2.0.0 # "pimple/pimple": "~1.0" -%global pimple_min_ver 1.0 -%global pimple_max_ver 2.0 +%global pimple_min_ver 1.0 +%global pimple_max_ver 2.0 # "swiftmailer/swiftmailer": "~5" # NOTE: Min version not 5.0 because autoloader required -%global swiftmailer_min_ver 5.4.1 -%global swiftmailer_max_ver 6.0 -# "symfony/*": "~2.3|3.0.*" +%global swiftmailer_min_ver 5.4.1 +%global swiftmailer_max_ver 6.0 +# "symfony/browser-kit": "~2.3|3.0.*" +# "symfony/config": "~2.3|3.0.*" +# "symfony/css-selector": "~2.3|3.0.*" +# "symfony/debug": "~2.3|3.0.*" +# "symfony/dom-crawler": "~2.3|3.0.*" +# "symfony/event-dispatcher": "~2.3|3.0.*" +# "symfony/finder": "~2.3|3.0.*" +# "symfony/form": "~2.3|3.0.*" +# "symfony/http-foundation": "~2.3|3.0.*" +# "symfony/http-kernel": "~2.3|3.0.*" +# "symfony/intl": "~2.3|3.0.*" +# "symfony/monolog-bridge": "~2.3|3.0.*" +# "symfony/options-resolver": "~2.3|3.0.*" +# "symfony/phpunit-bridge": "~2.7" +# "symfony/process": "~2.3|3.0.*" +# "symfony/routing": "~2.3|3.0.*" +# "symfony/security": "~2.3|3.0.*" +# "symfony/serializer": "~2.3|3.0.*" +# "symfony/translation": "~2.3|3.0.*" +# "symfony/twig-bridge": "~2.3|3.0.*" +# "symfony/validator": "~2.3|3.0.*" # NOTE: Min version not 2.3 because autoloaders required -%global symfony_min_ver 2.7.1 -%global symfony_max_ver 3.1 -# "twig/twig": "~1.8|~2.0" -# NOTE: Min version not 1.8 because autoloader required -%global twig_min_ver 1.18.2 -%global twig_max_ver 3.0 +# NOTE: Max version not 3.1.0 to force version 2 so version 3 +# can increase beyond version 3.1.0 +%global symfony_min_ver 2.7.1 +%global symfony_max_ver 3.0 +# "twig/twig": "~1.28|~2.0" +%global twig_min_ver 1.28 +%global twig_max_ver 3.0 # Build using "--without tests" to disable tests %global with_tests 0%{!?_without_tests:1} @@ -51,7 +72,7 @@ Name: php-%{composer_project} Version: %{github_version} -Release: 4%{dist} +Release: 1%{dist} Summary: PHP micro-framework based on the Symfony components Group: Development/Libraries @@ -68,33 +89,57 @@ BuildRequires: php-pear %if %{with_tests} BuildRequires: php-composer(phpunit/phpunit) ## composer.json -BuildRequires: php(language) >= %{php_min_ver} -BuildRequires: php-composer(doctrine/dbal) >= %{doctrine_dbal_min_ver} -BuildRequires: php-composer(monolog/monolog) >= %{monolog_min_ver} -BuildRequires: php-composer(pimple/pimple) < %{pimple_max_ver} -BuildRequires: php-composer(pimple/pimple) >= %{pimple_min_ver} -BuildRequires: php-composer(swiftmailer/swiftmailer) >= %{swiftmailer_min_ver} -BuildRequires: php-composer(symfony/browser-kit) >= %{symfony_min_ver} -BuildRequires: php-composer(symfony/config) >= %{symfony_min_ver} -BuildRequires: php-composer(symfony/css-selector) >= %{symfony_min_ver} -BuildRequires: php-composer(symfony/debug) >= %{symfony_min_ver} -BuildRequires: php-composer(symfony/dom-crawler) >= %{symfony_min_ver} +BuildRequires: php(language) >= %{php_min_ver} +BuildRequires: php-composer(doctrine/dbal) < %{doctrine_dbal_max_ver} +BuildRequires: php-composer(doctrine/dbal) >= %{doctrine_dbal_min_ver} +BuildRequires: php-composer(monolog/monolog) < %{monolog_max_ver} +BuildRequires: php-composer(monolog/monolog) >= %{monolog_min_ver} +BuildRequires: php-composer(pimple/pimple) < %{pimple_max_ver} +BuildRequires: php-composer(pimple/pimple) >= %{pimple_min_ver} +BuildRequires: php-composer(swiftmailer/swiftmailer) < %{swiftmailer_max_ver} +BuildRequires: php-composer(swiftmailer/swiftmailer) >= %{swiftmailer_min_ver} +BuildRequires: php-composer(symfony/browser-kit) < %{symfony_max_ver} +BuildRequires: php-composer(symfony/browser-kit) >= %{symfony_min_ver} +BuildRequires: php-composer(symfony/config) < %{symfony_max_ver} +BuildRequires: php-composer(symfony/config) >= %{symfony_min_ver} +BuildRequires: php-composer(symfony/css-selector) < %{symfony_max_ver} +BuildRequires: php-composer(symfony/css-selector) >= %{symfony_min_ver} +BuildRequires: php-composer(symfony/debug) < %{symfony_max_ver} +BuildRequires: php-composer(symfony/debug) >= %{symfony_min_ver} +BuildRequires: php-composer(symfony/dom-crawler) < %{symfony_max_ver} +BuildRequires: php-composer(symfony/dom-crawler) >= %{symfony_min_ver} +BuildRequires: php-composer(symfony/event-dispatcher) < %{symfony_max_ver} BuildRequires: php-composer(symfony/event-dispatcher) >= %{symfony_min_ver} -BuildRequires: php-composer(symfony/finder) >= %{symfony_min_ver} -BuildRequires: php-composer(symfony/form) >= %{symfony_min_ver} -BuildRequires: php-composer(symfony/http-foundation) >= %{symfony_min_ver} -BuildRequires: php-composer(symfony/http-kernel) >= %{symfony_min_ver} -BuildRequires: php-composer(symfony/locale) >= %{symfony_min_ver} -BuildRequires: php-composer(symfony/monolog-bridge) >= %{symfony_min_ver} +BuildRequires: php-composer(symfony/finder) < %{symfony_max_ver} +BuildRequires: php-composer(symfony/finder) >= %{symfony_min_ver} +BuildRequires: php-composer(symfony/form) < %{symfony_max_ver} +BuildRequires: php-composer(symfony/form) >= %{symfony_min_ver} +BuildRequires: php-composer(symfony/http-foundation) < %{symfony_max_ver} +BuildRequires: php-composer(symfony/http-foundation) >= %{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/intl) < %{symfony_max_ver} +BuildRequires: php-composer(symfony/intl) >= %{symfony_min_ver} +BuildRequires: php-composer(symfony/monolog-bridge) < %{symfony_max_ver} +BuildRequires: php-composer(symfony/monolog-bridge) >= %{symfony_min_ver} +BuildRequires: php-composer(symfony/options-resolver) < %{symfony_max_ver} BuildRequires: php-composer(symfony/options-resolver) >= %{symfony_min_ver} -BuildRequires: php-composer(symfony/process) >= %{symfony_min_ver} -BuildRequires: php-composer(symfony/routing) >= %{symfony_min_ver} -BuildRequires: php-composer(symfony/security) >= %{symfony_min_ver} -BuildRequires: php-composer(symfony/serializer) >= %{symfony_min_ver} -BuildRequires: php-composer(symfony/translation) >= %{symfony_min_ver} -BuildRequires: php-composer(symfony/twig-bridge) >= %{symfony_min_ver} -BuildRequires: php-composer(symfony/validator) >= %{symfony_min_ver} -BuildRequires: php-composer(twig/twig) >= %{twig_min_ver} +BuildRequires: php-composer(symfony/process) < %{symfony_max_ver} +BuildRequires: php-composer(symfony/process) >= %{symfony_min_ver} +BuildRequires: php-composer(symfony/routing) < %{symfony_max_ver} +BuildRequires: php-composer(symfony/routing) >= %{symfony_min_ver} +BuildRequires: php-composer(symfony/security) < %{symfony_max_ver} +BuildRequires: php-composer(symfony/security) >= %{symfony_min_ver} +BuildRequires: php-composer(symfony/serializer) < %{symfony_max_ver} +BuildRequires: php-composer(symfony/serializer) >= %{symfony_min_ver} +BuildRequires: php-composer(symfony/translation) < %{symfony_max_ver} +BuildRequires: php-composer(symfony/translation) >= %{symfony_min_ver} +BuildRequires: php-composer(symfony/twig-bridge) < %{symfony_max_ver} +BuildRequires: php-composer(symfony/twig-bridge) >= %{symfony_min_ver} +BuildRequires: php-composer(symfony/validator) < %{symfony_max_ver} +BuildRequires: php-composer(symfony/validator) >= %{symfony_min_ver} +BuildRequires: php-composer(twig/twig) < %{twig_max_ver} +BuildRequires: php-composer(twig/twig) >= %{twig_min_ver} ## phpcompatinfo (computed from version 1.3.5) BuildRequires: php-date BuildRequires: php-json @@ -104,21 +149,21 @@ BuildRequires: php-session BuildRequires: php-spl BuildRequires: php-tokenizer ## Autoloader -BuildRequires: php-composer(symfony/class-loader) +BuildRequires: php-composer(fedora/autoloader) %endif # composer.json -Requires: php(language) >= %{php_min_ver} -Requires: php-composer(pimple/pimple) >= %{pimple_min_ver} -Requires: php-composer(pimple/pimple) < %{pimple_max_ver} +Requires: php(language) >= %{php_min_ver} +Requires: php-composer(pimple/pimple) >= %{pimple_min_ver} +Requires: php-composer(pimple/pimple) < %{pimple_max_ver} Requires: php-composer(symfony/event-dispatcher) >= %{symfony_min_ver} Requires: php-composer(symfony/event-dispatcher) < %{symfony_max_ver} -Requires: php-composer(symfony/http-foundation) >= %{symfony_min_ver} -Requires: php-composer(symfony/http-foundation) < %{symfony_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} +Requires: php-composer(symfony/http-foundation) >= %{symfony_min_ver} +Requires: php-composer(symfony/http-foundation) < %{symfony_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.3.5) Requires: php-date Requires: php-pcre @@ -127,7 +172,7 @@ Requires: php-session Requires: php-spl Requires: php-tokenizer # Autoloader -Requires: php-composer(symfony/class-loader) +Requires: php-composer(fedora/autoloader) # Weak dependencies %if 0%{?fedora} >= 21 @@ -140,7 +185,7 @@ Suggests: php-composer(symfony/debug) Suggests: php-composer(symfony/doctrine-bridge) Suggests: php-composer(symfony/finder) Suggests: php-composer(symfony/form) -Suggests: php-composer(symfony/locale) +Suggests: php-composer(symfony/intl) Suggests: php-composer(symfony/monolog-bridge) Suggests: php-composer(symfony/process) Suggests: php-composer(symfony/security) @@ -150,16 +195,6 @@ Suggests: php-composer(symfony/twig-bridge) Suggests: php-composer(symfony/validator) Suggests: php-composer(twig/twig) %endif -Conflicts: php-doctrine-dbal < %{doctrine_dbal_min_ver} -Conflicts: php-doctrine-dbal >= %{doctrine_dbal_max_ver} -Conflicts: php-Monolog < %{monolog_min_ver} -Conflicts: php-Monolog >= %{monolog_max_ver} -Conflicts: php-PsrLog < 1.0.0-8 -Conflicts: php-PsrLog >= 2.0 -Conflicts: php-swiftmailer < %{swiftmailer_min_ver} -Conflicts: php-swiftmailer >= %{swiftmailer_max_ver} -Conflicts: php-twig < %{twig_min_ver} -Conflicts: php-twig >= %{twig_max_ver} # php-{COMPOSER_VENDOR}-{COMPOSER_PROJECT} Provides: php-%{composer_vendor}-%{composer_project} = %{version}-%{release} @@ -179,72 +214,59 @@ aims to be: responses. This makes it very easy to test apps and the framework itself. It also respects the HTTP specification and encourages its' proper use. +Autoloader: %{phpdir}/Silex/autoload.php + %prep %setup -qn %{github_name}-%{github_commit} + +%build : Create autoloader cat <<'AUTOLOAD' | tee src/Silex/autoload.php <?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('Silex\\', dirname(__DIR__)); - -// Dependencies (autoloader => required) -foreach(array( - // Required dependencies - '%{phpdir}/Pimple1/autoload.php' => true, - '%{phpdir}/Symfony/Component/EventDispatcher/autoload.php' => true, - '%{phpdir}/Symfony/Component/HttpFoundation/autoload.php' => true, - '%{phpdir}/Symfony/Component/HttpKernel/autoload.php' => true, - '%{phpdir}/Symfony/Component/Routing/autoload.php' => true, - // Optional dependencies - '%{phpdir}/Doctrine/DBAL/autoload.php' => false, - '%{phpdir}/Monolog/autoload.php' => false, - '%{phpdir}/Psr/Log/autoload.php' => false, - '%{phpdir}/Swift/swift_required.php' => false, - '%{phpdir}/Symfony/Bridge/Doctrine/autoload.php' => false, - '%{phpdir}/Symfony/Bridge/Monolog/autoload.php' => false, - '%{phpdir}/Symfony/Bridge/Twig/autoload.php' => false, - '%{phpdir}/Symfony/Component/BrowserKit/autoload.php' => false, - '%{phpdir}/Symfony/Component/Debug/autoload.php' => false, - '%{phpdir}/Symfony/Component/Finder/autoload.php' => false, - '%{phpdir}/Symfony/Component/Form/autoload.php' => false, - '%{phpdir}/Symfony/Component/Locale/autoload.php' => false, - '%{phpdir}/Symfony/Component/Process/autoload.php' => false, - '%{phpdir}/Symfony/Component/Security/autoload.php' => false, - '%{phpdir}/Symfony/Component/Serializer/autoload.php' => false, - '%{phpdir}/Symfony/Component/Translation/autoload.php' => false, - '%{phpdir}/Symfony/Component/Validator/autoload.php' => false, - '%{phpdir}/Twig/autoload.php' => false, -) as $dependencyAutoloader => $required) { - if ($required || file_exists($dependencyAutoloader)) { - require_once $dependencyAutoloader; - } -} - -return $fedoraClassLoader; +require_once '%{phpdir}/Fedora/Autoloader/autoload.php'; + +\Fedora\Autoloader\Autoload::addPsr4('Silex\\', __DIR__); + +\Fedora\Autoloader\Dependencies::required(array( + '%{phpdir}/Pimple1/autoload.php', + '%{phpdir}/Symfony/Component/EventDispatcher/autoload.php', + '%{phpdir}/Symfony/Component/HttpFoundation/autoload.php', + '%{phpdir}/Symfony/Component/HttpKernel/autoload.php', + '%{phpdir}/Symfony/Component/Routing/autoload.php', +)); + +\Fedora\Autoloader\Dependencies::optional(array( + '%{phpdir}/Doctrine/DBAL/autoload.php', + '%{phpdir}/Monolog/autoload.php', + '%{phpdir}/Psr/Log/autoload.php', + '%{phpdir}/Swift/swift_required.php', + '%{phpdir}/Symfony/Bridge/Doctrine/autoload.php', + '%{phpdir}/Symfony/Bridge/Monolog/autoload.php', + '%{phpdir}/Symfony/Bridge/Twig/autoload.php', + '%{phpdir}/Symfony/Component/BrowserKit/autoload.php', + '%{phpdir}/Symfony/Component/Debug/autoload.php', + '%{phpdir}/Symfony/Component/Finder/autoload.php', + '%{phpdir}/Symfony/Component/Form/autoload.php', + '%{phpdir}/Symfony/Component/Intl/autoload.php', + '%{phpdir}/Symfony/Component/Process/autoload.php', + '%{phpdir}/Symfony/Component/Security/autoload.php', + '%{phpdir}/Symfony/Component/Serializer/autoload.php', + '%{phpdir}/Symfony/Component/Translation/autoload.php', + '%{phpdir}/Symfony/Component/Validator/autoload.php', + array( + '%{phpdir}/Twig2/autoload.php', + '%{phpdir}/Twig/autoload.php', + ), +)); AUTOLOAD -%build -# Empty build section, nothing required - - %install mkdir -p %{buildroot}%{phpdir} cp -rp src/* %{buildroot}%{phpdir}/ @@ -263,16 +285,16 @@ cp -rp src/* %{buildroot}%{phpdir}/ : Create test bootstrap cat <<'BOOTSTRAP' | tee bootstrap.php <?php +require_once '%{buildroot}%{phpdir}/Silex/autoload.php'; -$fedoraClassLoader = - require_once '%{buildroot}%{phpdir}/Silex/autoload.php'; +\Fedora\Autoloader\Autoload::addPsr4('Silex\\Tests\\', __DIR__.'/tests/Silex/Tests'); -$fedoraClassLoader->addPrefix('Silex\\Tests\\', __DIR__ . '/tests'); - -require_once '%{phpdir}/Symfony/Component/Config/autoload.php'; -require_once '%{phpdir}/Symfony/Component/CssSelector/autoload.php'; -require_once '%{phpdir}/Symfony/Component/DomCrawler/autoload.php'; -require_once '%{phpdir}/Symfony/Component/OptionsResolver/autoload.php'; +\Fedora\Autoloader\Dependencies::required(array( + '%{phpdir}/Symfony/Component/Config/autoload.php', + '%{phpdir}/Symfony/Component/CssSelector/autoload.php', + '%{phpdir}/Symfony/Component/DomCrawler/autoload.php', + '%{phpdir}/Symfony/Component/OptionsResolver/autoload.php', +)); BOOTSTRAP : Temporarily skip tests known to fail @@ -280,8 +302,18 @@ rm -f \ tests/Silex/Tests/Provider/SwiftmailerServiceProviderTest.php \ tests/Silex/Tests/Application/SwiftmailerTraitTest.php -: Run tests -%{_bindir}/phpunit --verbose --bootstrap bootstrap.php +: Upstream tests +export RPM_SYMFONY_TREE=%{phpdir}/Symfony + +RETURN_CODE=0 +PHPUNIT=$(which phpunit) +for PHP_EXEC in "" %{?rhel:php54 php55} php56 php70 php71; 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 @@ -297,6 +329,12 @@ rm -f \ %changelog +* Tue May 30 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.3.6-1 +- Update to 1.3.6 (RHBZ #1447040) +- Switch autoloader to php-composer(fedora/autoloader) +- Add max versions to build dependencies +- Test with SCLs if available + * Sat Jul 23 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.3.5-4 - Updated autoloader to not use "@include_once" |