From fb619be5ab918c2d050644b01eaab1dad155fbf2 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sun, 14 May 2017 18:03:13 +0200 Subject: sync with Fedora --- .gitignore | 7 +++ php-doctrine-datafixtures.spec | 106 ++++++++++++++++------------------------- 2 files changed, 48 insertions(+), 65 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1ab5c4f --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +package-*.xml +*.tgz +*.tar.gz +*.tar.xz +*.tar.xz.asc +*.src.rpm +*/*rpm 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 +# Copyright (c) 2013-2017 Shawn Iwinski # # 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 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 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 - 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 - 1.0.2-1 - Updated/fixed php-composer(doctrine/*) dependencies min version for autoloaders - Modified autoloader -- cgit