From 8c125d05f0f00f1a7e4156ee5e1d8d8da66be6e5 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Fri, 8 Dec 2017 09:14:59 +0100
Subject: switch from zend-loader to fedora/autoloader

---
 php-zendframework-zend-http.spec | 61 ++++++++++++++++++++++++----------------
 1 file changed, 36 insertions(+), 25 deletions(-)

(limited to 'php-zendframework-zend-http.spec')

diff --git a/php-zendframework-zend-http.spec b/php-zendframework-zend-http.spec
index c825208..3a01db6 100644
--- a/php-zendframework-zend-http.spec
+++ b/php-zendframework-zend-http.spec
@@ -21,7 +21,7 @@
 
 Name:           php-%{gh_owner}-%{gh_project}
 Version:        2.7.0
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        Zend Framework %{library} component
 
 Group:          Development/Libraries
@@ -42,23 +42,23 @@ BuildRequires:  php-openssl
 BuildRequires:  php-pcre
 BuildRequires:  php-spl
 BuildRequires:  php-zlib
-BuildRequires:  php-composer(%{gh_owner}/zend-loader)           >= 2.5.1
-BuildRequires:  php-composer(%{gh_owner}/zend-stdlib)           >= 2.7.7
-BuildRequires:  php-composer(%{gh_owner}/zend-uri)              >= 2.5.2
-BuildRequires:  php-composer(%{gh_owner}/zend-validator)        >= 2.10.1
+BuildRequires:  php-autoloader(%{gh_owner}/zend-loader)         >= 2.5.1
+BuildRequires:  php-autoloader(%{gh_owner}/zend-stdlib)         >= 2.7.7
+BuildRequires:  php-autoloader(%{gh_owner}/zend-uri)            >= 2.5.2
+BuildRequires:  php-autoloader(%{gh_owner}/zend-validator)      >= 2.10.1
 # From composer, "require-dev": {
 #        "phpunit/phpunit": "^6.4.1 || ^5.7.15",
 #        "zendframework/zend-coding-standard": "~1.0.0",
 #        "zendframework/zend-config": "^3.1 || ^2.6"
-BuildRequires:  php-composer(%{gh_owner}/zend-config)           >= 2.5
+BuildRequires:  php-autoloader(%{gh_owner}/zend-config)         >= 2.5
 %if 0%{?fedora} >= 26
 %global phpunit %{_bindir}/phpunit6
 %else
 %global phpunit %{_bindir}/phpunit
 %endif
-# Autoloader
-BuildRequires:  php-composer(%{gh_owner}/zend-loader)           >= 2.5
 %endif
+# Autoloader
+BuildRequires:  php-fedora-autoloader-devel
 
 # From composer, "require": {
 #        "php": "^5.6 || ^7.0",
@@ -68,15 +68,17 @@ BuildRequires:  php-composer(%{gh_owner}/zend-loader)           >= 2.5
 #        "zendframework/zend-validator": "^2.10.1"
 Requires:       php(language) >= 5.6
 %if ! %{bootstrap}
-Requires:       php-composer(%{gh_owner}/zend-loader)           >= 2.5.1
-Requires:       php-composer(%{gh_owner}/zend-loader)           <  3
-Requires:       php-composer(%{gh_owner}/zend-stdlib)           >= 2.7.7
-Requires:       php-composer(%{gh_owner}/zend-stdlib)           <  4
-Requires:       php-composer(%{gh_owner}/zend-uri)              >= 2.5
-Requires:       php-composer(%{gh_owner}/zend-uri)              <  3
-Requires:       php-composer(%{gh_owner}/zend-validator)        >= 2.10.1
-Requires:       php-composer(%{gh_owner}/zend-validator)        <  3
+Requires:       php-autoloader(%{gh_owner}/zend-loader)         >= 2.5.1
+Requires:       php-autoloader(%{gh_owner}/zend-loader)         <  3
+Requires:       php-autoloader(%{gh_owner}/zend-stdlib)         >= 2.7.7
+Requires:       php-autoloader(%{gh_owner}/zend-stdlib)         <  4
+Requires:       php-autoloader(%{gh_owner}/zend-uri)            >= 2.5
+Requires:       php-autoloader(%{gh_owner}/zend-uri)            <  3
+Requires:       php-autoloader(%{gh_owner}/zend-validator)      >= 2.10.1
+Requires:       php-autoloader(%{gh_owner}/zend-validator)      <  3
 %endif
+# Autoloader
+Requires:       php-composer(fedora/autoloader)
 # From phpcompatinfo report for version 2.5.1
 Requires:       php-ctype
 Requires:       php-curl
@@ -90,6 +92,7 @@ Requires:       php-zlib
 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}
 
 
 %description
@@ -108,7 +111,15 @@ mv LICENSE.md LICENSE
 
 
 %build
-# Empty build section, nothing required
+phpab --template fedora --output src/autoload.php src
+cat << 'EOF' | tee -a src/autoload.php
+\Fedora\Autoloader\Dependencies::required([
+    '%{php_home}/Zend/Loader/autoload.php',
+    '%{php_home}/Zend/Stdlib/autoload.php',
+    '%{php_home}/Zend/Uri/autoload.php',
+    '%{php_home}/Zend/Validator/autoload.php',
+]);
+EOF
 
 
 %install
@@ -121,14 +132,11 @@ cp -pr src %{buildroot}%{php_home}/Zend/%{library}
 mkdir vendor
 cat << 'EOF' | tee vendor/autoload.php
 <?php
-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\Dependencies::required([
+    '%{php_home}/Zend/Config/autoload.php',
+]);
+\Fedora\Autoloader\Autoload::addPsr4('ZendTest\\%{library}\\', dirname(__DIR__) . '/test');
 EOF
 
 ret=0
@@ -153,6 +161,9 @@ exit $ret
 
 
 %changelog
+* Thu Dec  7 2017 Remi Collet <remi@remirepo.net> - 2.7.0-2
+- switch from zend-loader to fedora/autoloader
+
 * Thu Nov  2 2017 Remi Collet <remi@remirepo.net> - 2.7.0-1
 - Update to 2.7.0
 - use phpunit6 on F26+
-- 
cgit