Blame php-nikic-php-parser.spec

25b312b
# remirepo/fedora spec file for php-nikic-php-parser
25b312b
#
25b312b
# Copyright (c) 2016 Remi Collet
25b312b
# License: CC-BY-SA
25b312b
# http://creativecommons.org/licenses/by-sa/4.0/
25b312b
#
25b312b
# Please, preserve the changelog entries
25b312b
#
baf3c54
%global gh_commit    4dd659edadffdc2143e4753df655d866dbfeedf0
25b312b
%global gh_short     %(c=%{gh_commit}; echo ${c:0:7})
25b312b
%global gh_owner     nikic
25b312b
%global gh_project   PHP-Parser
25b312b
%global pk_project   php-parser
25b312b
%global php_home     %{_datadir}/php
25b312b
%global with_tests   0%{!?_without_tests:1}
25b312b
25b312b
%global eolv1   0
25b312b
%global script  0
e699940
%if 0%{?fedora} >= 24 && 0%{?fedora} < 26
6b9dec7
%global script  1
6b9dec7
%endif
25b312b
25b312b
Name:           php-%{gh_owner}-%{pk_project}
baf3c54
Version:        2.1.1
e699940
Release:        2%{?dist}
25b312b
Summary:        A PHP parser written in PHP
25b312b
25b312b
Group:          Development/Libraries
25b312b
License:        BSD
25b312b
URL:            https://github.com/%{gh_owner}/%{gh_project}
25b312b
Source:         https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{name}-%{version}-%{gh_short}.tar.gz
25b312b
25b312b
# Autoloader
25b312b
Patch0:         %{name}-rpm.patch
25b312b
25b312b
BuildArch:      noarch
25b312b
%if %{with_tests}
25b312b
# For tests
25b312b
BuildRequires:  php(language) >= 5.4
25b312b
BuildRequires:  php-tokenizer
25b312b
BuildRequires:  php-filter
25b312b
BuildRequires:  php-pcre
25b312b
BuildRequires:  php-spl
25b312b
BuildRequires:  php-xmlreader
25b312b
BuildRequires:  php-xmlwriter
25b312b
# From composer.json, "require-dev": {
25b312b
#        "phpunit/phpunit": "~4.0"
25b312b
BuildRequires:  php-composer(phpunit/phpunit) >= 4.0
25b312b
%endif
25b312b
25b312b
# From composer.json, "require": {
25b312b
#        "php": ">=5.4",
25b312b
#        "ext-tokenizer": "*"
25b312b
Requires:       php(language) >= 5.4
25b312b
Requires:       php-tokenizer
25b312b
# From phpcompatinfo report for version 2.0.1
25b312b
Requires:       php-filter
25b312b
Requires:       php-pcre
25b312b
Requires:       php-spl
25b312b
Requires:       php-xmlreader
25b312b
Requires:       php-xmlwriter
25b312b
%if %{eolv1}
25b312b
Obsoletes:      php-PHPParser < 2
25b312b
%endif
25b312b
%if %{script}
25b312b
Requires:       php-cli
6b9dec7
# previous version provides the php-parse command
e316c71
Conflicts:      php-PHPParser < 1.4.1-4
25b312b
%endif
25b312b
25b312b
Provides:       php-composer(%{gh_owner}/%{pk_project}) = %{version}
25b312b
25b312b
25b312b
%description
25b312b
This is a PHP 5.2 to PHP 7.0 parser written in PHP.
25b312b
Its purpose is to simplify static code analysis and manipulation.
6b9dec7
%if %{script}
25b312b
This package provides the library version 2 and the php-parse command.
25b312b
%else
25b312b
This package provides the library version 2.
25b312b
%endif
e699940
The %{name}3 packages provides the library version 3.
e699940
The php-PHPParser package provides the library version 1.
e699940
e699940
Documentation: https://github.com/nikic/PHP-Parser/tree/2.x/doc
25b312b
25b312b
Autoloader: %{php_home}/PhpParser2/autoload.php
25b312b
25b312b
25b312b
%prep
25b312b
%setup -q -n %{gh_project}-%{gh_commit}
25b312b
25b312b
%patch0 -p1 -b .rpm
25b312b
25b312b
%if ! %{script}
25b312b
chmod -x bin/*
25b312b
%endif
25b312b
25b312b
25b312b
%build
25b312b
# Empty build section, most likely nothing required.
25b312b
25b312b
25b312b
%install
25b312b
25b312b
: Library
25b312b
mkdir -p                 %{buildroot}%{php_home}
25b312b
cp -pr lib/PhpParser     %{buildroot}%{php_home}/PhpParser2
25b312b
cp -p  lib/bootstrap.php %{buildroot}%{php_home}/PhpParser2/autoload.php
25b312b
25b312b
%if %{script}
25b312b
: Command
25b312b
install -Dpm 0755 bin/php-parse %{buildroot}%{_bindir}/php-parse
25b312b
%endif
25b312b
25b312b
25b312b
%check
25b312b
%if %{with_tests}
25b312b
: Test the command
25b312b
sed -e 's:%{php_home}:%{buildroot}%{php_home}:' \
25b312b
    bin/php-parse > bin/php-parse-test
25b312b
php bin/php-parse-test --help
25b312b
25b312b
: Test suite autoloader
25b312b
sed -e 's:@BUILDROOT@:%{buildroot}:' -i test/bootstrap.php
25b312b
25b312b
: Upstream test suite
25b312b
%{_bindir}/phpunit --verbose
25b312b
%else
25b312b
: Test suite disabled
25b312b
%endif
25b312b
25b312b
25b312b
%files
25b312b
%{!?_licensedir:%global license %%doc}
25b312b
%license LICENSE
25b312b
%doc composer.json
25b312b
%doc *.md
25b312b
%if %{script}
25b312b
%{_bindir}/php-parse
25b312b
%else
25b312b
%doc bin/php-parse
25b312b
%endif
25b312b
%{php_home}/PhpParser2
25b312b
25b312b
25b312b
%changelog
e699940
* Wed Dec  7 2016 Remi Collet <remi@fedoraproject.org> - 2.1.1-2
e699940
- drop the php-parse command, provided by php-nikic-php-parser3
e699940
baf3c54
* Mon Sep 19 2016 Remi Collet <remi@fedoraproject.org> - 2.1.1-1
baf3c54
- update to 2.1.1
baf3c54
6b9dec7
* Fri May 20 2016 Remi Collet <remi@fedoraproject.org> - 2.1.0-3
6b9dec7
- add the php-parse command, no more in php-nikic-php-parser
6b9dec7
25b312b
* Mon May 16 2016 Remi Collet <remi@fedoraproject.org> - 2.1.0-3
25b312b
- drop exec right in doc, fix rpmlint
25b312b
25b312b
* Wed Apr 20 2016 Remi Collet <remi@fedoraproject.org> - 2.1.0-2
25b312b
- fix test suite, add upstream patch
25b312b
25b312b
* Wed Apr 20 2016 Remi Collet <remi@fedoraproject.org> - 2.1.0-1
25b312b
- initial package, version 2.1.0
25b312b
- drop patches merged upstream
25b312b
- open https://github.com/nikic/PHP-Parser/issues/271
25b312b
  issue with test/code/parser/expr/new.test
25b312b
25b312b
* Fri Apr 15 2016 Remi Collet <remi@fedoraproject.org> - 2.0.1-1
25b312b
- initial package, version 2.0.1
25b312b
- open https://github.com/nikic/PHP-Parser/pull/268
25b312b
  make the autoloader more PSR-4
25b312b
- open https://github.com/nikic/PHP-Parser/pull/269
25b312b
  support -h and --help standard options
25b312b