diff options
-rw-r--r-- | .gitignore | 7 | ||||
-rw-r--r-- | 3563.patch | 23 | ||||
-rw-r--r-- | PHPINFO | 4 | ||||
-rw-r--r-- | REFLECTION | 17 | ||||
-rw-r--r-- | composer.json | 14 | ||||
-rwxr-xr-x | makesrc.sh | 28 | ||||
-rw-r--r-- | php-twig.spec | 341 |
7 files changed, 186 insertions, 248 deletions
@@ -1,2 +1,9 @@ +clog +package-*.xml +*.tgz +*.tar.bz2 *.tar.gz +*.tar.xz +*.tar.xz.asc *.src.rpm +*/*rpm diff --git a/3563.patch b/3563.patch new file mode 100644 index 0000000..dcb0abb --- /dev/null +++ b/3563.patch @@ -0,0 +1,23 @@ +From 61df934a7ea2ed0c9860bf62c0c68f5318d99926 Mon Sep 17 00:00:00 2001 +From: Remi Collet <fedora@famillecollet.com> +Date: Wed, 22 Sep 2021 11:33:46 +0200 +Subject: [PATCH] Missing Environment and LoaderInterface + +--- + tests/escapingTest.php | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/tests/escapingTest.php b/tests/escapingTest.php +index a35ce9ab1..6ebb7b7e3 100644 +--- a/tests/escapingTest.php ++++ b/tests/escapingTest.php +@@ -2,6 +2,9 @@ + + namespace Twig\Tests; + ++use Twig\Environment; ++use Twig\Loader\LoaderInterface; ++ + /** + * This class is adapted from code coming from Zend Framework. + * diff --git a/PHPINFO b/PHPINFO deleted file mode 100644 index bf96a77..0000000 --- a/PHPINFO +++ /dev/null @@ -1,4 +0,0 @@ - -twig - -Version => 1.42.2 diff --git a/REFLECTION b/REFLECTION deleted file mode 100644 index faeac61..0000000 --- a/REFLECTION +++ /dev/null @@ -1,17 +0,0 @@ -Extension [ <persistent> extension #79 twig version 1.42.2 ] { - - - Functions { - Function [ <internal:twig> function twig_template_get_attributes ] { - - - Parameters [6] { - Parameter #0 [ <required> $template ] - Parameter #1 [ <required> $object ] - Parameter #2 [ <required> $item ] - Parameter #3 [ <required> $arguments ] - Parameter #4 [ <required> $type ] - Parameter #5 [ <required> $isDefinedTest ] - } - } - } -} - diff --git a/composer.json b/composer.json index 2f10465..46b0fc7 100644 --- a/composer.json +++ b/composer.json @@ -5,6 +5,7 @@ "keywords": ["templating"], "homepage": "https://twig.symfony.com", "license": "BSD-3-Clause", + "minimum-stability": "dev", "authors": [ { "name": "Fabien Potencier", @@ -14,7 +15,6 @@ }, { "name": "Twig Team", - "homepage": "https://twig.symfony.com/contributors", "role": "Contributors" }, { @@ -24,12 +24,11 @@ } ], "require": { - "php": ">=5.4.0", + "php": ">=7.2.5", "symfony/polyfill-ctype": "^1.8" }, "require-dev": { - "symfony/phpunit-bridge": "^3.4.19|^4.1.8|^5.0", - "symfony/debug": "^2.7", + "symfony/phpunit-bridge": "^4.4.9|^5.0.9", "psr/container": "^1.0" }, "autoload": { @@ -40,9 +39,14 @@ "Twig\\" : "src/" } }, + "autoload-dev": { + "psr-4" : { + "Twig\\Tests\\" : "tests" + } + }, "extra": { "branch-alias": { - "dev-master": "1.42-dev" + "dev-master": "1.44-dev" } } } diff --git a/makesrc.sh b/makesrc.sh new file mode 100755 index 0000000..97be9f6 --- /dev/null +++ b/makesrc.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +NAME=$(basename $PWD) +OWNER=$(sed -n '/^%global github_owner/{s/.* //;p}' $NAME.spec) +PROJECT=$(sed -n '/^%global github_name/{s/.* //;p}' $NAME.spec) +VERSION=$(sed -n '/^%global github_version/{s/.* //;p}' $NAME.spec) +COMMIT=$(sed -n '/^%global github_commit/{s/.* //;p}' $NAME.spec) +SHORT=${COMMIT:0:7} + +echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION\n" + +echo "Cloning..." +rm -rf $PROJECT-$COMMIT +git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT + +echo "Getting commit..." +pushd $PROJECT-$COMMIT +git checkout $COMMIT +cp composer.json ../composer.json +popd + +echo "Archiving..." +tar czf $NAME-$VERSION-$SHORT.tgz --exclude-vcs $PROJECT-$COMMIT + +echo "Cleaning..." +rm -rf $PROJECT-$COMMIT + +echo "Done." diff --git a/php-twig.spec b/php-twig.spec index 0591ef8..4331931 100644 --- a/php-twig.spec +++ b/php-twig.spec @@ -1,9 +1,8 @@ # remirepo spec file for php-twig -# With SCL stuff, from Fedora: # # Fedora spec file for php-twig # -# Copyright (c) 2014-2019 Shawn Iwinski <shawn.iwinski@gmail.com> +# Copyright (c) 2014-2022 Shawn Iwinski <shawn.iwinski@gmail.com> # Remi Collet <remi@fedoraproject.org> # # License: MIT @@ -11,163 +10,98 @@ # # Please preserve changelog entries # -%if 0%{?scl:1} -# PHPUnit not available in SCL -%global with_tests 0 -%global sub_prefix %{scl_prefix} -%scl_package php-twig -%else -%global pkg_name %{name} -%if 0%{?fedora} || 0%{?rhel} >= 8 + # Build using "--without tests" to disable tests -%global with_tests 0%{!?_without_tests:1} -%else -# Build using "--with tests" to enable tests -# PHPUnit in remi requires PHP 5.6 -%global with_tests 0%{?_with_tests:1} -%endif -%endif +%bcond_without tests %global github_owner twigphp %global github_name Twig -%global github_version 1.42.2 -%global github_commit 21707d6ebd05476854805e4f91b836531941bcd4 +%global github_version 1.44.7 +%global github_commit 0887422319889e442458e48e2f3d9add1a172ad5 %global github_short %(c=%{github_commit}; echo ${c:0:7}) -%if "%{php_version}" < "7" -%global with_ext 1 -%else -%global with_ext 0 -BuildArch: noarch -%endif - # Lib %global composer_vendor twig %global composer_project twig -# Ext -%global ext_name twig -%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} -%if "%{php_version}" < "5.6" -%global ini_name %{ext_name}.ini -%else -%global ini_name 40-%{ext_name}.ini -%endif +# "php": ">=7.2.5" +%global php_min_ver 7.2.5 -# "php": ">=5.4.0" -%global php_min_ver 5.4 +%{!?phpdir: %global phpdir %{_datadir}/php} +%{!?php_inidir: %global php_inidir %{_sysconfdir}/php.d} -%global phpdir %{_datadir}/php - -Name: %{?sub_prefix}php-%{composer_project} +Name: php-%{composer_project} Version: %{github_version} -Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 1%{?dist} Summary: The flexible, fast, and secure template engine for PHP License: BSD URL: http://twig.sensiolabs.org -Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{pkg_name}-%{github_version}-%{github_short}.tar.gz +Source0: %{name}-%{github_version}-%{github_short}.tgz +Source1: makesrc.sh -BuildRequires: %{?scl_prefix}php-devel >= %{php_min_ver} -%if %{with_tests} -# For tests -BuildRequires: php-composer(phpunit/phpunit) +BuildArch: noarch +# as we use phpunit9 (for assertFileDoesNotExist) +BuildRequires: php-devel >= 7.3 +# Tests +%if %{with tests} +# remirepo:1 %if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 -BuildRequires: (php-composer(symfony/debug) >= 2.7 with php-composer(symfony/debug) < 3) +BuildRequires: (php-composer(symfony/debug) >= 3.4 with php-composer(symfony/debug) < 4) BuildRequires: (php-composer(psr/container) >= 1.0 with php-composer(psr/container) < 2) +# remirepo:5 %else -BuildRequires: php-symfony-debug >= 2.7 -BuildRequires: php-composer(psr/container) < 2 -BuildRequires: php-composer(psr/container) >= 1.0 +BuildRequires: php-symfony3-debug >= 3.4 +BuildRequires: php-psr-container < 2 +BuildRequires: php-psr-container >= 1.0 %endif +%global phpunit %{_bindir}/phpunit9 +BuildRequires: %{phpunit} ## phpcompatinfo (computed from version 1.42.2) -BuildRequires: %{?scl_prefix}php-ctype -BuildRequires: %{?scl_prefix}php-date -BuildRequires: %{?scl_prefix}php-dom -BuildRequires: %{?scl_prefix}php-hash -BuildRequires: %{?scl_prefix}php-iconv -BuildRequires: %{?scl_prefix}php-json -BuildRequires: %{?scl_prefix}php-mbstring -BuildRequires: %{?scl_prefix}php-pcre -BuildRequires: %{?scl_prefix}php-reflection -BuildRequires: %{?scl_prefix}php-simplexml -BuildRequires: %{?scl_prefix}php-spl +BuildRequires: php-ctype +BuildRequires: php-date +BuildRequires: php-dom +BuildRequires: php-hash +BuildRequires: php-iconv +BuildRequires: php-json +BuildRequires: php-mbstring +BuildRequires: php-pcre +BuildRequires: php-reflection +BuildRequires: php-simplexml +BuildRequires: php-spl %endif # Autoloader BuildRequires: php-fedora-autoloader-devel # Lib ## composer.json -Requires: %{?scl_prefix}php(language) >= %{php_min_ver} +Requires: php(language) >= %{php_min_ver} ## phpcompatinfo (computed from version 1.42.2) -Requires: %{?scl_prefix}php-ctype -Requires: %{?scl_prefix}php-date -Requires: %{?scl_prefix}php-dom -Requires: %{?scl_prefix}php-hash -Requires: %{?scl_prefix}php-iconv -Requires: %{?scl_prefix}php-json -Requires: %{?scl_prefix}php-mbstring -Requires: %{?scl_prefix}php-pcre -Requires: %{?scl_prefix}php-reflection -Requires: %{?scl_prefix}php-simplexml -Requires: %{?scl_prefix}php-spl -%if %{with_ext} -# Ext -Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} -Requires: %{?scl_prefix}php(api) = %{php_core_api} -%{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}} -%endif +Requires: php-ctype +Requires: php-date +Requires: php-dom +Requires: php-hash +Requires: php-iconv +Requires: php-json +Requires: php-mbstring +Requires: php-pcre +Requires: php-reflection +Requires: php-simplexml +Requires: php-spl # Autoloader Requires: php-composer(fedora/autoloader) # Lib ## Composer -Provides: %{?scl_prefix}php-composer(%{composer_vendor}/%{composer_project}) = %{version} +Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} ## Rename -Obsoletes: %{?scl_prefix}php-twig-Twig < %{version}-%{release} -Provides: %{?scl_prefix}php-twig-Twig = %{version}-%{release} +Obsoletes: php-twig-Twig < %{version}-%{release} +Provides: php-twig-Twig = %{version}-%{release} ## PEAR -Provides: %{?scl_prefix}php-pear(pear.twig-project.org/Twig) = %{version} -%if %{with_ext} -# Ext -## Rename -Obsoletes: %{?scl_prefix}php-twig-ctwig < %{version}-%{release} -Provides: %{?scl_prefix}php-twig-ctwig = %{version}-%{release} -Provides: %{?scl_prefix}php-twig-ctwig%{?_isa} = %{version}-%{release} -%if "%{?scl_prefix}" != "%{?sub_prefix}" -## Compat SCL (rh-php56) -Provides: %{?scl_prefix}php-twig = %{version}-%{release} -Provides: %{?scl_prefix}php-twig%{?_isa} = %{version}-%{release} -%endif -## PECL -Provides: %{?scl_prefix}php-pecl(pear.twig-project.org/CTwig) = %{version} -Provides: %{?scl_prefix}php-pecl(pear.twig-project.org/CTwig)%{?_isa} = %{version} -%endif +Provides: php-pear(pear.twig-project.org/Twig) = %{version} # This pkg was the only one in this channel so the channel is no longer needed -Obsoletes: %{?scl_prefix}php-channel-twig - -%if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} -# Other third party repo stuff -Obsoletes: php53-%{ext_name} <= %{version} -Obsoletes: php53u-%{ext_name} <= %{version} -Obsoletes: php54-%{ext_name} <= %{version} -Obsoletes: php54w-%{ext_name} <= %{version} -%if "%{php_version}" > "5.5" -Obsoletes: php55u-%{ext_name} <= %{version} -Obsoletes: php55w-%{ext_name} <= %{version} -%endif -%if "%{php_version}" > "5.6" -Obsoletes: php56u-%{ext_name} <= %{version} -Obsoletes: php56w-%{ext_name} <= %{version} -%endif -%endif - -%if 0%{?fedora} < 20 && 0%{?rhel} < 7 -# Filter shared private -%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$} -%{?filter_setup} -%endif +Obsoletes: php-channel-twig < 1.4 %description @@ -184,31 +118,12 @@ Obsoletes: php56w-%{ext_name} <= %{version} developer to define its own custom tags and filters, and create its own DSL. -Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')%{?scl: as Software Collection (%{scl} by %{?scl_vendor}%{!?scl_vendor:rh})}. +Autoloader: %{phpdir}/Twig/autoload.php %prep %setup -qn %{github_name}-%{github_commit} -: PHP version %{php_version} -: Build extension %{with_ext} - -%if %{with_ext} -: Ext -- NTS -mv ext/%{ext_name} ext/NTS -sed -e '/PHP_TWIG_VERSION/s/-DEV//' -i ext/NTS/php_twig.h - %if %{with_zts} -: Ext -- ZTS -cp -pr ext/NTS ext/ZTS -%endif - -: Ext -- Create configuration file -cat > %{ini_name} << 'INI' -; Enable %{ext_name} extension module -extension=%{ext_name}.so -INI -%endif - : Move the PSR-4 compat library mv src lib/Twig/psr4 @@ -217,45 +132,14 @@ phpab --template fedora --output lib/Twig/autoload.php lib %build -%{?dtsenable} - -%if %{with_ext} -: Ext -- NTS -pushd ext/NTS -%{_bindir}/phpize -%configure --with-php-config=%{_bindir}/php-config -make %{?_smp_mflags} -popd - -: Ext -- ZTS -%if %{with_zts} -pushd ext/ZTS -%{_bindir}/zts-phpize -%configure --with-php-config=%{_bindir}/zts-php-config -make %{?_smp_mflags} -popd -%endif -%endif +: nothing %install -%{?dtsenable} - : PSR-0 and PSR-4 Libraries mkdir -p %{buildroot}%{phpdir} cp -rp lib/* %{buildroot}%{phpdir}/ -%if %{with_ext} -: Ext -- NTS -make -C ext/NTS install INSTALL_ROOT=%{buildroot} -install -D -m 0644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name} -: Ext -- ZTS -%if %{with_zts} -make -C ext/ZTS install INSTALL_ROOT=%{buildroot} -install -D -m 0644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} -%endif -%endif - %check : Library version check @@ -265,85 +149,98 @@ install -D -m 0644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} %{_bindir}/php -r 'require_once "%{buildroot}%{phpdir}/Twig/autoload.php"; exit(version_compare("%{version}", Twig\Environment::VERSION, "=") ? 0 : 1);' -%if %{with_ext} -: Extension version check -EXT_VERSION=`grep PHP_TWIG_VERSION ext/NTS/php_twig.h | awk '{print $3}' | sed 's/"//g'` \ - %{_bindir}/php -r 'exit(version_compare("%{version}", getenv("EXT_VERSION"), "=") ? 0 : 1);' - -: Extension NTS minimal load test -%{__php} --no-php-ini \ - --define extension=ext/NTS/modules/%{ext_name}.so \ - --modules | grep %{ext_name} - -%if %{with_zts} -: Extension ZTS minimal load test -%{__ztsphp} --no-php-ini \ - --define extension=ext/ZTS/modules/%{ext_name}.so \ - --modules | grep %{ext_name} -%endif -%endif - -%if %{with_tests} +%if %{with tests} : Generate autoloader mkdir vendor cat << 'EOF' | tee vendor/autoload.php <?php require_once '%{buildroot}%{phpdir}/Twig/autoload.php'; +\Fedora\Autoloader\Autoload::addPsr4('Twig\\Tests\\', dirname(__DIR__) . '/tests'); \Fedora\Autoloader\Dependencies::required(array( - '%{phpdir}/Symfony/Component/Debug/autoload.php', + '%{phpdir}/Symfony3/Component/Debug/autoload.php', '%{phpdir}/Psr/Container/autoload.php', )); EOF -: Skip tests known to fail -%if 0%{?rhel} == 6 -sed -e 's/function testGetAttributeWithTemplateAsObject/function skip_testGetAttributeWithTemplateAsObject/' \ - -i test/Twig/Tests/TemplateTest.php -%endif - -: Disable listener from symfony/phpunit-bridge ~3.2 +: Disable listener from symfony/phpunit-bridge # ^4.4.9|^5.0.9 sed -e '/listener/d' phpunit.xml.dist > phpunit.xml : Test suite without extension ret=0 -# TODO : 2 failed tests with 7.4 (Function ReflectionType::__toString() is deprecated) -for cmd in php php71 php72 php73; do - if which $cmd; then - $cmd %{_bindir}/phpunit --verbose || ret=1 - fi +for SCL in "php %{phpunit}" php74 php80 php81 php82; do + if which $SCL; then + set $SCL + $1 ${2:-%{_bindir}/phpunit9} $SKIP \ + --verbose || RETURN_CODE=1 + fi done -%if %{with_ext} -: Test suite with extension -%{_bindir}/php --define extension=ext/NTS/modules/%{ext_name}.so \ - %{_bindir}/phpunit --verbose || ret=1 -%endif - -exit $ret +exit $RETURN_CODE %else : Tests skipped %endif %files +# remirepo:1 %{!?_licensedir:%global license %%doc} %license LICENSE %doc CHANGELOG README.rst composer.json # Lib %{phpdir}/Twig -%if %{with_ext} -# Ext -## NTS -%config(noreplace) %{php_inidir}/%{ini_name} -%{php_extdir}/%{ext_name}.so -## ZTS -%if %{with_zts} -%config(noreplace) %{php_ztsinidir}/%{ini_name} -%{php_ztsextdir}/%{ext_name}.so -%endif -%endif %changelog +* Thu Sep 29 2022 Remi Collet <remi@remirepo.net> - 1.44.7-1 +- update to 1.44.7 + +* Thu Nov 25 2021 Remi Collet <remi@remirepo.net> - 1.44.6-1 +- update to 1.44.6 (no change) +- drop patch merged upstream + +* Wed Sep 22 2021 Remi Collet <remi@remirepo.net> - 1.44.5-1 +- update to 1.44.5 +- add patch for test suite from https://github.com/twigphp/Twig/pull/3563 + +* Mon May 17 2021 Remi Collet <remi@remirepo.net> - 1.44.4-1 +- update to 1.44.4 + +* Wed May 12 2021 Remi Collet <remi@remirepo.net> - 1.44.3-1 +- update to 1.44.3 + +* Wed Jan 6 2021 Remi Collet <remi@remirepo.net> - 1.44.2-1 +- update to 1.44.2 + +* Wed Oct 28 2020 Remi Collet <remi@remirepo.net> - 1.44.1-1 +- update to 1.44.1 + +* Wed Oct 21 2020 Remi Collet <remi@remirepo.net> - 1.44.0-1 +- update to 1.44.0 +- raise dependency on PHP 7.2.5 + +* Tue Aug 11 2020 Remi Collet <remi@remirepo.net> - 1.43.1-1 +- update to 1.43.1 +- switch to phpunit9 +- skip 1 more test with PHP 8.0 + +* Mon Jul 6 2020 Remi Collet <remi@remirepo.net> - 1.43.0-1 +- update to 1.43.0 +- raise dependency on PHP 7.1.3 +- switch to phpunit8 + +* Wed Feb 12 2020 Remi Collet <remi@remirepo.net> - 1.42.5-1 +- update to 1.42.5 + +* Tue Nov 12 2019 Remi Collet <remi@remirepo.net> - 1.42.4-1 +- update to 1.42.4 +- sources from git snapshot + +* Tue Aug 27 2019 Remi Collet <remi@remirepo.net> - 1.42.3-1 +- update to 1.42.3 +- use symfony/debug v3 +- use phpunit v7 +- raise dependency on PHP 5.5 +- drop support of the C extension + * Tue Jun 18 2019 Shawn Iwinski <shawn@iwin.ski> - 1.42.2-1 - Update to 1.42.2 |