diff options
| author | Remi Collet <remi@remirepo.net> | 2022-08-11 11:12:16 +0200 | 
|---|---|---|
| committer | Remi Collet <remi@php.net> | 2022-08-11 11:12:16 +0200 | 
| commit | 81011b6f2a97de806237806681340125fafcd8e2 (patch) | |
| tree | 44f62934dfd885acc6374b12f1bd01755795db18 | |
| parent | 3ba7d6b9516a15281f19fd5ccf26e7bd00f169ea (diff) | |
switch to phpunit8
use range dependencies
| -rw-r--r-- | php-pimple.spec | 73 | 
1 files changed, 55 insertions, 18 deletions
| diff --git a/php-pimple.spec b/php-pimple.spec index 6731f6f..e7eb33c 100644 --- a/php-pimple.spec +++ b/php-pimple.spec @@ -13,17 +13,21 @@  %global github_owner     silexphp  %global github_name      Pimple -%global github_version   3.2.3 -%global github_commit    9e403941ef9d65d20cba7d54e29fe906db42cf32 +%global github_version   3.5.0 +%global github_commit    a94b3a4db7fb774b3d78dad2315ddc07629e1bed  %global composer_vendor  pimple  %global composer_project pimple  # "php": ">=5.3.0" -%global php_min_ver 5.3.0 -# "psr/container": "^1.0" -%global psr_container_min_ver 1.0 -%global psr_container_max_ver 2.0 +%global php_min_ver 7.2.5 +# "psr/container": "^1.1|^2.0" +%global psr_container_min_ver 1.1 +%global psr_container_max_ver 3.0 +# "symfony/phpunit-bridge": "^5.4@dev" +# symfony5 isn't in the repos, but 4.4 works as well +%global phpunit_bridge_min_ver 4.4 +%global phpunit_bridge_max_ver 6.0  # Build using "--without tests" to disable tests  %global with_tests  %{?_without_tests:0}%{!?_without_tests:1} @@ -43,11 +47,17 @@ Source0:       https://github.com/%{github_owner}/%{github_name}/archive/%{githu  BuildArch:     noarch  # Tests  %if %{with_tests} +BuildRequires: phpunit8  ## composer.json -BuildRequires: php-composer(phpunit/phpunit) -BuildRequires: php-composer(psr/container) <  %{psr_container_max_ver} -BuildRequires: php-composer(psr/container) >= %{psr_container_min_ver} -## phpcompatinfo (computed from version 3.2.3) +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 +BuildRequires:(php-composer(psr/container) >= %{psr_container_min_ver}           with php-composer(psr/container) <  %{psr_container_max_ver}) +BuildRequires:(php-composer(symfony/phpunit-bridge) >= %{phpunit_bridge_min_ver} with php-composer(symfony/phpunit-bridge) < %{phpunit_bridge_max_ver}) +%else +BuildRequires: php-psr-container2 +BuildRequires: php-symfony4-phpunit-bridge +%endif + +## phpcompatinfo (computed from version 3.5.0)  BuildRequires: php-reflection  BuildRequires: php-spl  ## Autoloader @@ -56,8 +66,11 @@ BuildRequires: php-composer(fedora/autoloader)  # composer.json  Requires:  php(language) >= %{php_min_ver} -Requires:  php-composer(psr/container) <  %{psr_container_max_ver} -Requires:  php-composer(psr/container) >= %{psr_container_min_ver} +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 +Requires: (php-composer(psr/container) >= %{psr_container_min_ver}           with php-composer(psr/container) <  %{psr_container_max_ver}) +%else +Requires:  php-psr-container2 +%endif  # phpcompatinfo (computed from version 3.2.3)  Requires:  php-spl  ## Autoloader @@ -95,8 +108,10 @@ require_once '%{phpdir}/Fedora/Autoloader/autoload.php';  \Fedora\Autoloader\Autoload::addPsr4('Pimple\\', __DIR__);  \Fedora\Autoloader\Dependencies::required(array( -    '%{phpdir}/Psr/Container/autoload.php', -)); +    array( +        '%{phpdir}/Psr/Container2/autoload.php', // v2 preferred +        '%{phpdir}/Psr/Container/autoload.php', // v1 as fallback +)));  AUTOLOAD @@ -106,14 +121,31 @@ cp -rp src/Pimple %{buildroot}/%{phpdir}/  %check +: Check the autoloader +%{_bindir}/php -r " +    require_once '%{buildroot}/%{phpdir}/Pimple/autoload.php'; +    exit( +        class_exists('\Pimple\Container') +        ? 0 : 1 +    ); +" +  %if %{with_tests} +: Create a autoloader for tests +mkdir vendor +cat << 'EOF' | tee vendor/autoload.php +<?php +require_once '%{buildroot}/%{phpdir}/Pimple/autoload.php'; +require_once '%{phpdir}/Symfony4/Bridge/PhpUnit/autoload.php'; +EOF +  : Upstream tests +: Run phpunit tests  RETURN_CODE=0 -PHPUNIT=$(which phpunit) -for PHP_EXEC in "" php70 php71 php72; do -    if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then +PHPUNIT=$(which phpunit8) +for PHP_EXEC in php php74 php80 php81; do +    if which $PHP_EXEC; then          $PHP_EXEC $PHPUNIT --verbose \ -            --bootstrap %{buildroot}/%{phpdir}/Pimple/autoload.php \              || RETURN_CODE=1      fi  done @@ -134,6 +166,11 @@ exit $RETURN_CODE  %changelog +* Thu Aug 11 2022 Remi Collet <remi@remirepo.net> - 3.5.0-1 +- update to 3.5.0, from Fedora +- switch to phpunit8 +- use range dependencies +  * Thu Feb 22 2018 Remi Collet <remi@remirepo.net> - 3.2.3-1  - sync with rawhide spec | 
