summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--php-di.spec167
2 files changed, 82 insertions, 86 deletions
diff --git a/.gitignore b/.gitignore
index 3205f6f..43303d1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@ clog
/php-di-5.2.0-e20ff1b465a15548e22efcea79e06df64d9e2068.tar.gz
/php-di-5.2.2-f574bcc841201ab04587b1c6da1234d4044f67d8.tar.gz
/php-di-5.4.0-e348393488fa909e4bc0707ba5c9c44cd602a1cb.tar.gz
+/php-di-5.4.2-bbe2ed4b48e5b832436bf50928c30af8aedf61f8.tar.gz
diff --git a/php-di.spec b/php-di.spec
index 28c5e32..498c88d 100644
--- a/php-di.spec
+++ b/php-di.spec
@@ -2,7 +2,7 @@
#
# Fedora spec file for php-di
#
-# Copyright (c) 2016 Shawn Iwinski <shawn@iwin.ski>
+# Copyright (c) 2016-2017 Shawn Iwinski <shawn@iwin.ski>
#
# License: MIT
# http://opensource.org/licenses/MIT
@@ -12,16 +12,16 @@
%global github_owner PHP-DI
%global github_name PHP-DI
-%global github_version 5.4.0
-%global github_commit e348393488fa909e4bc0707ba5c9c44cd602a1cb
+%global github_version 5.4.2
+%global github_commit bbe2ed4b48e5b832436bf50928c30af8aedf61f8
%global composer_vendor php-di
%global composer_project php-di
# "php": ">=5.5.0"
%global php_min_ver 5.5.0
-# "container-interop/container-interop": "~1.0"
-%global container_interop_min_ver 1.0
+# "container-interop/container-interop": "~1.2"
+%global container_interop_min_ver 1.2
%global container_interop_max_ver 2.0
# "doctrine/annotations": "~1.2"
%global doctrine_annotations_min_ver 1.2
@@ -32,15 +32,18 @@
# "mnapoli/phpunit-easymock": "~0.2.0"
%global phpunit_easymock_min_ver 0.2.0
%global phpunit_easymock_max_ver 1.0
+# "ocramius/proxy-manager": "~1.0|~2.0"
+%global proxy_manager_min_ver 1.0
+%global proxy_manager_max_ver 3.0
# "php-di/invoker": "^1.3.2"
%global di_invoker_min_ver 1.3.2
%global di_invoker_max_ver 2.0
# "php-di/phpdoc-reader": "^2.0.1"
%global di_phpdoc_reader_min_ver 2.0.1
%global di_phpdoc_reader_max_ver 3.0
-# "ocramius/proxy-manager": "~1.0|~2.0"
-%global proxy_manager_min_ver 1.0
-%global proxy_manager_max_ver 3.0
+# "psr/container": "~1.0"
+%global psr_container_min_ver 1.0
+%global psr_container_max_ver 2.0
# Build using "--without tests" to disable tests
%global with_tests 0%{!?_without_tests:1}
@@ -65,60 +68,67 @@ BuildArch: noarch
# Tests
%if %{with_tests}
## composer.json
-BuildRequires: php(language) >= %{php_min_ver}
+BuildRequires: php(language) >= %{php_min_ver}
+BuildRequires: php-composer(container-interop/container-interop) < %{container_interop_max_ver}
BuildRequires: php-composer(container-interop/container-interop) >= %{container_interop_min_ver}
-BuildRequires: php-composer(doctrine/annotations) >= %{doctrine_annotations_min_ver}
-BuildRequires: php-composer(doctrine/cache) >= %{doctrine_cache_min_ver}
-BuildRequires: php-composer(mnapoli/phpunit-easymock) >= %{phpunit_easymock_min_ver}
-BuildRequires: php-composer(ocramius/proxy-manager) >= %{proxy_manager_min_ver}
-BuildRequires: php-composer(php-di/invoker) >= %{di_invoker_min_ver}
-BuildRequires: php-composer(php-di/phpdoc-reader) >= %{di_phpdoc_reader_min_ver}
+BuildRequires: php-composer(doctrine/annotations) < %{doctrine_annotations_max_ver}
+BuildRequires: php-composer(doctrine/annotations) >= %{doctrine_annotations_min_ver}
+BuildRequires: php-composer(doctrine/cache) < %{doctrine_cache_max_ver}
+BuildRequires: php-composer(doctrine/cache) >= %{doctrine_cache_min_ver}
+BuildRequires: php-composer(mnapoli/phpunit-easymock) < %{phpunit_easymock_max_ver}
+BuildRequires: php-composer(mnapoli/phpunit-easymock) >= %{phpunit_easymock_min_ver}
+BuildRequires: php-composer(ocramius/proxy-manager) < %{proxy_manager_max_ver}
+BuildRequires: php-composer(ocramius/proxy-manager) >= %{proxy_manager_min_ver}
+BuildRequires: php-composer(php-di/invoker) < %{di_invoker_max_ver}
+BuildRequires: php-composer(php-di/invoker) >= %{di_invoker_min_ver}
+BuildRequires: php-composer(php-di/phpdoc-reader) < %{di_phpdoc_reader_max_ver}
+BuildRequires: php-composer(php-di/phpdoc-reader) >= %{di_phpdoc_reader_min_ver}
+BuildRequires: php-composer(psr/container) < %{psr_container_max_ver}
+BuildRequires: php-composer(psr/container) >= %{psr_container_min_ver}
BuildRequires: php-composer(phpunit/phpunit)
+%if 0%{?fedora} >= 26
+BuildRequires: phpunit6
+%endif
## phpcompatinfo (computed from version 5.4.0)
BuildRequires: php-json
BuildRequires: php-pcre
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-composer(container-interop/container-interop) >= %{container_interop_min_ver}
+Requires: php(language) >= %{php_min_ver}
Requires: php-composer(container-interop/container-interop) < %{container_interop_max_ver}
-Requires: php-composer(php-di/invoker) >= %{di_invoker_min_ver}
-Requires: php-composer(php-di/invoker) < %{di_invoker_max_ver}
-Requires: php-composer(php-di/phpdoc-reader) >= %{di_phpdoc_reader_min_ver}
-Requires: php-composer(php-di/phpdoc-reader) < %{di_phpdoc_reader_max_ver}
+Requires: php-composer(container-interop/container-interop) >= %{container_interop_min_ver}
+Requires: php-composer(php-di/invoker) < %{di_invoker_max_ver}
+Requires: php-composer(php-di/invoker) >= %{di_invoker_min_ver}
+Requires: php-composer(php-di/phpdoc-reader) < %{di_phpdoc_reader_max_ver}
+Requires: php-composer(php-di/phpdoc-reader) >= %{di_phpdoc_reader_min_ver}
+Requires: php-composer(psr/container) < %{psr_container_max_ver}
+Requires: php-composer(psr/container) >= %{psr_container_min_ver}
# phpcompatinfo (computed from version 5.4.0)
Requires: php-json
Requires: php-pcre
Requires: php-reflection
Requires: php-spl
# Autoloader
-Requires: php-composer(symfony/class-loader)
+Requires: php-composer(fedora/autoloader)
+
# Weak dependencies
%if 0%{?fedora} >= 21
Suggests: php-composer(doctrine/annotations)
Suggests: php-composer(doctrine/cache)
-Suggests: php-composer(mnapoli/phpunit-easymock)
Suggests: php-composer(ocramius/proxy-manager)
%endif
-Conflicts: php-composer(doctrine/annotations) < %{doctrine_annotations_min_ver}
-Conflicts: php-composer(doctrine/annotations) >= %{doctrine_annotations_max_ver}
-Conflicts: php-composer(doctrine/cache) < %{doctrine_cache_min_ver}
-Conflicts: php-composer(doctrine/cache) >= %{doctrine_cache_max_ver}
-Conflicts: php-composer(mnapoli/phpunit-easymock) < %{phpunit_easymock_min_ver}
-Conflicts: php-composer(mnapoli/phpunit-easymock) >= %{phpunit_easymock_max_ver}
-Conflicts: php-composer(ocramius/proxy-manager) < %{proxy_manager_min_ver}
-Conflicts: php-composer(ocramius/proxy-manager) >= %{proxy_manager_max_ver}
# php-{COMPOSER_VENDOR}-{COMPOSER_PROJECT}
-Provides: php-%{composer_vendor}-%{composer_project} = %{version}-%{release}
+Provides: php-%{composer_vendor}-%{composer_project} = %{version}-%{release}
# Composer
Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version}
Provides: php-composer(container-interop/container-interop-implementation) = 1.0
+Provides: php-composer(psr/container-implementation) = 1.0
%description
%{summary}.
@@ -139,40 +149,24 @@ cat <<'AUTOLOAD' | tee src/DI/autoload.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('DI\\', dirname(__DIR__));
+\Fedora\Autoloader\Autoload::addPsr4('DI\\', __DIR__);
require_once __DIR__.'/functions.php';
-// Dependencies (autoloader => required)
-foreach(array(
- // Required dependencies
- '%{phpdir}/Interop/Container/autoload.php' => true,
- '%{phpdir}/Invoker/autoload.php' => true,
- '%{phpdir}/PhpDocReader/autoload.php' => true,
- // Optional dependencies
- '%{phpdir}/Doctrine/Common/Annotations/autoload.php' => false,
- '%{phpdir}/Doctrine/Common/Cache/autoload.php' => false,
- '%{phpdir}/ProxyManager/autoload.php' => false,
-) as $dependencyAutoloader => $required) {
- if ($required || file_exists($dependencyAutoloader)) {
- require_once $dependencyAutoloader;
- }
-}
-
-
-return $fedoraClassLoader;
+\Fedora\Autoloader\Dependencies::required([
+ '%{phpdir}/Interop/Container/autoload.php',
+ '%{phpdir}/Invoker/autoload.php',
+ '%{phpdir}/PhpDocReader/autoload.php',
+ '%{phpdir}/Psr/Container/autoload.php',
+]);
+
+\Fedora\Autoloader\Dependencies::optional([
+ '%{phpdir}/Doctrine/Common/Annotations/autoload.php',
+ '%{phpdir}/Doctrine/Common/Cache/autoload.php',
+ '%{phpdir}/ProxyManager/autoload.php',
+]);
AUTOLOAD
@@ -187,17 +181,13 @@ cp -rp src/* %{buildroot}%{phpdir}/
%check
%if %{with_tests}
-: Make PSR-0 tests
-mkdir -p tests-psr0/DI/Test
-ln -s ../../../tests/IntegrationTest tests-psr0/DI/Test/IntegrationTest
-ln -s ../../../tests/UnitTest tests-psr0/DI/Test/UnitTest
-
: Create tests bootstrap
cat <<'BOOTSTRAP' | tee bootstrap.php
<?php
-$fedoraClassLoader = require '%{buildroot}%{phpdir}/DI/autoload.php';
-$fedoraClassLoader->addPrefix('DI\\Test\\IntegrationTest\\', __DIR__.'/tests-psr0');
-$fedoraClassLoader->addPrefix('DI\\Test\\UnitTest\\', __DIR__.'/tests-psr0');
+require '%{buildroot}%{phpdir}/DI/autoload.php';
+
+\Fedora\Autoloader\Autoload::addPsr4('DI\\Test\\IntegrationTest\\', __DIR__.'/tests/IntegrationTest');
+\Fedora\Autoloader\Autoload::addPsr4('DI\\Test\\UnitTest\\', __DIR__.'/tests/UnitTest');
require_once '%{phpdir}/EasyMock/autoload.php';
BOOTSTRAP
@@ -215,21 +205,19 @@ sed -e '/@test/d' \
-e 's/function test_should_throw_if_the_factory_is_not_callable/function SKIP_test_should_throw_if_the_factory_is_not_callable/' \
-i tests/UnitTest/Definition/Resolver/FactoryResolverTest.php
-: Run tests
-ret=0
-run=0
-if which php56; then
- php56 %{_bindir}/phpunit --bootstrap bootstrap.php || : ignore
- 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
+for PHP_EXEC in php php56 php70 php71; do
+ if [ "php" == "$PHP_EXEC" ] || which $PHP_EXEC; then
+ for PHPUNIT in phpunit phpunit6; do
+ PHPUNIT=$(which $PHPUNIT) || :
+ if [ -n "$PHPUNIT" ]; then
+ $PHP_EXEC $PHPUNIT --bootstrap bootstrap.php --verbose || RETURN_CODE=1
+ fi
+ done
+ fi
+done
+exit $RETURN_CODE
%else
: Tests skipped
%endif
@@ -245,6 +233,13 @@ exit $ret
%changelog
+* Sun Apr 02 2017 Shawn Iwinski <shawn@iwin.ski> - 5.4.2-1
+- Update to 5.4.2 (RHBZ #1435627)
+- Add max versions to BuildRequires
+- Remove conflicts for weak dependencies' version constraints
+- Switch autoloader to php-composer(fedora/autoloader)
+- Test with SCLs and both phpunit and phpunit6 if available
+
* Fri Oct 28 2016 Remi Collet <remi@fedoraproject.org> - 5.4.0-1
- update to 5.4.0
- raise dependency on php-di/invoker >= 1.3.2