summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2020-01-16 15:34:02 +0100
committerRemi Collet <remi@remirepo.net>2020-01-16 15:34:02 +0100
commit20709561b72ab796a6887eaa56e178179db73181 (patch)
tree2e5b202605eadf3c629e469747a121d6b6df5eca
parent7873a41d0beef10f579281db05f1a79c7d54972d (diff)
add full framework autoloader
-rw-r--r--php-laminas-zendframework-bridge.spec50
1 files changed, 48 insertions, 2 deletions
diff --git a/php-laminas-zendframework-bridge.spec b/php-laminas-zendframework-bridge.spec
index 3650d37..69dd91b 100644
--- a/php-laminas-zendframework-bridge.spec
+++ b/php-laminas-zendframework-bridge.spec
@@ -22,7 +22,7 @@
Name: php-%{gh_project}
Version: 1.0.1
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: Alias legacy ZF class names to Laminas Project equivalents
License: BSD
@@ -94,12 +94,46 @@ mv src/autoload.php upstream.php
phpab --template fedora --output src/autoload.php src
grep -v '^<?php' upstream.php | tee -a src/autoload.php
+: Full Laminas autoloader
+cat << 'EOF' | tee lf.php
+<?php
+// load all %{namespace}, without Zend compat layer
+foreach(glob('/usr/share/php/%{namespace}/*/autoload.php') as $f) {
+ if (strpos($f, 'ZendFrameworkBridge')) {
+ continue;
+ }
+ require_once $f;
+}
+foreach(glob('/usr/share/php/%{namespace}/*/*/autoload.php') as $f) {
+ if (strpos($f, 'Session/compatibility')) {
+ continue;
+ }
+ require_once $f;
+}
+EOF
+
+: Full Zend autoloader
+cat << 'EOF' | tee zf.php
+<?php
+// load all Zend with %{namespace} compat layer
+require_once '%{php_home}/Fedora/Autoloader/autoload.php';
+\Fedora\Autoloader\Dependencies::required([
+ dirname(__DIR__) . '/%{namespace}/%{library}/autoload.php',
+ dirname(__DIR__) . '/%{namespace}/autoload.php',
+]);
+EOF
+
%install
-mkdir -p %{buildroot}%{php_home}/Zend/
+: Laminas library
mkdir -p %{buildroot}%{php_home}/%{namespace}/
cp -pr src %{buildroot}%{php_home}/%{namespace}/%{library}
cp -pr config %{buildroot}%{php_home}/%{namespace}/%{library}/config
+cp lf.php %{buildroot}%{php_home}/%{namespace}/autoload.php
+
+: Zend equiv
+mkdir -p %{buildroot}%{php_home}/Zend/
+cp zf.php %{buildroot}%{php_home}/Zend/autoload.php
%check
@@ -118,6 +152,13 @@ require_once '%{buildroot}%{php_home}/%{namespace}/%{library}/autoload.php';
]);
EOF
+: check Zend autoloader
+php %{buildroot}%{php_home}/Zend/autoload.php
+
+: check Laminas autoloader
+php %{buildroot}%{php_home}/%{namespace}/autoload.php
+
+: upstream test suite
ret=0
for cmdarg in "php %{phpunit}" php72 php73 php74; do
if which $cmdarg; then
@@ -137,11 +178,16 @@ exit $ret
%doc *.md
%doc composer.json
%dir %{php_home}/Zend
+ %{php_home}/Zend/autoload.php
%dir %{php_home}/%{namespace}
%{php_home}/%{namespace}/%{library}
+ %{php_home}/%{namespace}/autoload.php
%changelog
+* Thu Jan 16 2020 Remi Collet <remi@remirepo.net> - 1.0.1-3
+- add full framework autoloader
+
* Fri Jan 10 2020 Remi Collet <remi@remirepo.net> - 1.0.1-2
- obsolete dropped packages