summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2017-11-23 16:13:04 +0100
committerRemi Collet <remi@remirepo.net>2017-11-23 16:13:04 +0100
commit54fa30069e5a38b2d8507069f8b7c4e4ce951416 (patch)
tree2214778e4dba6fd94d1a4b57240d4e2886670d89
parentb75623297e9306011773917a6125e1c07249d336 (diff)
switch from zend-loader to fedora/autoloader
-rw-r--r--php-zendframework-zend-servicemanager.spec78
1 files changed, 33 insertions, 45 deletions
diff --git a/php-zendframework-zend-servicemanager.spec b/php-zendframework-zend-servicemanager.spec
index 634b8df..1d951e6 100644
--- a/php-zendframework-zend-servicemanager.spec
+++ b/php-zendframework-zend-servicemanager.spec
@@ -21,7 +21,7 @@
Name: php-%{gh_owner}-%{gh_project}
Version: 3.3.0
-Release: 1%{?dist}
+Release: 3%{?dist}
Summary: Zend Framework %{library} component
Group: Development/Libraries
@@ -30,14 +30,13 @@ URL: https://zendframework.github.io/%{gh_project}/
Source0: %{gh_commit}/%{name}-%{version}-%{gh_short}.tgz
Source1: makesrc.sh
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildArch: noarch
# Tests
%if %{with_tests}
BuildRequires: php(language) >= 5.6
BuildRequires: php-composer(container-interop/container-interop) >= 1.2
BuildRequires: php-composer(psr/container) >= 1.0
-BuildRequires: php-composer(%{gh_owner}/zend-stdlib) >= 3.1
+BuildRequires: php-autoloader(%{gh_owner}/zend-stdlib) >= 3.1
BuildRequires: php-reflection
BuildRequires: php-date
BuildRequires: php-json
@@ -52,9 +51,7 @@ BuildRequires: php-composer(phpunit/phpunit) >= 5.7
BuildRequires: php-composer(ocramius/proxy-manager) >= 1.0
BuildRequires: php-composer(mikey179/vfsStream) >= 1.6
# Autoloader
-BuildRequires: php-composer(%{gh_owner}/zend-loader) >= 2.5
-# For dependencies autoloader
-BuildRequires: php-zendframework-zend-loader >= 2.5.1-3
+BuildRequires: php-fedora-autoloader-devel
%endif
# From composer, "require": {
@@ -67,8 +64,8 @@ Requires: php-composer(container-interop/container-interop) >= 1.2
Requires: php-composer(container-interop/container-interop) < 2
Requires: php-composer(psr/container) >= 1.0
Requires: php-composer(psr/container) < 2
-Requires: php-composer(%{gh_owner}/zend-stdlib) >= 3.1
-Requires: php-composer(%{gh_owner}/zend-stdlib) < 4
+Requires: php-autoloader(%{gh_owner}/zend-stdlib) >= 3.1
+Requires: php-autoloader(%{gh_owner}/zend-stdlib) < 4
# From phpcompatinfo report for version 3.2.0
Requires: php-reflection
Requires: php-date
@@ -82,13 +79,13 @@ Requires: php-spl
Suggests: php-composer(ocramius/proxy-manager)
%endif
# Autoloader
-Requires: php-composer(%{gh_owner}/zend-loader) >= 2.5
-Requires: php-zendframework-zend-loader >= 2.5.1-3
+Requires: php-composer(fedora/autoloader)
%endif
Obsoletes: php-ZendFramework2-%{library} < 2.5
Provides: php-ZendFramework2-%{library} = %{version}
Provides: php-composer(%{gh_owner}/%{gh_project}) = %{version}
+Provides: php-autoloader(%{gh_owner}/%{gh_project}) = %{version}
Provides: php-composer(container-interop/container-interop-implementation) = 1.2
Provides: php-composer(psr/container-implementation) = 1.0
@@ -106,7 +103,9 @@ Documentation: https://zendframework.github.io/%{gh_project}/
mv LICENSE.md LICENSE
-: Create dependency autoloader
+
+%build
+: Create dependency autoloader - deprecated
cat << 'EOF' | tee autoload.php
<?php
require_once '%{php_home}/Interop/Container/autoload.php';
@@ -116,17 +115,25 @@ if (file_exists('%{php_home}/ProxyManager/autoload.php')) {
}
EOF
-
-%build
-# Empty build section, nothing required
+: Create autoloader
+phpab --template fedora --output src/autoload.php src
+cat << 'EOF' | tee -a src/autoload.php
+\Fedora\Autoloader\Dependencies::required([
+ '%{php_home}/Interop/Container/autoload.php',
+ '%{php_home}/Psr/Container/autoload.php',
+ '%{php_home}/Zend/Stdlib/autoload.php',
+]);
+\Fedora\Autoloader\Dependencies::optional([
+ '%{php_home}/ProxyManager/autoload.php',
+]);
+EOF
%install
-rm -rf %{buildroot}
-
mkdir -p %{buildroot}%{php_home}/Zend/
cp -pr src %{buildroot}%{php_home}/Zend/%{library}
+# For main autoloader (deprecated)
install -m644 autoload.php %{buildroot}%{php_home}/Zend/%{library}-autoload.php
@@ -135,45 +142,23 @@ install -m644 autoload.php %{buildroot}%{php_home}/Zend/%{library}-autoload.php
mkdir vendor
cat << 'EOF' | tee vendor/autoload.php
<?php
-define('RPM_BUILDROOT', '%{buildroot}%{php_home}/Zend');
-
-require_once '%{php_home}/Zend/Loader/AutoloaderFactory.php';
-Zend\Loader\AutoloaderFactory::factory(array(
- 'Zend\Loader\StandardAutoloader' => array(
- 'namespaces' => array(
- 'ZendTest\\%{library}' => dirname(__DIR__).'/test/',
- 'Zend\\%{library}' => '%{buildroot}%{php_home}/Zend/%{library}'
-))));
-require_once '%{php_home}/Zend/autoload.php';
+require_once '%{buildroot}%{php_home}/Zend/%{library}/autoload.php';
+\Fedora\Autoloader\Autoload::addPsr4('ZendTest\\ServiceManager\\', dirname(__DIR__) . '/test');
EOF
-# remirepo:11
-run=0
ret=0
-if which php56; then
- php56 %{_bindir}/phpunit --include-path=%{buildroot}%{php_home} || : ignore
- run=1
-fi
-if which php71; then
- php71 %{_bindir}/phpunit6 --include-path=%{buildroot}%{php_home} || ret=1
- run=1
-fi
-if [ $run -eq 0 ]; then
-%{_bindir}/phpunit --include-path=%{buildroot}%{php_home} --verbose
-# remirepo:2
-fi
+for cmd in php php70 php71 php72; do
+ if which $cmd; then
+ $cmd %{_bindir}/phpunit --verbose || ret=1
+ fi
+done
exit $ret
%else
: Test suite disabled
%endif
-%clean
-rm -rf %{buildroot}
-
-
%files
-%defattr(-,root,root,-)
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc *.md
@@ -183,6 +168,9 @@ rm -rf %{buildroot}
%changelog
+* Thu Nov 23 2017 Remi Collet <remi@remirepo.net> - 3.3.0-3
+- switch from zend-loader to fedora/autoloader
+
* Thu Mar 2 2017 Remi Collet <remi@fedoraproject.org> - 3.3.0-1
- update to 3.3.0
- raise dependency on container-interop/container-interop 1.2