Shawn Iwinski 4cfde33
#
9905d34
# Fedora spec file for php-doctrine-orm
Shawn Iwinski 4cfde33
#
30b2bc9
# Copyright (c) 2013-2017 Shawn Iwinski <shawn.iwinski@gmail.com>
Shawn Iwinski 4cfde33
#                         Remi Collet <remi@fedoraproject.org>
Shawn Iwinski 4cfde33
#
Shawn Iwinski 4cfde33
# License: MIT
Shawn Iwinski 4cfde33
# http://opensource.org/licenses/MIT
Shawn Iwinski 4cfde33
#
Shawn Iwinski 4cfde33
# Please preserve changelog entries
Shawn Iwinski 4cfde33
#
Shawn Iwinski 4cfde33
Shawn Iwinski 4cfde33
%global github_owner     doctrine
Shawn Iwinski 4cfde33
%global github_name      doctrine2
9905d34
%global github_version   2.4.8
9905d34
%global github_commit    5aedac1e5c5caaeac14798822c70325dc242d467
Shawn Iwinski 4cfde33
Shawn Iwinski 4cfde33
%global composer_vendor  doctrine
Shawn Iwinski 4cfde33
%global composer_project orm
Shawn Iwinski 4f25888
Shawn Iwinski 4f25888
# "php": ">=5.3.2"
9905d34
%global php_min_ver 5.3.2
Shawn Iwinski 4f25888
# "doctrine/collections": "~1.1"
9905d34
#     NOTE: Min version not 1.1 because autoloader required
9905d34
%global collections_min_ver 1.3.0
Shawn Iwinski 4f25888
%global collections_max_ver 2.0
Shawn Iwinski 4f25888
# "doctrine/dbal": "~2.4"
9905d34
#     NOTE: Min version not 2.4 because autoloader required
9905d34
%global dbal_min_ver %{?el6:2.4.5}%{!?el6:2.5.4}
9905d34
%global dbal_max_ver 3.0
Shawn Iwinski 4f25888
# "symfony/console": "~2.0"
Shawn Iwinski 4f25888
# "symfony/yaml": "~2.1"
9905d34
#     NOTE: Min version not 2.1 because autoloader required
9905d34
%global symfony_min_ver %{?el6:2.3.31}%{!?el6:2.7.1}
9905d34
%global symfony_max_ver 3.0
Shawn Iwinski 4f25888
9905d34
%{!?phpdir:  %global phpdir  %{_datadir}/php}
Shawn Iwinski 277cd0c
Shawn Iwinski 277cd0c
# Build using "--without tests" to disable tests
Shawn Iwinski 277cd0c
%global with_tests %{?_without_tests:0}%{!?_without_tests:1}
Shawn Iwinski 277cd0c
9905d34
Name:          php-%{composer_vendor}-%{composer_project}
9905d34
Version:       %{github_version}
30b2bc9
Release:       3%{?dist}
9905d34
Summary:       Doctrine Object-Relational-Mapper (ORM)
Shawn Iwinski 4f25888
9905d34
Group:         Development/Libraries
9905d34
License:       MIT
9905d34
URL:           http://www.doctrine-project.org/projects/orm.html
Shawn Iwinski 277cd0c
Shawn Iwinski 277cd0c
# Run "php-doctrine-orm-get-source.sh" to create source
9905d34
Source0:       %{name}-%{version}-%{github_commit}.tar.gz
9905d34
Source1:       %{name}-get-source.sh
Shawn Iwinski 277cd0c
Shawn Iwinski 4f25888
# Update bin script:
Shawn Iwinski 4f25888
# 1) Add she-bang
Shawn Iwinski 4f25888
# 2) Auto-load using Doctrine\Common\ClassLoader
9905d34
Patch0:        %{name}-bin.patch
Shawn Iwinski 4f25888
977e485
# Fix test suite using PHPUnit 5.4
977e485
Patch1:        %{name}-phpunit54.patch
977e485
Shawn Iwinski 4f25888
BuildArch: noarch
30b2bc9
# Tests
Shawn Iwinski 277cd0c
%if %{with_tests}
9905d34
BuildRequires: php-composer(phpunit/phpunit)
30b2bc9
## composer.json
Shawn Iwinski 277cd0c
BuildRequires: php(language)                      >= %{php_min_ver}
Shawn Iwinski 277cd0c
BuildRequires: php-composer(doctrine/collections) <  %{collections_max_ver}
9905d34
BuildRequires: php-composer(doctrine/collections) >= %{collections_min_ver}
Shawn Iwinski 277cd0c
BuildRequires: php-composer(doctrine/dbal)        <  %{dbal_max_ver}
9905d34
BuildRequires: php-composer(doctrine/dbal)        >= %{dbal_min_ver}
9905d34
BuildRequires: php-composer(symfony/console)      <  %{symfony_max_ver}
9905d34
BuildRequires: php-composer(symfony/console)      >= %{symfony_min_ver}
9905d34
BuildRequires: php-composer(symfony/yaml)         <  %{symfony_max_ver}
9905d34
BuildRequires: php-composer(symfony/yaml)         >= %{symfony_min_ver}
9905d34
BuildRequires: php-pdo
9905d34
# phpcompatinfo (computed from version 2.4.8)
Shawn Iwinski 277cd0c
BuildRequires: php-ctype
Shawn Iwinski 277cd0c
BuildRequires: php-date
Shawn Iwinski 277cd0c
BuildRequires: php-dom
Shawn Iwinski 277cd0c
BuildRequires: php-pcre
Shawn Iwinski 277cd0c
BuildRequires: php-reflection
Shawn Iwinski 277cd0c
BuildRequires: php-simplexml
Shawn Iwinski 277cd0c
BuildRequires: php-spl
Shawn Iwinski 277cd0c
BuildRequires: php-tokenizer
30b2bc9
## Autoloader
30b2bc9
BuildRequires: php-composer(fedora/autoloader)
Shawn Iwinski 277cd0c
%endif
Shawn Iwinski 277cd0c
Shawn Iwinski 277cd0c
# composer.json
Shawn Iwinski 277cd0c
Requires:      php(language)                      >= %{php_min_ver}
Shawn Iwinski 277cd0c
Requires:      php-composer(doctrine/collections) <  %{collections_max_ver}
9905d34
Requires:      php-composer(doctrine/collections) >= %{collections_min_ver}
Shawn Iwinski 277cd0c
Requires:      php-composer(doctrine/dbal)        <  %{dbal_max_ver}
9905d34
Requires:      php-composer(doctrine/dbal)        >= %{dbal_min_ver}
9905d34
Requires:      php-composer(symfony/console)      <  %{symfony_max_ver}
9905d34
Requires:      php-composer(symfony/console)      >= %{symfony_min_ver}
9905d34
Requires:      php-composer(symfony/yaml)         <  %{symfony_max_ver}
9905d34
Requires:      php-composer(symfony/yaml)         >= %{symfony_min_ver}
9905d34
Requires:      php-pdo
9905d34
# phpcompatinfo (computed from version 2.4.8)
Shawn Iwinski 277cd0c
Requires:      php-ctype
Shawn Iwinski 277cd0c
Requires:      php-dom
Shawn Iwinski 277cd0c
Requires:      php-pcre
Shawn Iwinski 277cd0c
Requires:      php-reflection
Shawn Iwinski 277cd0c
Requires:      php-simplexml
Shawn Iwinski 277cd0c
Requires:      php-spl
Shawn Iwinski 277cd0c
Requires:      php-tokenizer
30b2bc9
# Autoloader
30b2bc9
Requires:      php-composer(fedora/autoloader)
Shawn Iwinski 4f25888
9905d34
# Weak dependencies
9905d34
%if 0%{?fedora} >= 21
9905d34
## Optional caches (see Doctrine\ORM\Tools\Setup::createConfiguration())
9905d34
Suggests:      php-pecl(apcu)
9905d34
Suggests:      php-pecl(memcache)
9905d34
Suggests:      php-pecl(redis)
9905d34
Suggests:      php-xcache
9905d34
%endif
9905d34
Shawn Iwinski 4cfde33
# Composer
9905d34
Provides:      php-composer(%{composer_vendor}/%{composer_project}) = %{version}
Shawn Iwinski 4f25888
# PEAR
9905d34
Provides:      php-pear(pear.doctrine-project.org/DoctrineORM) = %{version}
Shawn Iwinski 4f25888
# Rename
9905d34
Obsoletes:     php-doctrine-DoctrineORM < %{version}
9905d34
Provides:      php-doctrine-DoctrineORM = %{version}
Shawn Iwinski 4f25888
Shawn Iwinski 4f25888
%description
Shawn Iwinski 4f25888
Object relational mapper (ORM) for PHP that sits on top of a powerful database
Shawn Iwinski 4f25888
abstraction layer (DBAL). One of its' key features is the option to write
Shawn Iwinski 4f25888
database queries in a proprietary object oriented SQL dialect called Doctrine
Shawn Iwinski 4f25888
Query Language (DQL), inspired by Hibernate's HQL. This provides developers
Shawn Iwinski 4f25888
with a powerful alternative to SQL that maintains flexibility without requiring
Shawn Iwinski 4f25888
unnecessary code duplication.
Shawn Iwinski 4f25888
9905d34
Autoloader: %{phpdir}/Doctrine/ORM/autoload.php
Shawn Iwinski 4f25888
Shawn Iwinski 4f25888
Shawn Iwinski 4f25888
%prep
Shawn Iwinski 4cfde33
%setup -qn %{github_name}-%{github_commit}
Shawn Iwinski 4f25888
9905d34
: Patch bin script
Shawn Iwinski 4f25888
%patch0 -p1
Shawn Iwinski 4f25888
977e485
if %{_bindir}/phpunit --atleast-version 5.4; then
9905d34
: Fix test suite using PHPUnit 5.4
977e485
%patch1 -p0
977e485
fi
977e485
9905d34
: Remove empty file
Shawn Iwinski 4f25888
rm -f lib/Doctrine/ORM/README.markdown
Shawn Iwinski 4f25888
9905d34
: Remove unnecessary executable bits
Shawn Iwinski 4f25888
chmod a-x lib/Doctrine/ORM/Tools/Pagination/Paginator.php
Shawn Iwinski 4f25888
Shawn Iwinski 4f25888
Shawn Iwinski 4f25888
%build
9905d34
: Create autoloader
9905d34
cat <<'AUTOLOAD' | tee lib/Doctrine/ORM/autoload.php
9905d34
9905d34
/**
9905d34
 * Autoloader for %{name} and its' dependencies
9905d34
 * (created by %{name}-%{version}-%{release}).
9905d34
 */
