summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2017-12-09 16:12:16 +0100
committerRemi Collet <remi@remirepo.net>2017-12-09 16:12:16 +0100
commitfd775cc9c73b30f985da4911cb2ad739e5d9da2e (patch)
tree256ae7aca41c8a1814348e1b0a04a0603438c2e0
parent73b22f52b38bf6974f16d627a5a925292efa4b65 (diff)
switch from zend-loader to fedora/autoloader
-rw-r--r--php-zendframework-zendservice-recaptcha.spec65
1 files changed, 39 insertions, 26 deletions
diff --git a/php-zendframework-zendservice-recaptcha.spec b/php-zendframework-zendservice-recaptcha.spec
index ccdafb3..06cf20c 100644
--- a/php-zendframework-zendservice-recaptcha.spec
+++ b/php-zendframework-zendservice-recaptcha.spec
@@ -18,7 +18,7 @@
Name: php-%{gh_owner}-%{pk_project}
Version: 3.0.0
-Release: 3%{?dist}
+Release: 5%{?dist}
Summary: Zend Framework %{library} component
Group: Development/Libraries
@@ -35,38 +35,41 @@ BuildArch: noarch
%if %{with_tests}
BuildRequires: php(language) >= 5.6
BuildRequires: php-json
-BuildRequires: php-composer(%{gh_owner}/zend-http) >= 2.5.4
-BuildRequires: php-composer(%{gh_owner}/zend-json) >= 2.6.1
+BuildRequires: php-autoloader(%{gh_owner}/zend-http) >= 2.5.4
+BuildRequires: php-autoloader(%{gh_owner}/zend-json) >= 2.6.1
# From composer.json, "require-dev": {
# "phpunit/phpunit": "^5.7 || ^6.0",
# "zendframework/zend-coding-standard": "~1.0.0",
# "zendframework/zend-config": "^2.0",
# "zendframework/zend-validator": "^2.8.2"
BuildRequires: php-composer(phpunit/phpunit) >= 5.7
-BuildRequires: php-composer(%{gh_owner}/zend-config) >= 2.0
-BuildRequires: php-composer(%{gh_owner}/zend-validator) >= 2.8.2
-# Autoloader
-BuildRequires: php-composer(%{gh_owner}/zend-loader)
+BuildRequires: php-autoloader(%{gh_owner}/zend-config) >= 2.0
+BuildRequires: php-autoloader(%{gh_owner}/zend-validator) >= 2.8.2
%endif
+# Autoloader
+BuildRequires: php-fedora-autoloader-devel
# From composer, "require": {
# "php": "^5.6 || ^7.0",
# "zendframework/zend-http": "^2.5.4",
# "zendframework/zend-json": "^2.6.1 || ^3.0"
Requires: php(language) >= 5.6
-Requires: php-composer(%{gh_owner}/zend-http) >= 2.5.4
-Requires: php-composer(%{gh_owner}/zend-http) < 3
-Requires: php-composer(%{gh_owner}/zend-json) >= 2.6.1
-Requires: php-composer(%{gh_owner}/zend-json) < 4
+Requires: php-autoloader(%{gh_owner}/zend-http) >= 2.5.4
+Requires: php-autoloader(%{gh_owner}/zend-http) < 3
+Requires: php-autoloader(%{gh_owner}/zend-json) >= 2.6.1
+Requires: php-autoloader(%{gh_owner}/zend-json) < 4
# From compsoer, "suggest": {
# "zendframework/zend-validator": "~2.0, if using ReCaptcha's Mailhide API"
%if 0%{?fedora} >= 21
-Suggests: php-composer(%{gh_owner}/zend-validator)
+Suggests: php-autoloader(%{gh_owner}/zend-validator)
%endif
+# Autoloader
+Requires: php-composer(fedora/autoloader)
# From phpcompatinfo report for version 3.0.0 (mcrypt is optional)
Requires: php-json
Provides: php-composer(%{gh_owner}/%{pk_project}) = %{version}
+Provides: php-autoloader(%{gh_owner}/%{gh_project}) = %{version}
%description
@@ -79,7 +82,9 @@ Provides: php-composer(%{gh_owner}/%{pk_project}) = %{version}
mv LICENSE.md LICENSE
-# Generate autoloader for this framework extension
+
+%build
+: Generate autoloader for this framework extension - deprecated
cat << 'EOF' | tee autoload.php
<?php
Zend\Loader\AutoloaderFactory::factory(array(
@@ -89,12 +94,17 @@ Zend\Loader\AutoloaderFactory::factory(array(
))));
EOF
-# Redirect to framework autoloader
-ln -s ../../Zend/autoload.php src/autoload.php
-
-
-%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}/Zend/Http/autoload.php',
+ '%{php_home}/Zend/Json/autoload.php',
+]);
+\Fedora\Autoloader\Dependencies::optional([
+ '%{php_home}/Zend/Validator/autoload.php',
+]);
+EOF
%install
@@ -107,14 +117,14 @@ install -Dpm 644 autoload.php %{buildroot}%{php_home}/Zend/%{namespace}-%{librar
%check
%if %{with_tests}
mkdir vendor
-cat << EOF | tee vendor/autoload.php
+cat << 'EOF' | tee vendor/autoload.php
<?php
-require_once '%{php_home}/Zend/autoload.php';
-Zend\\Loader\\AutoloaderFactory::factory(array(
- 'Zend\\Loader\\StandardAutoloader' => array(
- 'namespaces' => array(
- '%{namespace}\\%{library}' => '%{buildroot}%{php_home}/%{namespace}/%{library}',
-))));
+require_once '%{buildroot}%{php_home}/%{namespace}/%{library}/autoload.php';
+\Fedora\Autoloader\Dependencies::required([
+ '%{php_home}/Zend/Config/autoload.php',
+ '%{php_home}/Zend/Validator/autoload.php',
+]);
+\Fedora\Autoloader\Autoload::addPsr4('ZendServiceTest\\%{library}\\', dirname(__DIR__) . '/test');
EOF
ret=0
@@ -140,6 +150,9 @@ exit $ret
%changelog
+* Sat Dec 9 2017 Remi Collet <remi@remirepo.net> - 3.0.0-5
+- switch from zend-loader to fedora/autoloader
+
* Thu Mar 2 2017 Remi Collet <remi@fedoraproject.org> - 3.0.0-3
- add patch to skip online tests, from
https://github.com/zendframework/ZendService_ReCaptcha/pull/12