diff options
Diffstat (limited to 'php-PhpCollection.spec')
-rw-r--r-- | php-PhpCollection.spec | 96 |
1 files changed, 46 insertions, 50 deletions
diff --git a/php-PhpCollection.spec b/php-PhpCollection.spec index b0d8ef9..3107128 100644 --- a/php-PhpCollection.spec +++ b/php-PhpCollection.spec @@ -1,8 +1,8 @@ # remirepo spec file for php-PhpCollection, from Fedora: # -# RPM spec file for php-PhpCollection +# Fedora spec file for php-PhpCollection # -# Copyright (c) 2013-2015 Shawn Iwinski <shawn.iwinski@gmail.com> +# Copyright (c) 2013-2017 Shawn Iwinski <shawn.iwinski@gmail.com> # # License: MIT # http://opensource.org/licenses/MIT @@ -12,16 +12,15 @@ %global github_owner schmittjoh %global github_name php-collection -%global github_version 0.4.0 -%global github_commit b8bf55a0a929ca43b01232b36719f176f86c7e83 +%global github_version 0.5.0 +%global github_commit f2bcff45c0da7c27991bbc1f90f47c4b7fb434a6 %global composer_vendor phpcollection %global composer_project phpcollection -%global php_min_ver 5.3.0 # "phpoption/phpoption": "1.*" # NOTE: min version not 1.0 because autoloader required -%global phpoption_min_ver 1.4.0-4 +%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-PhpCollection Version: %{github_version} -Release: 4%{?dist} +Release: 1%{?dist} Summary: General purpose collection library for PHP Group: Development/Libraries @@ -43,29 +42,29 @@ 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-composer(phpunit/phpunit) ## composer.json -BuildRequires: php(language) >= %{php_min_ver} -#BuildRequires: php-composer(phpoption/phpoption) >= %%{phpoption_min_ver} -BuildRequires: php-PhpOption >= %{phpoption_min_ver} -## phpcompatinfo (computed from version 0.4.0) +BuildRequires: php-composer(phpoption/phpoption) < %{phpoption_max_ver} +BuildRequires: php-composer(phpoption/phpoption) >= %{phpoption_min_ver} +## phpcompatinfo (computed from version 0.5.0) +BuildRequires: php(language) >= 5.4.0 +BuildRequires: php-date BuildRequires: php-spl ## Autoloader -BuildRequires: php-composer(symfony/class-loader) +BuildRequires: php-composer(fedora/autoloader) %endif -Requires: php(language) >= %{php_min_ver} -#Requires: php-composer(phpoption/phpoption) >= %%{phpoption_min_ver} -Requires: php-PhpOption >= %{phpoption_min_ver} +# composer.json Requires: php-composer(phpoption/phpoption) < %{phpoption_max_ver} -# phpcompatinfo (computed from version 0.4.0) +Requires: php-composer(phpoption/phpoption) >= %{phpoption_min_ver} +# phpcompatinfo (computed from version 0.5.0) +Requires: php(language) >= 5.4.0 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} @@ -102,67 +101,59 @@ General Characteristics: * Sorting algorithms are unstable, that means the order for equal elements is undefined (the default, and only PHP behavior). +Autoloader: %{phpdir}/PhpCollection/autoload.php + %prep %setup -q -n %{github_name}-%{github_commit} + +%build : Create autoloader cat <<'AUTOLOAD' | tee src/PhpCollection/autoload.php <?php /** * Autoloader for %{name} and its' dependencies - * - * Created by %{name}-%{version}-%{release} - * - * @return \Symfony\Component\ClassLoader\ClassLoader + * (created by %{name}-%{version}-%{release}). */ +require_once '%{phpdir}/Fedora/Autoloader/autoload.php'; -require_once '%{phpdir}/PhpOption/autoload.php'; - -if (!isset($fedoraClassLoader) || !($fedoraClassLoader instanceof \Symfony\Component\ClassLoader\ClassLoader)) { - if (!class_exists('Symfony\\Component\\ClassLoader\\ClassLoader', false)) { - require_once '%{phpdir}/Symfony/Component/ClassLoader/ClassLoader.php'; - } - - $fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader(); - $fedoraClassLoader->register(); -} - -$fedoraClassLoader->addPrefix('PhpCollection\\', dirname(__DIR__)); +\Fedora\Autoloader\Autoload::addPsr4('PhpCollection\\', __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/PhpCollection %{buildroot}%{phpdir}/ %check %if %{with_tests} : Skip test known to fail -sed 's/function testMap/function SKIP_testMap/' \ +sed 's/function testAdd/function SKIP_testAdd/' \ -i tests/PhpCollection/Tests/SequenceTest.php -: Run tests -%{_bindir}/phpunit --bootstrap %{buildroot}%{phpdir}/PhpCollection/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}/PhpCollection/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 @@ -171,6 +162,11 @@ rm -rf %{buildroot} %changelog +* Tue Jul 11 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 0.5.0-1 +- Updated to 0.5.0 +- Switched autoloader to php-composer(fedora/autoloader) +- Test with SCLs if available + * Sun Jul 12 2015 Shawn Iwinski <shawn.iwinski@gmail.com> - 0.4.0-4 - Added spec license - New source script %%{name}-get-source.sh instead of %%{name}-strip.sh |