30b2bc9
require_once '%{phpdir}/Fedora/Autoloader/autoload.php';
30b2bc9
30b2bc9
\Fedora\Autoloader\Autoload::addPsr4('Doctrine\\ORM\\', __DIR__);
9905d34
30b2bc9
\Fedora\Autoloader\Dependencies::required(array(
30b2bc9
    '%{phpdir}/Doctrine/Common/Collections/autoload.php',
30b2bc9
    '%{phpdir}/Doctrine/DBAL/autoload.php',
30b2bc9
    '%{phpdir}/Symfony/Component/Console/autoload.php',
30b2bc9
    '%{phpdir}/Symfony/Component/Yaml/autoload.php',
30b2bc9
));
9905d34
AUTOLOAD
Shawn Iwinski 4f25888
Shawn Iwinski 4f25888
Shawn Iwinski 4f25888
%install
9905d34
: Lib
9905d34
mkdir -p %{buildroot}%{phpdir}
9905d34
cp -rp lib/Doctrine %{buildroot}%{phpdir}/
Shawn Iwinski 4f25888
9905d34
: Bin
Shawn Iwinski 4f25888
mkdir -p %{buildroot}/%{_bindir}
Shawn Iwinski 4f25888
install -pm 0755 bin/doctrine.php %{buildroot}/%{_bindir}/doctrine
Shawn Iwinski 4f25888
Shawn Iwinski 4f25888
Shawn Iwinski 4f25888
%check
Shawn Iwinski 277cd0c
%if %{with_tests}
9905d34
: Remove load of TestInit
Shawn Iwinski 277cd0c
mv tests/Doctrine/Tests/TestInit.php tests/Doctrine/Tests/TestInit.php.dist
9905d34
grep -r --files-with-matches 'TestInit' tests \
9905d34
    | xargs sed '/TestInit/d' -i
