Update to 1.2.0 (RHBZ #1674220)

- Fix "FTBFS in Fedora rawhide/f35" (RHBZ #1987840)
This commit is contained in:
Shawn Iwinski 2021-09-18 13:50:50 -04:00
commit 8c40c85874
5 changed files with 121 additions and 36 deletions

View file

@ -1,7 +1,7 @@
#
# Fedora spec file for php-ocramius-code-generator-utils
#
# Copyright (c) 2014-2016 Shawn Iwinski <shawn.iwinski@gmail.com>
# Copyright (c) 2014-2021 Shawn Iwinski <shawn.iwinski@gmail.com>
#
# License: MIT
# http://opensource.org/licenses/MIT
@ -11,40 +11,43 @@
%global github_owner Ocramius
%global github_name CodeGenerationUtils
%global github_version 0.4.1
%global github_commit 862c03de42475fe039e7d0f47966c25ac40a58a8
%global github_version 1.2.0
%global github_commit 02aab6ab303c93f60915d0f6d4ffaf0381a6671b
%global composer_vendor ocramius
%global composer_project code-generator-utils
# "php": "~7.0"
%global php_min_ver 7.0
# "nikic/php-parser": "~2.0|~3.0"
%global php_parser_min_ver 2.0
%global php_parser_max_ver 4
# "php": "^8.0"
%global php_min_ver 8.0
# "nikic/php-parser": "^4.10.4"
%global php_parser_min_ver 4.10.4
%global php_parser_max_ver 5
# Build using "--without tests" to disable tests
%global with_tests 0%{!?_without_tests:1}
%bcond_without tests
%{!?phpdir: %global phpdir %{_datadir}/php}
Name: php-%{composer_vendor}-%{composer_project}
Version: %{github_version}
Release: 10%{?github_release}%{?dist}
Release: 1%{?github_release}%{?dist}
Summary: A set of code generator utilities built on top of PHP-Parsers
License: MIT
URL: https://github.com/%{github_owner}/%{github_name}
Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz
# GitHub export does not include tests.
# Run php-ocramius-code-generator-utils-get-source.sh to create full source.
Source0: %{name}-%{github_version}-%{github_commit}.tar.gz
Source1: %{name}-get-source.sh
BuildArch: noarch
%if %{with_tests}
%if %{with tests}
# composer.json
BuildRequires: php(language) >= %{php_min_ver}
BuildRequires: php-composer(nikic/php-parser) < %{php_parser_max_ver}
BuildRequires: php-composer(nikic/php-parser) >= %{php_parser_min_ver}
BuildRequires: php-composer(phpunit/phpunit) >= 5.0
# phpcompatinfo (computed from version 0.4.0)
BuildRequires: phpunit9
BuildRequires: (php-composer(nikic/php-parser) >= %{php_parser_min_ver} with php-composer(nikic/php-parser) < %{php_parser_max_ver})
# phpcompatinfo (computed from version 1.2.0)
BuildRequires: php-pcre
BuildRequires: php-reflection
BuildRequires: php-spl
@ -54,10 +57,10 @@ BuildRequires: php-composer(fedora/autoloader)
# composer.json
Requires: php(language) >= %{php_min_ver}
Requires: php-composer(nikic/php-parser) < %{php_parser_max_ver}
Requires: php-composer(nikic/php-parser) >= %{php_parser_min_ver}
# phpcompatinfo (computed from version 0.4.0)
Requires: (php-composer(nikic/php-parser) >= %{php_parser_min_ver} with php-composer(nikic/php-parser) < %{php_parser_max_ver})
# phpcompatinfo (computed from version 1.2.0)
Requires: php-pcre
Requires: php-reflection
Requires: php-spl
# Autoloader
Requires: php-composer(fedora/autoloader)
@ -90,11 +93,9 @@ cat <<'AUTOLOAD' | tee src/CodeGenerationUtils/autoload.php
require_once '/usr/share/php/Fedora/Autoloader/autoload.php';
\Fedora\Autoloader\Autoload::addPsr4('CodeGenerationUtils\\', __DIR__);
\Fedora\Autoloader\Dependencies::required([
[
'%{phpdir}/PhpParser3/autoload.php',
'%{phpdir}/PhpParser2/autoload.php',
],
'%{phpdir}/PhpParser4/autoload.php',
]);
AUTOLOAD
@ -105,7 +106,7 @@ cp -rp src/CodeGenerationUtils %{buildroot}%{phpdir}/
%check
%if %{with_tests}
%if %{with tests}
: Create tests bootstrap
cat <<'BOOTSTRAP' | tee bootstrap.php
<?php
@ -114,13 +115,15 @@ require '%{buildroot}%{phpdir}/CodeGenerationUtils/autoload.php';
\Fedora\Autoloader\Autoload::addPsr4('CodeGenerationUtilsTestAsset\\', __DIR__.'/tests/CodeGenerationUtilsTestAsset');
BOOTSTRAP
ret=0
for cmd in php php70 php71 php72; do
if which $cmd; then
$cmd %{_bindir}/phpunit --verbose --bootstrap bootstrap.php || ret=1
fi
: Upstream tests
RETURN_CODE=0
PHPUNIT=$(which phpunit9)
for PHP_EXEC in php php81; do
if [ "php" = "$PHP_EXEC" ] || which $PHP_EXEC; then
$PHP_EXEC $PHPUNIT --verbose --bootstrap bootstrap.php || RETURN_CODE=1
fi
done
exit $ret
exit $RETURN_CODE
%else
: Tests skipped
%endif
@ -135,6 +138,10 @@ exit $ret
%changelog
* Sat Sep 18 2021 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.2.0-1
- Update to 1.2.0 (RHBZ #1674220)
- Fix "FTBFS in Fedora rawhide/f35" (RHBZ #1987840)
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.1-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild