summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2016-10-29 15:35:33 +0200
committerRemi Collet <fedora@famillecollet.com>2016-10-29 15:35:33 +0200
commit3c9a991ffe0fb29a29498cecf171cfc88d0da46b (patch)
treec32321b04223cae66061bb9ba2d2b15ce5a3c4e3
parent863da66d20b908169f5c65412339f0df5de76318 (diff)
php-sabre-dav: switch from symfony/class-loader to fedora/autoloader
-rw-r--r--php-sabre-dav-autoload.patch2
-rw-r--r--php-sabre-dav-autoload.php37
-rw-r--r--php-sabre-dav.spec33
3 files changed, 38 insertions, 34 deletions
diff --git a/php-sabre-dav-autoload.patch b/php-sabre-dav-autoload.patch
index 8097050..a1af77d 100644
--- a/php-sabre-dav-autoload.patch
+++ b/php-sabre-dav-autoload.patch
@@ -11,7 +11,7 @@ diff -up tests/bootstrap.php.orig tests/bootstrap.php
// SabreDAV tests auto loading
-$autoLoader->add('Sabre\\', __DIR__);
-+$fedoraClassLoader->addPrefix('Sabre\\', __DIR__);
++\Fedora\Autoloader\Autoload::addPsr0('Sabre\\', __DIR__);
+
// VObject tests auto loading
-$autoLoader->addPsr4('Sabre\\VObject\\',__DIR__ . '/../vendor/sabre/vobject/tests/VObject');
diff --git a/php-sabre-dav-autoload.php b/php-sabre-dav-autoload.php
index 93a3196..160dfab 100644
--- a/php-sabre-dav-autoload.php
+++ b/php-sabre-dav-autoload.php
@@ -1,31 +1,18 @@
<?php
-/**
- * Autoloader for sabre/dav and its dependencies
- */
+/* Autoloader for sabre/dav and its dependencies */
-$vendorDir = '/usr/share/php';
+require_once '/usr/share/php/Fedora/Autoloader/autoload.php';
-// Use Symfony autoloader
-if (!isset($fedoraClassLoader) || !($fedoraClassLoader instanceof \Symfony\Component\ClassLoader\ClassLoader)) {
- if (!class_exists('Symfony\\Component\\ClassLoader\\ClassLoader', false)) {
- require_once $vendorDir . '/Symfony/Component/ClassLoader/ClassLoader.php';
- }
+\Fedora\Autoloader\Autoload::addPsr4('Sabre\\DAV\\', dirname(__DIR__) . '/DAV');
+\Fedora\Autoloader\Autoload::addPsr4('Sabre\\DAVACL\\', dirname(__DIR__) . '/DAVACL');
+\Fedora\Autoloader\Autoload::addPsr4('Sabre\\CalDAV\\', dirname(__DIR__) . '/CalDAV');
+\Fedora\Autoloader\Autoload::addPsr4('Sabre\\CardDAV\\', dirname(__DIR__) . '/CardDAV');
- $fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader();
- $fedoraClassLoader->register();
-}
-
-$thisdir = dirname(dirname(__DIR__));
-$fedoraClassLoader->addPrefixes(array(
- 'Sabre\\DAV\\' => $thisdir,
- 'Sabre\\DAVACL\\' => $thisdir,
- 'Sabre\\CalDAV\\' => $thisdir,
- 'Sabre\\CardDAV\\' => $thisdir,
+\Fedora\Autoloader\Dependencies::required(array(
+ '/usr/share/php/Sabre/Event/autoload.php',
+ '/usr/share/php/Sabre/HTTP/autoload.php',
+ '/usr/share/php/Sabre/VObject/autoload.php',
+ '/usr/share/php/Sabre/Xml/autoload.php',
+ '/usr/share/php/Sabre/Uri/autoload.php',
));
-// dependencies
-require_once $vendorDir . '/Sabre/Event/autoload.php';
-require_once $vendorDir . '/Sabre/HTTP/autoload.php';
-require_once $vendorDir . '/Sabre/VObject/autoload.php';
-require_once $vendorDir . '/Sabre/Xml/autoload.php';
-require_once $vendorDir . '/Sabre/Uri/autoload.php';
diff --git a/php-sabre-dav.spec b/php-sabre-dav.spec
index d57596f..0efef4d 100644
--- a/php-sabre-dav.spec
+++ b/php-sabre-dav.spec
@@ -19,16 +19,16 @@
Name: php-%{gh_project}
Summary: WebDAV Framework for PHP
Version: 3.0.9
-Release: 1%{?dist}
+Release: 2%{?dist}
URL: https://github.com/%{gh_owner}/%{gh_project}
License: BSD
Group: Development/Libraries
Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}-%{gh_short}.tar.gz
-Source1: %{name}-autoload-dev.php
+Source1: %{name}-autoload.php
# replace composer autoloader
-Patch0: %{name}-autoload-dev.patch
+Patch0: %{name}-autoload.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
@@ -52,7 +52,7 @@ BuildRequires: php-libxml
BuildRequires: php-curl
BuildRequires: php-pdo
# Autoloader
-BuildRequires: php-composer(symfony/class-loader)
+BuildRequires: php-composer(fedora/autoloader)
BuildRequires: php-pdo_sqlite
%endif
@@ -98,7 +98,7 @@ Requires: php-libxml
Requires: php-curl
Requires: php-pdo
# Autoloader
-Requires: php-composer(symfony/class-loader)
+Requires: php-composer(fedora/autoloader)
Provides: php-composer(sabre/dav) = %{version}
@@ -122,6 +122,8 @@ Feature list:
* CardDAV (tested with OS/X addressbook, the iOS addressbook and Evolution).
* Over 97% unittest code coverage.
+Autoloader: %{_datadir}/php/Sabre/DAV/autoload.php
+
%prep
%setup -q -n %{gh_project}-%{gh_commit}
@@ -155,11 +157,23 @@ cd tests
sed -e 's:@BUILDROOT@:%{buildroot}:' -i bootstrap.php
: Run upstream test suite against installed library
-%{_bindir}/phpunit --verbose
-
+# remirepo:12
+run=0
+ret=0
+if which php56; then
+ php56 %{_bindir}/phpunit || ret=1
+ run=1
+fi
if which php70; then
- php70 %{_bindir}/phpunit --verbose
+ # PHP 7.1, 1 failure: Sabre\DAV\ServerEventsTest::testMethod
+ php70 %{_bindir}/phpunit || ret=1
+ run=1
fi
+if [ $run -eq 0 ]; then
+%{_bindir}/phpunit --verbose
+# remirepo:2
+fi
+exit $ret
%else
: Skip upstream test suite
%endif
@@ -179,6 +193,9 @@ fi
%changelog
+* Sat Oct 29 2016 Remi Collet <remi@fedoraproject.org> - 3.0.9-3
+- switch from symfony/class-loader to fedora/autoloader
+
* Thu Apr 7 2016 Remi Collet <remi@fedoraproject.org> - 3.0.9-1
- update to 3.0.9
- add dependency on sabre/xml