9905d34
9905d34
: Load annotation register file from buildroot
9905d34
sed 's#__DIR__\s*\.\s*"/\(\.\./\)*lib#"%{buildroot}%{phpdir}#' \
9905d34
    -i tests/Doctrine/Tests/OrmTestCase.php
9905d34
9905d34
: Create tests bootstrap
9905d34
cat > bootstrap.php <<'BOOTSTRAP'
Shawn Iwinski 277cd0c
30b2bc9
require_once '%{buildroot}%{phpdir}/Doctrine/ORM/autoload.php';
30b2bc9
\Fedora\Autoloader\Autoload::addPsr4('Doctrine\\Tests\\', __DIR__.'/tests/Doctrine/Tests');
9905d34
BOOTSTRAP
Shawn Iwinski 277cd0c
Shawn Iwinski 547d528
# Skip test known to fail
Shawn Iwinski 9dc5e29
sed -e 's/function testQueryCache_DependsOnHints/function SKIP_testQueryCache_DependsOnHints/' \
Shawn Iwinski 9dc5e29
    -e 's/function testQueryCache_NoHitSaveParserResult/function SKIP_testQueryCache_NoHitSaveParserResult/' \
Shawn Iwinski 9dc5e29
    -i tests/Doctrine/Tests/ORM/Functional/QueryCacheTest.php
