summaryrefslogtreecommitdiffstats
path: root/php-doctrine-annotations.spec
diff options
context:
space:
mode:
Diffstat (limited to 'php-doctrine-annotations.spec')
-rw-r--r--php-doctrine-annotations.spec78
1 files changed, 38 insertions, 40 deletions
diff --git a/php-doctrine-annotations.spec b/php-doctrine-annotations.spec
index c255ca3..430b1fd 100644
--- a/php-doctrine-annotations.spec
+++ b/php-doctrine-annotations.spec
@@ -2,7 +2,7 @@
#
# Fedora spec file for php-doctrine-annotations
#
-# 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
@@ -36,7 +36,7 @@
Name: php-%{composer_vendor}-%{composer_project}
Version: %{github_version}
-Release: 1%{?github_release}%{?dist}
+Release: 4%{?github_release}%{?dist}
Summary: PHP docblock annotations parser library
Group: Development/Libraries
@@ -48,14 +48,15 @@ URL: https://github.com/%{github_owner}/%{github_name}
Source0: %{name}-%{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}
## composer.json
-BuildRequires: %{_bindir}/phpunit
-BuildRequires: php(language) >= %{php_min_ver}
+BuildRequires: php(language) >= %{php_min_ver}
+BuildRequires: php-composer(doctrine/cache) < %{cache_max_ver}
BuildRequires: php-composer(doctrine/cache) >= %{cache_min_ver}
+BuildRequires: php-composer(phpunit/phpunit)
+BuildRequires: php-composer(doctrine/lexer) < %{lexer_max_ver}
#BuildRequires: php-composer(doctrine/lexer) >= %%{lexer_min_ver}
BuildRequires: php-doctrine-lexer >= %{lexer_min_ver}
## phpcompatinfo (computed from version 1.2.7)
@@ -67,11 +68,11 @@ BuildRequires: php-reflection
BuildRequires: php-spl
BuildRequires: php-tokenizer
# 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/lexer) >= %%{lexer_min_ver}
Requires: php-doctrine-lexer >= %{lexer_min_ver}
Requires: php-composer(doctrine/lexer) < %{lexer_max_ver}
@@ -84,7 +85,7 @@ Requires: php-reflection
Requires: php-spl
Requires: php-tokenizer
# Autoloader
-Requires: php-composer(symfony/class-loader)
+Requires: php-composer(fedora/autoloader)
# Composer
Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version}
@@ -95,42 +96,32 @@ Conflicts: php-pear(pear.doctrine-project.org/DoctrineCommon) < 2.4
%description
%{summary} (extracted from Doctrine Common).
+Autoloader: %{phpdir}/Doctrine/Common/Annotations/autoload.php
+
%prep
%setup -qn %{github_name}-%{github_commit}
+
+%build
: Create autoloader
cat <<'AUTOLOAD' | tee lib/Doctrine/Common/Annotations/autoload.php
<?php
/**
- * Autoloader created by %{name}-%{version}-%{release}
- *
- * @return \Symfony\Component\ClassLoader\ClassLoader
+ * Autoloader for %{name} and its' dependencies
+ * (created by %{name}-%{version}-%{release}).
*/
+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();
-}
+\Fedora\Autoloader\Autoload::addPsr4('Doctrine\\Common\\Annotations\\', __DIR__);
-$fedoraClassLoader->addPrefix('Doctrine\\Common\\Annotations\\', dirname(dirname(dirname(__DIR__))));
-
-require_once '%{phpdir}/Doctrine/Common/Lexer/autoload.php';
-
-return $fedoraClassLoader;
+\Fedora\Autoloader\Dependencies::required(array(
+ '%{phpdir}/Doctrine/Common/Lexer/autoload.php',
+));
AUTOLOAD
-%build
-# Empty build section, nothing required
-
-
%install
-rm -rf %{buildroot}
mkdir -p %{buildroot}%{phpdir}
cp -rp lib/* %{buildroot}%{phpdir}/
@@ -144,26 +135,28 @@ sed "s#require.*autoload.*#require_once '%{buildroot}%{phpdir}/Doctrine/Common/A
: Create tests bootstrap
cat <<'BOOTSTRAP' | tee bootstrap.php
<?php
-
require_once '%{phpdir}/Doctrine/Common/Cache/autoload.php';
-require_once __DIR__ . '/tests/Doctrine/Tests/TestInit.php';
+require_once __DIR__.'/tests/Doctrine/Tests/TestInit.php';
BOOTSTRAP
-: Run tests
-%{_bindir}/phpunit \
- -d pcre.recursion_limit=10000 \
- --verbose --bootstrap bootstrap.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 \
+ -d pcre.recursion_limit=10000 \
+ --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
@@ -172,6 +165,11 @@ rm -rf %{buildroot}
%changelog
+* Fri May 12 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.2.7-4
+- Switch autoloader to php-composer(fedora/autoloader)
+- Add max versions to build dependencies
+- Test with SCLs if available
+
* Sat Sep 05 2015 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.2.7-1
- Updated to 1.2.7 (RHBZ #1258669 / CVE-2015-5723)
- Updated autoloader to load dependencies after self registration