Add upstream patch "Remove self-autoload constant and prepend self-autoload PSR-4 register"

epel9
Shawn Iwinski 8 years ago
parent 635908a833
commit a7dffe350b

@ -0,0 +1,37 @@
From f7e0a058af4c34067931687206b62a5a8ecbcb1b Mon Sep 17 00:00:00 2001
From: Shawn Iwinski <siwinski@redhat.com>
Date: Thu, 27 Oct 2016 13:36:57 -0400
Subject: [PATCH] Remove self-autoload constant
---
src/autoload.php | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/src/autoload.php b/src/autoload.php
index e275e62..e876745 100644
--- a/src/autoload.php
+++ b/src/autoload.php
@@ -7,16 +7,12 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
-if (!defined('FEDORA_AUTOLOADER')) {
- if (!class_exists('Fedora\\Autoloader\\Autoload', false)) {
- require_once __DIR__.'/Autoload.php';
- }
-
- if (!function_exists('Fedora\\Autoloader\\requireFile')) {
- require_once __DIR__.'/functions.php';
- }
-
- \Fedora\Autoloader\Autoload::addPsr4('Fedora\\Autoloader\\', __DIR__);
+if (!class_exists('Fedora\\Autoloader\\Autoload', false)) {
+ require_once __DIR__.'/Autoload.php';
+}
- define('FEDORA_AUTOLOADER', true);
+if (!function_exists('Fedora\\Autoloader\\requireFile')) {
+ require_once __DIR__.'/functions.php';
}
+
+\Fedora\Autoloader\Autoload::addPsr4('Fedora\\Autoloader\\', __DIR__, true);

@ -32,7 +32,7 @@
Name: php-%{composer_vendor}-%{composer_project}
Version: %{github_version}
Release: 2%{?github_release}%{?dist}
Release: 5%{?github_release}%{?dist}
Summary: Fedora Autoloader
Group: Development/Libraries
@ -40,6 +40,10 @@ License: MIT
URL: https://github.com/%{github_owner}/%{github_name}
Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz
# Remove self-autoload constant and prepend self-autoload PSR-4 register
# https://github.com/php-fedora/autoloader/pull/11
Patch0: %{name}-pull-11.patch
BuildArch: noarch
# Tests
%if %{with_tests}
@ -90,6 +94,9 @@ Provides needed tools to build other packages:
%prep
%setup -qn %{github_name}-%{github_commit}
: Remove self-autoload constant and prepend self-autoload PSR-4 register
%patch0 -p1
: Set PHP directory in phpab template
sed "s#___AUTOLOAD_PATH___#'%{phpdir}/Fedora/Autoloader'#" \
-i res/phpab/fedora.php.tpl
@ -112,17 +119,7 @@ cp -p res/phpab/fedora.php.tpl %{buildroot}%{phpab_template_dir}/
%check
%if %{with_tests}
if grep Fedora/Autoloader %{_datadir}/php/PHPUnit/Autoload.php; then
# drop to avoid duplicated class (used for boostrap)
:> src/autoload.php
else
# workaround when not in global autoloader
sed -e '/define(/d' -i src/autoload.php
fi
: Run upstream test suite
%{_bindir}/php -d include_path=.:%{buildroot}%{_datadir}/php:%{_datadir}/php:%{_datadir}/pear \
%{_bindir}/phpunit --verbose
%{_bindir}/phpunit --verbose
%else
: Tests skipped
%endif
@ -142,10 +139,14 @@ fi
%changelog
* Thu Oct 27 2016 Remi Collet <remi@fedoraproject.org> - 0.2.0-2
* Thu Oct 27 2016 Shawn Iwinski <shawn@iwin.ski> - 0.2.0-5
- Add upstream patch "Remove self-autoload constant and prepend
self-autoload PSR-4 register"
* Thu Oct 27 2016 Remi Collet <remi@fedoraproject.org> - 0.2.0-4
- workaround when not in global autoloader
* Wed Oct 26 2016 Shawn Iwinski <shawn@iwin.ski> - 0.2.0-1
* Wed Oct 26 2016 Shawn Iwinski <shawn@iwin.ski> - 0.2.0-3
- Update to 0.2.0
- Remove applied patches that are included in 0.2.0

Loading…
Cancel
Save