Shawn Iwinski 9dc5e29
sed 's/function testNativeQueryResultCaching/function SKIP_testNativeQueryResultCaching/' \
Shawn Iwinski 9dc5e29
    -i tests/Doctrine/Tests/ORM/Functional/ResultCacheTest.php
Shawn Iwinski 9dc5e29
sed 's/function testQueryCache_DependsOnFilters/function SKIP_testQueryCache_DependsOnFilters/' \
Shawn Iwinski 9dc5e29
    -i tests/Doctrine/Tests/ORM/Functional/SQLFilterTest.php
9905d34
%if 0%{?fedora} > 24
9905d34
sed 's/function testReusedSplObjectHashDoesNotConfuseUnitOfWork/function SKIP_testReusedSplObjectHashDoesNotConfuseUnitOfWork/' \
9905d34
    -i tests/Doctrine/Tests/ORM/Functional/IdentityMapTest.php
9905d34
%endif
30b2bc9
%if 0%{?rhel} > 6 || 0%{?fedora} > 0
30b2bc9
sed 's/function testFindMappingFileNamespacedFoundFileNotFound/function SKIP_testFindMappingFileNamespacedFoundFileNotFound/' \
30b2bc9
    -i tests/Doctrine/Tests/ORM/Mapping/Symfony/AbstractDriverTest.php
30b2bc9
%endif
Shawn Iwinski 277cd0c
Shawn Iwinski 277cd0c
# Weird el6 error
Shawn Iwinski 277cd0c
# TODO: Investigate and submit upstream patch
Shawn Iwinski 277cd0c
%if 0%{?el6}
Shawn Iwinski 277cd0c
sed 's#$this->_em->clear();#if (isset($this->_em)) { $this->_em->clear(); }#' \
Shawn Iwinski 277cd0c
    -i tests/Doctrine/Tests/OrmFunctionalTestCase.php
Shawn Iwinski 277cd0c
%endif
Shawn Iwinski 277cd0c
30b2bc9
%{_bindir}/phpunit --verbose -d memory_limit="512M" --bootstrap bootstrap.php
30b2bc9
30b2bc9
: Upstream tests with SCLs if available
30b2bc9
SCL_RETURN_CODE=0
30b2bc9
for SCL in %{?rhel:php54 php55} php56 php70 php71; do
30b2bc9
    if which $SCL; then
30b2bc9
        $SCL %{_bindir}/phpunit --verbose -d memory_limit="512M" \
30b2bc9
            --bootstrap bootstrap.php || SCL_RETURN_CODE=1
30b2bc9
    fi
