From bd9e77f0a7a8d34fbdc5f67552d333de01094388 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 21 Nov 2019 11:02:10 +0100 Subject: duplicate v2 stuff --- .gitignore | 8 ++ composer.json | 54 ++++++++ makesrc.sh | 28 ++++ php-twig3.spec | 420 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 510 insertions(+) create mode 100644 .gitignore create mode 100644 composer.json create mode 100755 makesrc.sh create mode 100644 php-twig3.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fc9aa8c --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +clog +package-*.xml +*.tgz +*.tar.gz +*.tar.xz +*.tar.xz.asc +*.src.rpm +*/*rpm diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..567d263 --- /dev/null +++ b/composer.json @@ -0,0 +1,54 @@ +{ + "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", + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Twig Team", + "homepage": "https://twig.symfony.com/contributors", + "role": "Contributors" + }, + { + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + } + ], + "require": { + "php": "^7.0", + "symfony/polyfill-mbstring": "^1.3", + "symfony/polyfill-ctype": "^1.8" + }, + "require-dev": { + "symfony/phpunit-bridge": "^4.4@dev|^5.0", + "symfony/debug": "^3.4|^4.2", + "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": "2.12-dev" + } + } +} diff --git a/makesrc.sh b/makesrc.sh new file mode 100755 index 0000000..8036200 --- /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 '/^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-twig3.spec b/php-twig3.spec new file mode 100644 index 0000000..307bcfb --- /dev/null +++ b/php-twig3.spec @@ -0,0 +1,420 @@ +# fedora/remirepo spec file for php-twig2, from +# +# Fedora spec file for php-twig +# +# Copyright (c) 2014-2019 Shawn Iwinski +# Remi Collet +# +# License: MIT +# http://opensource.org/licenses/MIT +# +# Please preserve changelog entries +# +%global with_tests 0%{!?_without_tests:1} +%global github_owner twigphp +%global github_name Twig +%global github_commit d761fd1f1c6b867ae09a7d8119a6d95d06dc44ed +%global github_short %(c=%{github_commit}; echo ${c:0:7}) + +%global composer_vendor twig +%global composer_project twig + +# "php": "^7.0" +%global php_min_ver 7.0 +%global phpdir %{_datadir}/php + +Name: php-%{composer_project}2 +Version: 2.12.2 +Release: 1%{?dist} +Summary: The flexible, fast, and secure template engine for PHP + +License: BSD +URL: https://twig.symfony.com +Source0: %{name}-%{version}-%{github_short}.tgz +Source1: makesrc.sh + +BUildArch: noarch +## Autoloader +BuildRequires: php-fedora-autoloader-devel +%if %{with_tests} +# For tests +BuildRequires: php(language) >= 7.1 +BuildRequires: phpunit7 +# remirepo:1 +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 +BuildRequires: (php-composer(symfony/debug) >= 4.2 with php-composer(symfony/debug) < 5) +BuildRequires: (php-composer(psr/container) >= 1.0 with php-composer(psr/container) < 2) +BuildRequires: (php-composer(symfony/polyfill-mbstring) >= 1.3 with php-composer(symfony/polyfill-mbstring) < 2) +# remirepo:7 +%else +BuildRequires: php-symfony3-debug >= 3.4 +BuildRequires: php-composer(psr/container) < 2 +BuildRequires: php-composer(psr/container) >= 1.0 +BuildRequires: php-symfony-polyfill < 2 +BuildRequires: php-symfony-polyfill >= 1.3 +%endif +# Workaround +BuildRequires: php-symfony-common +## phpcompatinfo (computed from version 2.11.3) +BuildRequires: php-ctype +BuildRequires: php-date +BuildRequires: php-hash +BuildRequires: php-iconv +BuildRequires: php-json +BuildRequires: php-mbstring +BuildRequires: php-pcre +BuildRequires: php-reflection +BuildRequires: php-spl +BuildRequires: php-simplexml +%endif + +## composer.json +Requires: php(language) >= %{php_min_ver} +# remirepo:1 +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 +Requires: (php-composer(symfony/polyfill-mbstring) >= 1.3 with php-composer(symfony/polyfill-mbstring) < 2) +# remirepo:4 +%else +Requires: php-symfony-polyfill < 2 +Requires: php-symfony-polyfill >= 1.3 +%endif +## phpcompatinfo (computed from version 2.11.3) +Requires: php-ctype +Requires: php-date +Requires: php-hash +Requires: php-iconv +Requires: php-json +Requires: php-mbstring +Requires: php-pcre +Requires: php-reflection +Requires: php-spl +# Autoloader +Requires: php-composer(fedora/autoloader) + +## Composer +Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} + + +%description +%{summary}. + +* Fast: Twig compiles templates down to plain optimized PHP code. The + overhead compared to regular PHP code was reduced to the very minimum. + +* Secure: Twig has a sandbox mode to evaluate untrusted template code. This + allows Twig to be used as a template language for applications where users + may modify the template design. + +* Flexible: Twig is powered by a flexible lexer and parser. This allows the + developer to define its own custom tags and filters, and create its own + DSL. + +Autoloader: %{phpdir}/Twig2/autoload.php + + +%prep +%setup -qn %{github_name}-%{github_commit} + +: Move the PSR-4 compat library +mv src lib/Twig/psr4 + + +%build +: Create classmap autoloader +phpab --template fedora --output lib/Twig/autoload.php lib/Twig +cat << 'EOF' | tee -a lib/Twig/autoload.php +require_once '%{phpdir}/Symfony/Polyfill/autoload.php'; +EOF + + +%install +mkdir -p %{buildroot}%{phpdir} +cp -rp lib/Twig %{buildroot}%{phpdir}/Twig2 + + +%check +: Check library version +%{_bindir}/php -r 'require_once "%{buildroot}%{phpdir}/Twig2/autoload.php"; + exit(version_compare("%{version}", Twig_Environment::VERSION, "=") ? 0 : 1);' + +%{_bindir}/php -r 'require_once "%{buildroot}%{phpdir}/Twig2/autoload.php"; + exit(version_compare("%{version}", Twig\Environment::VERSION, "=") ? 0 : 1);' + +%if %{with_tests} +mkdir vendor +phpab --output vendor/autoload.php tests + + +cat << 'EOF' | tee -a vendor/autoload.php +// This library +require_once '%{buildroot}%{phpdir}/Twig2/autoload.php'; +// Dependencies (require-dev) +\Fedora\Autoloader\Dependencies::required([ + [ + '%{phpdir}/Symfony4/Component/Debug/autoload.php', + '%{phpdir}/Symfony3/Component/Debug/autoload.php', + ], + '%{phpdir}/Psr/Container/autoload.php', +]); +EOF + +: Disable listener from symfony/phpunit-bridge ~3.2 +sed -e '/listener/d' phpunit.xml.dist > phpunit.xml + +RETURN_CODE=0 +: Upstream tests with SCLs if available +for SCL in php php71 php72 php73 php74; do + if which $SCL; then + $SCL %{_bindir}/phpunit7 --verbose || RETURN_CODE=1 + fi +done +exit $RETURN_CODE +%else +: Tests skipped +%endif + + +%files +# remirepo:1 +%{!?_licensedir:%global license %%doc} +%license LICENSE +%doc CHANGELOG README.rst composer.json +%{phpdir}/Twig2 + + +%changelog +* Tue Nov 12 2019 Remi Collet - 2.12.2-1 +- update to 2.12.2 + +* Thu Oct 17 2019 Remi Collet - 2.12.1-1 +- update to 2.12.1 (no change) +- sources from git snapshot + +* Mon Oct 7 2019 Remi Collet - 2.12.0-1 +- update to 2.12.0 +- use phpunit7 and Symfony 4 for test suite + +* Tue Jun 18 2019 Shawn Iwinski - 2.11.3-1 +- Update to 2.11.3 + +* Wed Jun 5 2019 Remi Collet - 2.11.2-1 +- update to 2.11.2 + +* Tue Jun 4 2019 Remi Collet - 2.11.1-1 +- update to 2.11.1 + +* Mon Jun 3 2019 Remi Collet - 2.11.0-1 +- update to 2.11.0 + +* Wed May 15 2019 Remi Collet - 2.10.0-1 +- update to 2.10.0 + +* Mon Apr 29 2019 Remi Collet - 2.9.0-1 +- update to 2.9.0 + +* Wed Apr 17 2019 Remi Collet - 2.8.1-1 +- update to 2.8.1 + +* Mon Mar 25 2019 Remi Collet - 2.7.4-1 +- update to 2.7.4 + +* Fri Mar 22 2019 Remi Collet - 2.7.3-1 +- update to 2.7.3 + +* Wed Mar 13 2019 Remi Collet - 2.7.2-1 +- update to 2.7.2 + +* Tue Mar 12 2019 Remi Collet - 2.7.0-1 +- update to 2.7.0 + +* Mon Jan 14 2019 Remi Collet - 2.6.2-1 +- update to 2.6.2 + +* Tue Dec 18 2018 Remi Collet - 2.6.0-1 +- update to 2.6.0 +- add dependency on symfony/polyfill-mbstring 1.3 + +* Fri Jul 13 2018 Remi Collet - 2.5.0-1 +- update to 2.5.0 +- use phpunit6 for test suite + +* Tue Apr 3 2018 Remi Collet - 2.4.8-1 +- update to 2.4.8 + +* Tue Mar 20 2018 Remi Collet - 2.4.7-1 +- update to 2.4.7 + +* Sun Mar 4 2018 Remi Collet - 2.4.6-1 +- Update to 2.4.6 + +* Sat Mar 3 2018 Remi Collet - 2.4.5-1 +- Update to 2.4.5 +- use range dependencies on F27+ + +* Thu Sep 28 2017 Remi Collet - 2.4.4-1 +- Update to 2.4.4 + +* Thu Jun 8 2017 Remi Collet - 2.4.3-1 +- Update to 2.4.3 + +* Tue Jun 6 2017 Remi Collet - 2.4.2-1 +- Update to 2.4.2 +- add namespaced compat library + +* Fri Apr 21 2017 Remi Collet - 2.3.2-1 +- Update to 2.3.2 + +* Thu Mar 23 2017 Remi Collet - 2.3.0-1 +- Update to 2.3.0 + +* Mon Feb 27 2017 Remi Collet - 2.2.0-1 +- update to 2.2.0 +- add dependency on psr/container + +* Wed Jan 11 2017 Remi Collet - 2.1.0-1 +- update to 2.1.0 + +* Fri Jan 6 2017 Remi Collet - 2.0.0-1 +- update to 2.0.0 +- rename to php-twig2 +- cleanup spec file, no more C extension +- use fedora/autoloader +- raise dependency on PHP version 7 + +* Fri Dec 23 2016 Remi Collet - 1.30.0-1 +- Update to 1.30.0 + +* Wed Dec 14 2016 Remi Collet - 1.29.0-1 +- Update to 1.29.0 + +* Thu Nov 24 2016 Remi Collet - 1.28.2-1 +- Update to 1.28.2 + +* Tue Nov 22 2016 Remi Collet - 1.28.1-1 +- Update to 1.28.1 + +* Fri Nov 18 2016 Remi Collet - 1.28.0-1 +- Update to 1.28.0 + +* Wed Oct 26 2016 Remi Collet - 1.27.0-1 +- Update to 1.27.0 + +* Thu Oct 6 2016 Remi Collet - 1.26.1-1 +- Update to 1.26.1 + +* Mon Oct 3 2016 Remi Collet - 1.26.0-1 +- Update to 1.26.0 + +* Thu Sep 22 2016 Remi Collet - 1.25.0-1 +- Update to 1.25.0 + +* Fri Sep 2 2016 Remi Collet - 1.24.2-1 +- Update to 1.24.2 + +* Mon Jun 27 2016 Remi Collet - 1.24.1-2 +- fix dependency with PHP-7 + +* Mon May 30 2016 Remi Collet - 1.24.1-1 +- Update to 1.24.1 +- disable deprecation warning +- disable extension build with PHP 7 + +* Tue Jan 26 2016 Remi Collet - 1.24.0-1 +- Update to 1.24.0 + +* Mon Jan 11 2016 Remi Collet - 1.23.3-1 +- Update to 1.23.3 +- run test suite with both PHP 5 and 7 when available + +* Thu Nov 05 2015 Remi Collet - 1.23.1-1 +- Update to 1.23.1 + +* Fri Oct 30 2015 Remi Collet - 1.23.0-1 +- Update to 1.23.0 + +* Tue Oct 13 2015 Remi Collet - 1.22.3-1 +- Update to 1.22.3 + +* Sun Oct 11 2015 Shawn Iwinski - 1.22.2-1 +- Updated to 1.22.2 (RHBZ #1262655) +- Added lib and ext version checks + +* Wed Sep 23 2015 Remi Collet - 1.22.2-1 +- Update to 1.22.2 + +* Tue Sep 15 2015 Remi Collet - 1.22.1-1 +- Update to 1.22.1 + +* Sun Sep 13 2015 Remi Collet - 1.22.0-1 +- Update to 1.22.0 + +* Sat Sep 12 2015 Shawn Iwinski - 1.21.2-1 +- Updated to 1.21.2 (BZ #1256767) + +* Wed Sep 9 2015 Remi Collet - 1.21.2-1 +- Update to 1.21.2 + +* Wed Aug 26 2015 Remi Collet - 1.21.1-1 +- Update to 1.21.1 + +* Tue Aug 25 2015 Remi Collet - 1.21.0-1 +- Update to 1.21.0 + +* Wed Aug 12 2015 Shawn Iwinski - 1.20.0-1 +- Updated to 1.20.0 (BZ #1249259) + +* Wed Aug 12 2015 Remi Collet - 1.20.0-1 +- Update to 1.20.0 + +* Fri Jul 31 2015 Remi Collet - 1.19.0-1 +- Update to 1.19.0 + +* Mon Jun 22 2015 Remi Collet - 1.18.2-4 +- add virtual "rh-php56" provides + +* Fri Jun 19 2015 Remi Collet - 1.18.2-3 +- allow build against rh-php56 (as more-php56) + +* Mon Jun 15 2015 Remi Collet - 1.18.2-2 +- rebuild for remirepo with rawhide changes (autoloader) + +* Thu Jun 11 2015 Shawn Iwinski - 1.18.2-1 +- Updated to 1.18.2 (BZ #1183601) +- Added autoloader + +* Sun Jun 7 2015 Remi Collet - 1.18.2-1 +- Update to 1.18.2 + +* Sun Apr 19 2015 Remi Collet - 1.18.1-1 +- Update to 1.18.1 + +* Mon Jan 26 2015 Remi Collet - 1.18.0-1 +- Update to 1.18.0 + +* Wed Jan 14 2015 Remi Collet - 1.17.0-1 +- Update to 1.17.0 + +* Fri Dec 26 2014 Remi Collet - 1.16.3-1 +- Update to 1.16.3 + +* Wed Dec 24 2014 Remi Collet - 1.16.2-1.1 +- Fedora 21 SCL mass rebuild + +* Fri Oct 17 2014 Remi Collet - 1.16.2-1 +- Update to 1.16.2 + +* Sat Oct 11 2014 Remi Collet - 1.16.1-1 +- Update to 1.16.1 + +* Thu Aug 28 2014 Remi Collet - 1.16.0-2 +- allow SCL build +- add backport stuff for EL-5 + +* Mon Aug 25 2014 Shawn Iwinski - 1.16.0-2 +- Removed obsolete and provide of php-twig-CTwig (never imported into Fedora/EPEL) +- Obsolete php-channel-twig +- Removed comment about optional Xdebug in description (does not provide any new feature) +- Always run extension minimal load test + +* Tue Jul 29 2014 Shawn Iwinski - 1.16.0-1 +- Initial package -- cgit