diff options
Diffstat (limited to 'php-twig-extensions.spec')
-rw-r--r-- | php-twig-extensions.spec | 122 |
1 files changed, 65 insertions, 57 deletions
diff --git a/php-twig-extensions.spec b/php-twig-extensions.spec index 9836344..0a7c64f 100644 --- a/php-twig-extensions.spec +++ b/php-twig-extensions.spec @@ -2,7 +2,7 @@ # # Fedora spec file for php-twig-extensions # -# Copyright (c) 2014-2016 Shawn Iwinski <shawn.iwinski@gmail.com> +# Copyright (c) 2014-2017 Shawn Iwinski <shawn.iwinski@gmail.com> # # License: MIT # http://opensource.org/licenses/MIT @@ -12,17 +12,17 @@ %global github_owner twigphp %global github_name Twig-extensions -%global github_version 1.4.1 -%global github_commit f0bb8431c8691f5a39f1017d9a5967a082bf01ff +%global github_version 1.5.1 +%global github_commit d188c76168b853481cc75879ea045bf93d718e9c %global composer_vendor twig %global composer_project extensions -# "symfony/translation": "~2.3" -%global symfony_min_ver 2.3 -%global symfony_max_ver 3.0 -# "twig/twig": "~1.20|~2.0" -# 1.27 to avoid Error: Call to undefined method Twig_Node_Expression_Name::getTemplateLine() +# "symfony/translation": "~2.3|~3.0" +# 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 +# "twig/twig": "~1.27|~2.0" %global twig_min_ver 1.27 %global twig_max_ver 3.0 @@ -33,46 +33,51 @@ Name: php-%{composer_vendor}-%{composer_project} Version: %{github_version} -Release: 2%{?dist} +Release: 1%{?dist} Summary: Twig extensions Group: Development/Libraries License: MIT -URL: http://twig.sensiolabs.org/doc/extensions/index.html +URL: http://twig-extensions.readthedocs.io/ 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-composer(symfony/translation) >= %{symfony_min_ver} +BuildRequires: php-composer(symfony/translation) < %{symfony_max_ver} +BuildRequires: php-composer(twig/twig) >= %{twig_min_ver} %if 0%{?fedora} < 25 -BuildRequires: php-composer(twig/twig) < 2 +BuildRequires: php-composer(twig/twig) < 2 +%else +BuildRequires: php-composer(twig/twig) < %{twig_max_ver} %endif -BuildRequires: php-composer(twig/twig) >= %{twig_min_ver} -## phpcompatinfo (computed from version 1.4.0) +## phpcompatinfo (computed from version 1.5.1) +BuildRequires: php(language) >= 5.3.0 BuildRequires: php-date BuildRequires: php-mbstring BuildRequires: php-pcre BuildRequires: php-spl +## Autoloader +BuildRequires: php-composer(fedora/autoloader) %endif # composer.json %if 0%{?fedora} < 25 -Requires: php-composer(twig/twig) < 2 +Requires: php-composer(twig/twig) < 2 %else -Requires: php-composer(twig/twig) < %{twig_max_ver} +Requires: php-composer(twig/twig) < %{twig_max_ver} %endif -Requires: php-composer(twig/twig) >= %{twig_min_ver} +Requires: php-composer(twig/twig) >= %{twig_min_ver} # composer.json: optional Requires: php-composer(symfony/translation) >= %{symfony_min_ver} Requires: php-composer(symfony/translation) < %{symfony_max_ver} -# phpcompatinfo (computed from version 1.4.0) -Requires: php-mbstring -Requires: php-pcre -Requires: php-spl +# phpcompatinfo (computed from version 1.5.1) +Requires: php(language) >= 5.3.0 +# Autoloader +Requires: php-composer(fedora/autoloader) # Composer Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} @@ -80,6 +85,8 @@ Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} %description Common additional features for Twig that do not directly belong in core Twig. +Autoloader: %{phpdir}/Twig/Extensions/autoload.php + %prep %setup -qn %{github_name}-%{github_commit} @@ -89,18 +96,23 @@ cat <<'AUTOLOAD' | tee lib/Twig/Extensions/autoload.php <?php /** * Autoloader for %{name} and its' dependencies - * - * Created by %{name}-%{version}-%{release} + * (created by %{name}-%{version}-%{release}). */ - -require_once __DIR__ . '/Autoloader.php'; -Twig_Extensions_Autoloader::register(); - -if (file_exists($dep='%{phpdir}/Twig2/autoload.php')) { - require_once $dep; -} else if (file_exists($dep='%{phpdir}/Twig/autoload.php')) { - require_once $dep; -} +require_once '%{phpdir}/Fedora/Autoloader/autoload.php'; + +\Fedora\Autoloader\Autoload::addPsr0('Twig_Extensions_', dirname(dirname(__DIR__))); +\Fedora\Autoloader\Autoload::addPsr4('Twig\\Extensions\\', __DIR__); + +\Fedora\Autoloader\Dependencies::required(array( + array( + '%{phpdir}/Twig2/autoload.php', + '%{phpdir}/Twig/autoload.php', + ), + array( + '%{phpdir}/Symfony3/Component/Translation/autoload.php', + '%{phpdir}/Symfony/Component/Translation/autoload.php', + ), +)); AUTOLOAD @@ -109,45 +121,34 @@ AUTOLOAD %install -rm -rf %{buildroot} - mkdir -p %{buildroot}%{phpdir} cp -rp lib/* %{buildroot}%{phpdir}/ +cp -rp src/* %{buildroot}%{phpdir}/Twig/Extensions/ %check +%if %{with_tests} +# under investigation sed -e 's/testLocalizedDateFilterWithDateTimeZone/SKIPtestLocalizedDateFilterWithDateTimeZone/' \ -i test/Twig/Tests/Extension/IntlTest.php -%if %{with_tests} -# remirepo:11 -run=0 -ret=0 -if which php56; then - php56 %{_bindir}/phpunit --bootstrap %{buildroot}%{phpdir}/Twig/Extensions/autoload.php || ret=1 - run=1 -fi -if which php71; then - php71 %{_bindir}/phpunit --bootstrap %{buildroot}%{phpdir}/Twig/Extensions/autoload.php || ret=1 - run=1 -fi -if [ $run -eq 0 ]; then -%{_bindir}/phpunit --verbose \ - --bootstrap %{buildroot}%{phpdir}/Twig/Extensions/autoload.php -# remirepo:2 -fi -exit $ret +: Upstream tests +RETURN_CODE=0 +PHPUNIT=$(which phpunit) +for PHP_EXEC in "" %{?rhel:php55} php56 php70 php71 php72; do + if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then + $PHP_EXEC $PHPUNIT --verbose \ + --bootstrap %{buildroot}%{phpdir}/Twig/Extensions/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 README.rst @@ -157,6 +158,13 @@ rm -rf %{buildroot} %changelog +* Sun Jul 09 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.5.1-1 +- Update to 1.5.1 (RHBZ #1456812) +- Add max version constraints to BuildRequires +- Switch autoloader to php-composer(fedora/autoloader) +- Add Symfony Translation to autoloader +- Test with SCLs if available + * Fri Jan 6 2017 Remi Collet <remi@fedoraproject.org> - 1.4.1-2 - use Twig 2 when installed but ensure it is not pulled by defaut to avoid pulling PHP 7 |