30b2bc9
done
30b2bc9
exit $SCL_RETURN_CODE
Shawn Iwinski 277cd0c
%else
Shawn Iwinski 277cd0c
: Tests skipped
Shawn Iwinski 277cd0c
%endif
Shawn Iwinski 4f25888
Shawn Iwinski 4f25888
Shawn Iwinski 4f25888
%files
Shawn Iwinski 547d528
%{!?_licensedir:%global license %%doc}
Shawn Iwinski 547d528
%license LICENSE
Shawn Iwinski 547d528
%doc *.md *.markdown composer.json
9905d34
%{phpdir}/Doctrine/ORM
Shawn Iwinski 4f25888
%{_bindir}/doctrine
Shawn Iwinski 4f25888
Shawn Iwinski 4f25888
Shawn Iwinski 4f25888
%changelog
30b2bc9
* Sat Feb 25 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 2.4.8-3
30b2bc9
- Fix FTBFS in rawhide (RHBZ #1424060)
30b2bc9
- Use php-composer(fedora/autoloader)
30b2bc9
- Test SCLs if available
30b2bc9
9c06085
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.8-2
9c06085
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
9c06085
9905d34
* Sat Jul 09 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 2.4.8-1
9905d34
- Updated to 2.4.8 (RHBZ #1347926 / CVE-2015-5723)
9905d34
- Added autoloader
9905d34
977e485
* Mon Jun 13 2016 Remi Collet <remi@fedoraproject.org> - 2.4.7-5
977e485
- add workaround for test suite with PHPUnit 5.4
977e485
Shawn Iwinski 9dc5e29
* Sun Feb 28 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 2.4.7-4
Shawn Iwinski 9dc5e29
- Skip additional tests known to fail (RHBZ #1307857)
Shawn Iwinski 9dc5e29
9df48b0
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.7-3
9df48b0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
9df48b0
6f64258
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4.7-2
6f64258
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
6f64258
Shawn Iwinski 547d528
* Sun Dec 28 2014 Shawn Iwinski <shawn.iwinski@gmail.com> - 2.4.7-1
Shawn Iwinski 547d528
- Updated to 2.4.7 (BZ #1175217)
Shawn Iwinski 547d528
- %%license usage
Shawn Iwinski 547d528
Shawn Iwinski 583768c
* Mon Nov 03 2014 Shawn Iwinski <shawn.iwinski@gmail.com> - 2.4.6-2
Shawn Iwinski 583768c
- Ensure 512M of memory (instead of default 128M) so mock x86_64
Shawn Iwinski 583768c
  builds pass (BZ #1159650)
Shawn Iwinski 583768c
Shawn Iwinski 277cd0c
* Tue Oct 14 2014 Shawn Iwinski <shawn.iwinski@gmail.com> - 2.4.6-1
Shawn Iwinski 277cd0c
- Updated to 2.4.6 (BZ #1108129)
Shawn Iwinski 277cd0c
- Manual git clone source instead of GitHub archive URL (to include tests)
Shawn Iwinski 277cd0c
- Removed Patch1 (%%{name}-upstream.patch)
Shawn Iwinski 277cd0c
- Added tests
Shawn Iwinski 277cd0c
Shawn Iwinski 4cfde33
* Sat Jun 21 2014 Shawn Iwinski <shawn.iwinski@gmail.com> - 2.4.2-4
Shawn Iwinski 4cfde33
- Added php-composer(%%{composer_vendor}/%%{composer_project}) virtual provide
Shawn Iwinski 4cfde33
- Updated Doctrine dependencies to use php-composer virtual provides
Shawn Iwinski 4cfde33
c467472
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4.2-3
c467472
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
c467472
Shawn Iwinski 4cfde33
* Fri May 30 2014 Remi Collet <remi@fedoraproject.org> - 2.4.2-2
Remi Collet bd8e1f3
- upstream fix for latest PHP (#1103219)
Remi Collet bd8e1f3
Shawn Iwinski 4cfde33
* Wed Feb 12 2014 Shawn Iwinski <shawn.iwinski@gmail.com> - 2.4.2-1
Shawn Iwinski d9deee7
- Updated to 2.4.2 (BZ #1063021)
Shawn Iwinski d9deee7
Shawn Iwinski 4cfde33
* Sat Jan 04 2014 Shawn Iwinski <shawn.iwinski@gmail.com> - 2.4.1-2
Shawn Iwinski 4f25888
- Conditional %%{?dist}
Shawn Iwinski 4f25888
- Bin script patch instead of inline update and use Doctrine Common classloader
Shawn Iwinski 4f25888
- Updated optional cache information in %%description
Shawn Iwinski 4f25888
- Removed empty file
Shawn Iwinski 4f25888
- Removed unnecessary executable bit
Shawn Iwinski 4f25888
Shawn Iwinski 4cfde33
* Sat Dec 28 2013 Shawn Iwinski <shawn.iwinski@gmail.com> - 2.4.1-1
Shawn Iwinski 4f25888
- Initial package