From d91f417d69f25ea580829dcd145151e9a3bde2ce Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 27 Aug 2019 13:53:28 +0200 Subject: - update to 1.42.3 - use symfony/debug v3 - use phpunit v7 - raise dependency on PHP 5.5 - drop support of the C extension --- composer.json | 11 ++- php-twig.spec | 275 +++++++++++++--------------------------------------------- 2 files changed, 69 insertions(+), 217 deletions(-) diff --git a/composer.json b/composer.json index 2f10465..9807aa7 100644 --- a/composer.json +++ b/composer.json @@ -24,12 +24,12 @@ } ], "require": { - "php": ">=5.4.0", + "php": ">=5.5.0", "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@dev|^5.0", + "symfony/debug": "^3.4|^4.2", "psr/container": "^1.0" }, "autoload": { @@ -40,6 +40,11 @@ "Twig\\" : "src/" } }, + "autoload-dev": { + "psr-4" : { + "Twig\\Tests\\" : "tests" + } + }, "extra": { "branch-alias": { "dev-master": "1.42-dev" diff --git a/php-twig.spec b/php-twig.spec index 0591ef8..31ab782 100644 --- a/php-twig.spec +++ b/php-twig.spec @@ -1,5 +1,4 @@ # remirepo spec file for php-twig -# With SCL stuff, from Fedora: # # Fedora spec file for php-twig # @@ -11,163 +10,92 @@ # # 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 %global github_owner twigphp %global github_name Twig -%global github_version 1.42.2 -%global github_commit 21707d6ebd05476854805e4f91b836531941bcd4 -%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 +%global github_version 1.42.3 +%global github_commit 201baee843e0ffe8b0b956f336dd42b2a92fae4e # 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": ">=5.5.0" +%global php_min_ver 5.5 -# "php": ">=5.4.0" -%global php_min_ver 5.4 +# Build using "--without tests" to disable tests +%global with_tests 0%{!?_without_tests:1} -%global phpdir %{_datadir}/php +%{!?phpdir: %global phpdir %{_datadir}/php} +%{!?php_inidir: %global php_inidir %{_sysconfdir}/php.d} -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: https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz -BuildRequires: %{?scl_prefix}php-devel >= %{php_min_ver} +BuildArch: noarch +BuildRequires: php-devel >= %{php_min_ver} +# Tests %if %{with_tests} -# For tests -BuildRequires: php-composer(phpunit/phpunit) +BuildRequires: phpunit7 %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) %else -BuildRequires: php-symfony-debug >= 2.7 +BuildRequires: php-symfony3-debug >= 3.4 BuildRequires: php-composer(psr/container) < 2 BuildRequires: php-composer(psr/container) >= 1.0 %endif ## 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 %description @@ -184,31 +112,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 +126,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,58 +143,31 @@ 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} : Generate autoloader mkdir vendor cat << 'EOF' | tee vendor/autoload.php 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 +for cmd in php php71 php72 php73 php74; do if which $cmd; then - $cmd %{_bindir}/phpunit --verbose || ret=1 + $cmd %{_bindir}/phpunit7 \ + --filter '^((?!(testGetAttributeExceptions|testGetAttributeWithTemplateAsObject)).)*$' \ + --verbose || ret=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 %else @@ -330,20 +181,16 @@ exit $ret %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 +* 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 + * Tue Jun 18 2019 Shawn Iwinski - 1.42.2-1 - Update to 1.42.2 -- cgit