diff options
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | composer.json | 6 | ||||
-rw-r--r-- | php-nikic-php-parser4-rpm.patch (renamed from php-nikic-php-parser3-rpm.patch) | 15 | ||||
-rw-r--r-- | php-nikic-php-parser4.spec | 81 |
4 files changed, 56 insertions, 50 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..91b0fd5 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +SRCDIR := $(shell pwd) +NAME := $(shell basename $(SRCDIR)) +include ../../common/Makefile + diff --git a/composer.json b/composer.json index 66df90a..7ae425f 100644 --- a/composer.json +++ b/composer.json @@ -10,11 +10,11 @@ } ], "require": { - "php": ">=5.5", + "php": ">=7.0", "ext-tokenizer": "*" }, "require-dev": { - "phpunit/phpunit": "~4.0|~5.0" + "phpunit/phpunit": "^6.5 || ^7.0" }, "autoload": { "psr-4": { @@ -24,7 +24,7 @@ "bin": ["bin/php-parse"], "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "4.0-dev" } } } diff --git a/php-nikic-php-parser3-rpm.patch b/php-nikic-php-parser4-rpm.patch index 739d7ab..bbdfc8f 100644 --- a/php-nikic-php-parser3-rpm.patch +++ b/php-nikic-php-parser4-rpm.patch @@ -11,21 +11,10 @@ diff -up ./bin/php-parse.rpm ./bin/php-parse - break; - } -} -+require '/usr/share/php/PhpParser3/autoload.php'; ++require '/usr/share/php/PhpParser4/autoload.php'; ini_set('xdebug.max_nesting_level', 3000); -diff -up ./lib/bootstrap.php.rpm ./lib/bootstrap.php ---- ./lib/bootstrap.php.rpm 2016-04-19 15:41:41.000000000 +0200 -+++ ./lib/bootstrap.php 2016-04-20 06:33:22.712063600 +0200 -@@ -1,6 +1,6 @@ - <?php - - if (!class_exists('PhpParser\Autoloader')) { -- require __DIR__ . '/PhpParser/Autoloader.php'; -+ require __DIR__ . '/Autoloader.php'; - } - PhpParser\Autoloader::register(); diff -up ./test/bootstrap.php.rpm ./test/bootstrap.php --- ./test/bootstrap.php.rpm 2016-04-20 06:33:22.713063604 +0200 +++ ./test/bootstrap.php 2016-04-20 06:34:38.963385593 +0200 @@ -34,7 +23,7 @@ diff -up ./test/bootstrap.php.rpm ./test/bootstrap.php namespace PhpParser; -require __DIR__ . '/../vendor/autoload.php'; -+require '@BUILDROOT@/usr/share/php/PhpParser3/autoload.php'; ++require '@BUILDROOT@/usr/share/php/PhpParser4/autoload.php'; function canonicalize($str) { // normalize EOL style 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 |