diff --git a/.gitignore b/.gitignore index 6bbc88a..8073795 100644 --- a/.gitignore +++ b/.gitignore @@ -37,23 +37,3 @@ clog /php-twig-1.38.2-874adbd9222f928f6998732b25b01b41dff15b0c.tar.gz /php-twig-1.38.3-5df0ef0ca2d08a6f087384c7f31530fb84889f28.tar.gz /php-twig-1.38.4-7732e9e7017d751313811bd118de61302e9c8b35.tar.gz -/php-twig-1.39.1-23e7b6f0cfa1d7ba3de69f30d8e05cf957412fec.tar.gz -/php-twig-1.40.0-2ba4eaf6b0649760a2cdbc0ada19486f9c1b4125.tar.gz -/php-twig-1.40.1-35889516bbd6bbe46a600c2c33b03515df4a076e.tar.gz -/php-twig-1.41.0-575cd5028362da591facde1ef5d7b94553c375c9.tar.gz -/php-twig-1.42.0-2983fcf2e20a4afe95f07e61d89a7590b3c8df2e.tar.gz -/php-twig-1.42.1-671347603760a88b1e7288aaa9378f33687d7edf.tar.gz -/php-twig-1.42.2-21707d6ebd05476854805e4f91b836531941bcd4.tar.gz -/php-twig-1.42.3-201baee843e0ffe8b0b956f336dd42b2a92fae4e.tar.gz -/php-twig-1.42.4-e587180.tgz -/php-twig-1.42.5-87b2ea9.tgz -/php-twig-1.43.0-597a03e.tgz -/php-twig-1.43.1-2311602.tgz -/php-twig-1.44.0-e7c93a4.tgz -/php-twig-1.44.1-04b15d4.tgz -/php-twig-1.44.2-138c493.tgz -/php-twig-1.44.3-920a9b9.tgz -/php-twig-1.44.4-4d40042.tgz -/php-twig-1.44.5-dd43533.tgz -/php-twig-1.44.6-ae39480.tgz -/php-twig-1.44.7-0887422.tgz diff --git a/composer.json b/composer.json deleted file mode 100644 index 46b0fc7..0000000 --- a/composer.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "twig/twig", - "type": "library", - "description": "Twig, the flexible, fast, and secure template language for PHP", - "keywords": ["templating"], - "homepage": "https://twig.symfony.com", - "license": "BSD-3-Clause", - "minimum-stability": "dev", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, - { - "name": "Twig Team", - "role": "Contributors" - }, - { - "name": "Armin Ronacher", - "email": "armin.ronacher@active-4.com", - "role": "Project Founder" - } - ], - "require": { - "php": ">=7.2.5", - "symfony/polyfill-ctype": "^1.8" - }, - "require-dev": { - "symfony/phpunit-bridge": "^4.4.9|^5.0.9", - "psr/container": "^1.0" - }, - "autoload": { - "psr-0" : { - "Twig_" : "lib/" - }, - "psr-4" : { - "Twig\\" : "src/" - } - }, - "autoload-dev": { - "psr-4" : { - "Twig\\Tests\\" : "tests" - } - }, - "extra": { - "branch-alias": { - "dev-master": "1.44-dev" - } - } -} diff --git a/makesrc.sh b/makesrc.sh deleted file mode 100755 index 97be9f6..0000000 --- a/makesrc.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/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 041fe1d..741e283 100644 --- a/php-twig.spec +++ b/php-twig.spec @@ -1,7 +1,7 @@ # # Fedora spec file for php-twig # -# Copyright (c) 2014-2022 Shawn Iwinski +# Copyright (c) 2014-2019 Shawn Iwinski # Remi Collet # # License: MIT @@ -10,46 +10,62 @@ # Please preserve changelog entries # -# Build using "--without tests" to disable tests -%bcond_without tests - %global github_owner twigphp %global github_name Twig -%global github_version 1.44.7 -%global github_commit 0887422319889e442458e48e2f3d9add1a172ad5 -%global github_short %(c=%{github_commit}; echo ${c:0:7}) +%global github_version 1.38.4 +%global github_commit 7732e9e7017d751313811bd118de61302e9c8b35 + +%if 0%{?fedora} < 25 && 0%{?rhel} < 8 +%global with_ext 1 +%else +%global with_ext 0 +BuildArch: noarch +%endif # Lib %global composer_vendor twig %global composer_project twig -# "php": ">=7.2.5" -%global php_min_ver 7.2.5 +# 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": ">=5.4.0" +%global php_min_ver 5.4 + +# Build using "--without tests" to disable tests +%global with_tests 0%{!?_without_tests:1} %{!?phpdir: %global phpdir %{_datadir}/php} %{!?php_inidir: %global php_inidir %{_sysconfdir}/php.d} Name: php-%{composer_project} Version: %{github_version} -Release: 9%{?dist} +Release: 2%{?dist} Summary: The flexible, fast, and secure template engine for PHP -# Automatically converted from old format: BSD - review is highly recommended. -License: LicenseRef-Callaway-BSD +License: BSD URL: http://twig.sensiolabs.org -Source0: %{name}-%{github_version}-%{github_short}.tgz -Source1: makesrc.sh +Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz -BuildArch: noarch -# as we use phpunit9 (for assertFileDoesNotExist) -BuildRequires: php-devel >= 7.3 +BuildRequires: php-devel >= %{php_min_ver} # Tests -%if %{with tests} -BuildRequires: (php-composer(symfony/debug) >= 3.4 with php-composer(symfony/debug) < 4) +%if %{with_tests} +BuildRequires: php-composer(phpunit/phpunit) +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 +BuildRequires: (php-composer(symfony/debug) >= 2.7 with php-composer(symfony/debug) < 3) BuildRequires: (php-composer(psr/container) >= 1.0 with php-composer(psr/container) < 2) -%global phpunit %{_bindir}/phpunit9 -BuildRequires: %{phpunit} -## phpcompatinfo (computed from version 1.42.2) +%else +BuildRequires: php-symfony-debug >= 2.7 +BuildRequires: php-composer(psr/container) < 2 +BuildRequires: php-composer(psr/container) >= 1.0 +%endif +## phpcompatinfo (computed from version 1.34.2) BuildRequires: php-ctype BuildRequires: php-date BuildRequires: php-dom @@ -59,7 +75,6 @@ BuildRequires: php-json BuildRequires: php-mbstring BuildRequires: php-pcre BuildRequires: php-reflection -BuildRequires: php-simplexml BuildRequires: php-spl %endif # Autoloader @@ -68,7 +83,7 @@ BuildRequires: php-fedora-autoloader-devel # Lib ## composer.json Requires: php(language) >= %{php_min_ver} -## phpcompatinfo (computed from version 1.42.2) +## phpcompatinfo (computed from version 1.34.2) Requires: php-ctype Requires: php-date Requires: php-dom @@ -78,8 +93,12 @@ Requires: php-json Requires: php-mbstring Requires: php-pcre Requires: php-reflection -Requires: php-simplexml Requires: php-spl +# Ext +%if %{with_ext} +Requires: php(zend-abi) = %{php_zend_api} +Requires: php(api) = %{php_core_api} +%endif # Autoloader Requires: php-composer(fedora/autoloader) @@ -91,9 +110,19 @@ Obsoletes: php-twig-Twig < %{version}-%{release} Provides: php-twig-Twig = %{version}-%{release} ## PEAR Provides: php-pear(pear.twig-project.org/Twig) = %{version} +# Ext +%if %{with_ext} +## Rename +Obsoletes: php-twig-ctwig < %{version}-%{release} +Provides: php-twig-ctwig = %{version}-%{release} +Provides: php-twig-ctwig%{?_isa} = %{version}-%{release} +## PECL +Provides: php-pecl(pear.twig-project.org/CTwig) = %{version} +Provides: php-pecl(pear.twig-project.org/CTwig)%{?_isa} = %{version} +%endif # This pkg was the only one in this channel so the channel is no longer needed -Obsoletes: php-channel-twig < 1.4 +Obsoletes: php-channel-twig %description @@ -116,6 +145,21 @@ Autoloader: %{phpdir}/Twig/autoload.php %prep %setup -qn %{github_name}-%{github_commit} +%if %{with_ext} +: Ext -- NTS +mv ext/%{ext_name} ext/NTS +%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 @@ -124,7 +168,23 @@ phpab --template fedora --output lib/Twig/autoload.php lib %build -: nothing +%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 %install @@ -132,6 +192,17 @@ phpab --template fedora --output lib/Twig/autoload.php lib 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 @@ -141,163 +212,88 @@ cp -rp lib/* %{buildroot}%{phpdir}/ %{_bindir}/php -r 'require_once "%{buildroot}%{phpdir}/Twig/autoload.php"; exit(version_compare("%{version}", Twig\Environment::VERSION, "=") ? 0 : 1);' -%if %{with tests} +%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 +%{_bindir}/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} : Generate autoloader mkdir vendor cat << 'EOF' | tee vendor/autoload.php phpunit.xml +: Skip tests known to fail +sed -e 's#function testGetAttributeExceptions#function SKIP_testGetAttributeExceptions#' \ + -e 's/function testGetAttributeWithTemplateAsObject/function skip_testGetAttributeWithTemplateAsObject/' \ + -i test/Twig/Tests/TemplateTest.php +%ifarch ppc64 +sed 's/function testGetAttributeWithTemplateAsObject/function SKIP_testGetAttributeWithTemplateAsObject/' \ + -i test/Twig/Tests/TemplateTest.php +%endif + : Test suite without extension ret=0 -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 +for cmd in php php56 php70 php71 php72 php73; do + if which $cmd; then + $cmd %{_bindir}/phpunit --verbose || ret=1 + fi done -exit $RETURN_CODE + +%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 %else : Tests skipped %endif %files +%{!?_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 -* Fri Jul 25 2025 Fedora Release Engineering - 1.44.7-9 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild - -* Sat Jan 18 2025 Fedora Release Engineering - 1.44.7-8 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild - -* Wed Sep 4 2024 Miroslav Suchý - 1.44.7-7 -- convert license to SPDX - -* Fri Jul 19 2024 Fedora Release Engineering - 1.44.7-6 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild - -* Thu Jan 25 2024 Fedora Release Engineering - 1.44.7-5 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Sun Jan 21 2024 Fedora Release Engineering - 1.44.7-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Fri Jul 21 2023 Fedora Release Engineering - 1.44.7-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild - -* Fri Jan 20 2023 Fedora Release Engineering - 1.44.7-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild - -* Thu Sep 29 2022 Remi Collet - 1.44.7-1 -- update to 1.44.7 - -* Fri Jul 22 2022 Fedora Release Engineering - 1.44.6-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild - -* Fri Jan 21 2022 Fedora Release Engineering - 1.44.6-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild - -* Thu Nov 25 2021 Remi Collet - 1.44.6-1 -- update to 1.44.6 (no change) -- drop patch merged upstream - -* Wed Sep 22 2021 Remi Collet - 1.44.5-1 -- update to 1.44.5 -- add patch for test suite from https://github.com/twigphp/Twig/pull/3563 - -* Tue Jul 27 2021 Fedora Release Engineering - 1.44.4-2 -- Second attempt - Rebuilt for - https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild - -* Mon May 17 2021 Remi Collet - 1.44.4-1 -- update to 1.44.4 - -* Wed May 12 2021 Remi Collet - 1.44.3-1 -- update to 1.44.3 - -* Wed Jan 27 2021 Fedora Release Engineering - 1.44.2-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - -* Wed Jan 6 2021 Remi Collet - 1.44.2-1 -- update to 1.44.2 - -* Wed Oct 28 2020 Remi Collet - 1.44.1-1 -- update to 1.44.1 - -* Wed Oct 21 2020 Remi Collet - 1.44.0-1 -- update to 1.44.0 -- raise dependency on PHP 7.2.5 - -* Tue Aug 11 2020 Remi Collet - 1.43.1-1 -- update to 1.43.1 -- switch to phpunit9 -- skip 1 more test with PHP 8.0 - -* Tue Jul 28 2020 Fedora Release Engineering - 1.43.0-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild - -* Mon Jul 6 2020 Remi Collet - 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 - 1.42.5-1 -- update to 1.42.5 - -* Thu Jan 30 2020 Fedora Release Engineering - 1.42.4-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild - -* Tue Nov 12 2019 Remi Collet - 1.42.4-1 -- update to 1.42.4 -- sources from git snapshot - -* Tue Aug 27 2019 Remi Collet - 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 - -* Fri Jul 26 2019 Fedora Release Engineering - 1.42.2-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild - -* Tue Jun 18 2019 Shawn Iwinski - 1.42.2-1 -- Update to 1.42.2 - -* Tue Jun 4 2019 Remi Collet - 1.42.1-1 -- update to 1.42.1 - -* Mon Jun 3 2019 Remi Collet - 1.42.0-1 -- update to 1.42.0 - -* Wed May 15 2019 Remi Collet - 1.41.0-1 -- update to 1.41.0 - -* Tue Apr 30 2019 Remi Collet - 1.40.1-1 -- update to 1.40.1 - -* Mon Apr 29 2019 Remi Collet - 1.40.0-1 -- update to 1.40.0 - -* Wed Apr 17 2019 Remi Collet - 1.39.1-1 -- update to 1.39.1 - * Mon Mar 25 2019 Remi Collet - 1.38.4-1 - update to 1.38.4 diff --git a/sources b/sources index a2b94d0..cf0c6a9 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (php-twig-1.44.7-0887422.tgz) = 7dbf734b7113dd0e1be34710d4a369cd902ab955346c4348a003a9844c8d55316f0f0713fe208d2b62f03cf4c799885432f79162b1c62c7b9304862f5b7c89b0 +SHA512 (php-twig-1.38.4-7732e9e7017d751313811bd118de61302e9c8b35.tar.gz) = 02c7c064b46729b6a4bf04a421848217605373c338de3f6099ac7673688c9e6658b6bbcd19f682a1181ecba8223730d252299c9fd8f8b6ee0c6879bdb3f1c507