From 5e09ab237afe9cc585858c13f8ed3762acb1ff9e Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 12 Jul 2017 06:47:17 +0200 Subject: backport Fedora changes --- php-JMSParser.spec | 85 +++++++++++++++++++++++++----------------------------- 1 file changed, 39 insertions(+), 46 deletions(-) (limited to 'php-JMSParser.spec') diff --git a/php-JMSParser.spec b/php-JMSParser.spec index 10ce5b1..fe59bb5 100644 --- a/php-JMSParser.spec +++ b/php-JMSParser.spec @@ -1,8 +1,8 @@ # remirepo spec file for php-JMSParser, from Fedora: # -# RPM spec file for php-JMSParser +# Fedora spec file for php-JMSParser # -# Copyright (c) 2013-2015 Shawn Iwinski +# Copyright (c) 2013-2017 Shawn Iwinski # # License: MIT # http://opensource.org/licenses/MIT @@ -18,10 +18,9 @@ %global composer_vendor jms %global composer_project parser-lib -%global php_min_ver 5.3.0 # "phpoption/phpoption": ">=0.9,<2.0-dev" -# NOTE: min version not 0.9 because autoloader required -%global phpoption_min_ver 1.4.0-4 +# NOTE: Min version not 0.9 because autoloader required +%global phpoption_min_ver 1.5.0 %global phpoption_max_ver 2.0 # Build using "--without tests" to disable tests @@ -31,7 +30,7 @@ Name: php-JMSParser Version: %{github_version} -Release: 7%{?dist} +Release: 9%{?dist} Summary: Library for writing recursive-descent parsers Group: Development/Libraries @@ -43,36 +42,34 @@ URL: http://jmsyst.com/libs/%{github_name} Source0: %{name}-%{github_version}-%{github_commit}.tar.gz Source1: %{name}-get-source.sh -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch # Tests %if %{with_tests} -BuildRequires: %{_bindir}/phpunit -BuildRequires: php(language) >= %{php_min_ver} +BuildRequires: php-composer(phpunit/phpunit) ## composer.json -#BuildRequires: php-composer(phpoption/phpoption) >= %%{phpoption_min_ver} -BuildRequires: php-PhpOption >= %{phpoption_min_ver} +BuildRequires: php-composer(phpoption/phpoption) < %{phpoption_max_ver} +BuildRequires: php-composer(phpoption/phpoption) >= %{phpoption_min_ver} ## phpcompatinfo (computed from version 1.0.0) +BuildRequires: php(language) >= 5.3.0 BuildRequires: php-json BuildRequires: php-pcre BuildRequires: php-reflection BuildRequires: php-spl ## Autoloader -BuildRequires: php-composer(symfony/class-loader) +BuildRequires: php-composer(fedora/autoloader) %endif -Requires: php(language) >= %{php_min_ver} # composer.json -#Requires: php-composer(phpoption/phpoption) >= %%{phpoption_min_ver} -Requires: php-PhpOption >= %{phpoption_min_ver} Requires: php-composer(phpoption/phpoption) < %{phpoption_max_ver} +Requires: php-composer(phpoption/phpoption) >= %{phpoption_min_ver} # phpcompatinfo (computed from version 1.0.0) +Requires: php(language) >= 5.3.0 Requires: php-json Requires: php-pcre Requires: php-reflection Requires: php-spl # Autoloader -Requires: php-composer(symfony/class-loader) +Requires: php-composer(fedora/autoloader) # Standard "php-{COMPOSER_VENDOR}-{COMPOSER_PROJECT}" naming Provides: php-%{composer_vendor}-%{composer_project} = %{version}-%{release} @@ -82,63 +79,55 @@ Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} %description %{summary}. +Autoloader: %{phpdir}/JMS/Parser/autoload.php + %prep %setup -q -n %{github_name}-%{github_commit} + +%build : Create autoloader cat <<'AUTOLOAD' | tee src/JMS/Parser/autoload.php register(); -} - -$fedoraClassLoader->addPrefix('JMS\\Parser\\', dirname(dirname(__DIR__))); +\Fedora\Autoloader\Autoload::addPsr4('JMS\\Parser\\', __DIR__); -return $fedoraClassLoader; +\Fedora\Autoloader\Dependencies::required(array( + '%{phpdir}/PhpOption/autoload.php', +)); AUTOLOAD -%build -# Empty build section, nothing to build - - %install -rm -rf %{buildroot} mkdir -p %{buildroot}%{phpdir} -cp -rp src/* %{buildroot}%{phpdir}/ +cp -rp src/JMS %{buildroot}%{phpdir}/ %check %if %{with_tests} -%{_bindir}/phpunit --verbose \ - --bootstrap %{buildroot}%{phpdir}/JMS/Parser/autoload.php +: Upstream tests +RETURN_CODE=0 +PHPUNIT=$(which phpunit) +for PHP_EXEC in "" %{?rhel:php54 php55} php56 php70 php71 php72; do + if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then + $PHP_EXEC $PHPUNIT --verbose \ + --bootstrap %{buildroot}%{phpdir}/JMS/Parser/autoload.php \ + || RETURN_CODE=1 + fi +done +exit $RETURN_CODE %else : Tests skipped %endif -%clean -rm -rf %{buildroot} - - %files -%defattr(-,root,root,-) %{!?_licensedir:%global license %%doc} %license LICENSE %doc *.md @@ -148,6 +137,10 @@ rm -rf %{buildroot} %changelog +* Wed May 03 2017 Shawn Iwinski - 1.0.0-9 +- Switched autoloader to php-composer(fedora/autoloader) +- Test with SCLs if available + * Sun Jul 12 2015 Shawn Iwinski - 1.0.0-7 - Added spec license - New source script %%{name}-get-source.sh instead of %%{name}-strip.sh -- cgit