diff options
Diffstat (limited to 'php-doctrine-datafixtures.spec')
-rw-r--r-- | php-doctrine-datafixtures.spec | 106 |
1 files changed, 41 insertions, 65 deletions
diff --git a/php-doctrine-datafixtures.spec b/php-doctrine-datafixtures.spec index a27bb0d..e117a18 100644 --- a/php-doctrine-datafixtures.spec +++ b/php-doctrine-datafixtures.spec @@ -2,7 +2,7 @@ # # Fedora spec file for php-doctrine-datafixtures # -# Copyright (c) 2013-2016 Shawn Iwinski <shawn.iwinski@gmail.com> +# Copyright (c) 2013-2017 Shawn Iwinski <shawn.iwinski@gmail.com> # # License: MIT # http://opensource.org/licenses/MIT @@ -36,7 +36,7 @@ Name: php-%{composer_vendor}-datafixtures Version: %{github_version} -Release: 3%{?dist} +Release: 5%{?dist} Summary: Data Fixtures for all Doctrine Object Managers Group: Development/Libraries @@ -44,36 +44,37 @@ License: MIT URL: https://github.com/%{github_owner}/%{github_name} Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch # Tests %if %{with_tests} ## composer.json -BuildRequires: php(language) >= %{php_min_ver} +BuildRequires: php(language) >= %{php_min_ver} +BuildRequires: php-composer(doctrine/common) < %{doctrine_common_max_ver} BuildRequires: php-composer(doctrine/common) >= %{doctrine_common_min_ver} -BuildRequires: php-composer(doctrine/orm) >= %{doctrine_orm_min_ver} +BuildRequires: php-composer(doctrine/orm) < %{doctrine_orm_max_ver} +BuildRequires: php-composer(doctrine/orm) >= %{doctrine_orm_min_ver} BuildRequires: php-composer(phpunit/phpunit) ## phpcompatinfo (computed from version 1.0.2) BuildRequires: php-json BuildRequires: php-reflection BuildRequires: php-spl ## Autoloader -BuildRequires: php-composer(symfony/class-loader) +BuildRequires: php-composer(fedora/autoloader) %endif # composer.json -Requires: php(language) >= %{php_min_ver} +Requires: php(language) >= %{php_min_ver} Requires: php-composer(doctrine/common) >= %{doctrine_common_min_ver} Requires: php-composer(doctrine/common) < %{doctrine_common_max_ver} # composer.json: optional -Requires: php-composer(doctrine/orm) >= %{doctrine_orm_min_ver} -Requires: php-composer(doctrine/orm) < %{doctrine_orm_max_ver} +Requires: php-composer(doctrine/orm) >= %{doctrine_orm_min_ver} +Requires: php-composer(doctrine/orm) < %{doctrine_orm_max_ver} # phpcompatinfo (computed from version 1.0.2) Requires: php-json 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} @@ -84,54 +85,36 @@ Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} This extension aims to provide a simple way to manage and execute the loading of data fixtures for the Doctrine ORM or ODM. +Autoloader: %{phpdir}/Doctrine/Common/DataFixtures/autoload.php + %prep %setup -qn %{github_name}-%{github_commit} + +%build : Create autoloader cat <<'AUTOLOAD' | tee lib/Doctrine/Common/DataFixtures/autoload.php <?php /** * Autoloader for %{name} and its' dependencies * (created by %{name}-%{version}-%{release}). - * - * @return \Symfony\Component\ClassLoader\ClassLoader */ +require_once '%{phpdir}/Fedora/Autoloader/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('Doctrine\\Common\\DataFixtures\\', dirname(dirname(dirname(__DIR__)))); - -// Dependencies (autoloader => required) -foreach(array( - // Required dependency - '%{phpdir}/Doctrine/Common/autoload.php' => true, - // Optional dependency - '%{phpdir}/Doctrine/ORM/autoload.php' => false, -) as $dependencyAutoloader => $required) { - if ($required || file_exists($dependencyAutoloader)) { - require_once $dependencyAutoloader; - } -} - -return $fedoraClassLoader; -AUTOLOAD +\Fedora\Autoloader\Autoload::addPsr4('Doctrine\\Common\\DataFixtures\\', __DIR__); +\Fedora\Autoloader\Dependencies::required(array( + '%{phpdir}/Doctrine/Common/autoload.php', +)); -%build -# Empty build section, nothing required +\Fedora\Autoloader\Dependencies::optional(array( + '%{phpdir}/Doctrine/ORM/autoload.php', +)); +AUTOLOAD %install -rm -rf %{buildroot} - mkdir -p %{buildroot}%{phpdir} cp -rp lib/* %{buildroot}%{phpdir}/ @@ -155,38 +138,26 @@ sed -e 's#function testReferenceIdentityPopulation#function SKIP_testReferenceId : Create tests bootstrap cat <<'BOOTSTRAP' | tee bootstrap.php <?php - -$fedoraClassLoader = - require_once '%{buildroot}%{phpdir}/Doctrine/Common/DataFixtures/autoload.php'; - -$fedoraClassLoader->addPrefix('Doctrine\\Tests\\', __DIR__ . '/tests'); +require_once '%{buildroot}%{phpdir}/Doctrine/Common/DataFixtures/autoload.php'; +\Fedora\Autoloader\Autoload::addPsr0('Doctrine\\Tests\\', __DIR__.'/tests'); BOOTSTRAP -ret=0 -run=0 -if which php56; then - php56 %{_bindir}/phpunit --bootstrap ./bootstrap.php || ret=1 - run=1 -fi -if which php71; then - php71 %{_bindir}/phpunit --bootstrap ./bootstrap.php || ret=1 - run=1 -fi -if [ $run -eq 0 ]; then -%{_bindir}/phpunit --verbose --bootstrap ./bootstrap.php -fi -exit $ret +: 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 bootstrap.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 @@ -196,6 +167,11 @@ rm -rf %{buildroot} %changelog +* Fri May 12 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.0.2-5 +- Switch autoloader to php-composer(fedora/autoloader) +- Add max versions to build dependencies +- Test with SCLs if available + * Sun Jul 31 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.0.2-1 - Updated/fixed php-composer(doctrine/*) dependencies min version for autoloaders - Modified autoloader |