summaryrefslogtreecommitdiffstats
path: root/php-nikic-php-parser4.spec
diff options
context:
space:
mode:
Diffstat (limited to 'php-nikic-php-parser4.spec')
-rw-r--r--php-nikic-php-parser4.spec81
1 files changed, 47 insertions, 34 deletions
diff --git a/php-nikic-php-parser4.spec b/php-nikic-php-parser4.spec
index 1752c40..15a10d9 100644
--- a/php-nikic-php-parser4.spec
+++ b/php-nikic-php-parser4.spec
@@ -1,4 +1,4 @@
-# remirepo/fedora spec file for php-nikic-php-parser3
+# remirepo/fedora spec file for php-nikic-php-parser4
#
# Copyright (c) 2016-2018 Remi Collet
# License: CC-BY-SA
@@ -10,20 +10,18 @@
# For compatibility with SCL
%undefine __brp_mangle_shebangs
-%global gh_commit bb87e28e7d7b8d9a7fda231d37457c9210faf6ce
+%global gh_commit 9c18e3db49fa469f5feffe40dbd7b1ec2b61e41f
%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner nikic
%global gh_project PHP-Parser
%global pk_project php-parser
%global php_home %{_datadir}/php
+%global ns_project PhpParser
%global with_tests 0%{!?_without_tests:1}
-%global major 3
-
-%global eolv1 0
-%global eolv2 0
+%global major 4
Name: php-%{gh_owner}-%{pk_project}%{major}
-Version: 3.1.5
+Version: 4.0.0
Release: 1%{?dist}
Summary: A PHP parser written in PHP
@@ -37,51 +35,53 @@ Patch0: %{name}-rpm.patch
BuildArch: noarch
%if %{with_tests}
# For tests
-BuildRequires: php(language) >= 5.5
+BuildRequires: php(language) >= 7.0
BuildRequires: php-tokenizer
-BuildRequires: php-filter
+BuildRequires: php-reflection
+BuildRequires: php-ctype
BuildRequires: php-json
BuildRequires: php-pcre
BuildRequires: php-spl
-BuildRequires: php-xmlreader
-BuildRequires: php-xmlwriter
# From composer.json, "require-dev": {
-# "phpunit/phpunit": "~4.0|~5.0"
-BuildRequires: php-composer(phpunit/phpunit) >= 4.0
+# "phpunit/phpunit": "^6.5 || ^7.0"
+%if 0%{?fedora} >= 28 || 0%{?rhel} >= 8
+%global phpunit %{_bindir}/phpunit7
+BuildRequires: phpunit7
+%else
+%global phpunit %{_bindir}/phpunit6
+BuildRequires: phpunit6 >= 6.5
+%endif
+# Autoloader
+BuildRequires: php-composer(fedora/autoloader)
%endif
# From composer.json, "require": {
-# "php": ">=5.5",
+# "php": ">=7.0",
# "ext-tokenizer": "*"
-Requires: php(language) >= 5.5
+Requires: php(language) >= 7.0
Requires: php-tokenizer
-# From phpcompatinfo report for version 3.0.2
-Requires: php-filter
+# From phpcompatinfo report for version 4.0.0
+Requires: php-reflection
+Requires: php-ctype
Requires: php-json
Requires: php-pcre
Requires: php-spl
-Requires: php-xmlreader
-Requires: php-xmlwriter
-%if %{eolv1}
-Obsoletes: php-PHPParser < %{major}
-%endif
-%if %{eolv2}
-Obsoletes: php-%{gh_owner}-%{pk_project} < %{major}
-%endif
Requires: php-cli
+# Autoloader
+BuildRequires: php-composer(fedora/autoloader)
Provides: php-composer(%{gh_owner}/%{pk_project}) = %{version}
%description
-This is a PHP 5.2 to PHP 7.1 parser written in PHP.
+This is a PHP 5.2 to PHP 7.2 parser written in PHP.
Its purpose is to simplify static code analysis and manipulation.
This package provides the library version %{major} and the php-parse%{major} command.
Documentation: https://github.com/nikic/PHP-Parser/tree/master/doc
-Autoloader: %{php_home}/PhpParser%{major}/autoload.php
+Autoloader: %{php_home}/%{ns_project}%{major}/autoload.php
%prep
@@ -91,14 +91,20 @@ Autoloader: %{php_home}/PhpParser%{major}/autoload.php
%build
-# Empty build section, most likely nothing required.
+: Generate an simple PSR-4 autoloader
+cat << 'AUTOLOAD' | tee lib/%{ns_project}/autoload.php
+<?php
+/* Autoloader for %{name} and its dependencies */
+require_once '%{_datadir}/php/Fedora/Autoloader/autoload.php';
+
+\Fedora\Autoloader\Autoload::addPsr4('%{ns_project}\\', __DIR__);
+AUTOLOAD
%install
: Library
mkdir -p %{buildroot}%{php_home}
-cp -pr lib/PhpParser %{buildroot}%{php_home}/PhpParser%{major}
-cp -p lib/bootstrap.php %{buildroot}%{php_home}/PhpParser%{major}/autoload.php
+cp -pr lib/%{ns_project} %{buildroot}%{php_home}/%{ns_project}%{major}
: Command
install -Dpm 0755 bin/php-parse %{buildroot}%{_bindir}/php-parse%{major}
@@ -116,9 +122,10 @@ sed -e 's:@BUILDROOT@:%{buildroot}:' -i test/bootstrap.php
: Upstream test suite
ret=0
-for cmd in php php70 php71 php72; do
- if which $cmd; then
- $cmd %{_bindir}/phpunit --verbose || ret=1
+for cmdarg in "php %{phpunit}" "php70 %{_bindir}/phpunit6" php71 php72; do
+ if which $cmdarg; then
+ set $cmdarg
+ $1 ${2:-%{_bindir}/phpunit7} --verbose || ret=1
fi
done
exit $ret
@@ -133,10 +140,16 @@ exit $ret
%doc composer.json
%doc *.md
%{_bindir}/php-parse%{major}
-%{php_home}/PhpParser%{major}
+%{php_home}/%{ns_project}%{major}
%changelog
+* Thu Mar 22 2018 Remi Collet <remi@remirepo.net> - 4.0.0-1
+- Update to 4.0.0
+- rename to php-nikic-php-parser4 and move to /usr/share/php/PhpParser4
+- raise dependency on PHP 7
+- use phpunit6 or phpunit7 (F28+)
+
* Thu Mar 1 2018 Remi Collet <remi@remirepo.net> - 3.1.5-1
- Update to 3.1.5