[Pkg-owncloud-commits] [php-sabredav] 06/13: Provide homemade autoload.php

David Prévot taffit at moszumanska.debian.org
Thu Apr 16 15:17:04 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch 2.1
in repository php-sabredav.

commit e1a80a1008abd582243c5d73d901bec7856a26ca
Author: David Prévot <taffit at debian.org>
Date:   Thu Feb 26 09:52:24 2015 -0400

    Provide homemade autoload.php
---
 debian/autoload.php.tpl                            |  24 +++
 debian/autoload.tests.php.tpl                      |  22 +++
 debian/clean                                       |   2 +-
 debian/control                                     |  10 +-
 debian/install                                     |   5 +-
 ...ssLoader-from-Symfony-instead-of-autoload.patch |  41 -----
 .../patches/0001-Use-homemade-autoload.php.patch   | 202 +++++++++++++++++++++
 .../0002-Drop-Composer-autoLoader-calls.patch      |  29 +++
 ...e-timeout.patch => 0003-Increase-timeout.patch} |   0
 ...-Work-around-the-lack-of-PSR-4-autoloader.patch |  18 --
 debian/patches/series                              |   6 +-
 debian/rules                                       |  18 +-
 debian/tests/control                               |   4 +-
 13 files changed, 308 insertions(+), 73 deletions(-)

diff --git a/debian/autoload.php.tpl b/debian/autoload.php.tpl
new file mode 100644
index 0000000..bf8ad41
--- /dev/null
+++ b/debian/autoload.php.tpl
@@ -0,0 +1,24 @@
+<?php
+
+require_once 'Sabre/VObject/autoload.php';
+// require_once 'Sabre/Event/autoload.php'; (already required by HTTP)
+require_once 'Sabre/HTTP/autoload.php';
+
+// @codingStandardsIgnoreFile
+// @codeCoverageIgnoreStart
+// this is an autogenerated file - do not edit
+spl_autoload_register(
+    function($class) {
+        static $classes = null;
+        if ($classes === null) {
+            $classes = array(
+                ___CLASSLIST___
+            );
+        }
+        $cn = strtolower($class);
+        if (isset($classes[$cn])) {
+            require ___BASEDIR___$classes[$cn];
+        }
+    }
+);
+// @codeCoverageIgnoreEnd
diff --git a/debian/autoload.tests.php.tpl b/debian/autoload.tests.php.tpl
new file mode 100644
index 0000000..9d7ebb9
--- /dev/null
+++ b/debian/autoload.tests.php.tpl
@@ -0,0 +1,22 @@
+<?php
+
+require_once 'Sabre/autoload.php';
+
+// @codingStandardsIgnoreFile
+// @codeCoverageIgnoreStart
+// this is an autogenerated file - do not edit
+spl_autoload_register(
+    function($class) {
+        static $classes = null;
+        if ($classes === null) {
+            $classes = array(
+                ___CLASSLIST___
+            );
+        }
+        $cn = strtolower($class);
+        if (isset($classes[$cn])) {
+            require ___BASEDIR___$classes[$cn];
+        }
+    }
+);
+// @codeCoverageIgnoreEnd
diff --git a/debian/clean b/debian/clean
index 320451b..4bdeaf5 100644
--- a/debian/clean
+++ b/debian/clean
@@ -1,2 +1,2 @@
+lib/autoload.php
 tests/.sabredav
-tests/temp/*
diff --git a/debian/control b/debian/control
index d1cbda4..5098357 100644
--- a/debian/control
+++ b/debian/control
@@ -8,11 +8,12 @@ Uploaders: Thomas Mueller <thomas.mueller at tmit.eu>,
 Build-Depends: debhelper (>= 8.0.0),
                php-codesniffer,
                php-sabre-event,
-               php-sabre-http (>= 3.0.0),
-               php-sabre-vobject (>= 3.2.0),
-               php-symfony-class-loader,
+               php-sabre-http (<< 4),
+               php-sabre-http (>= 3.0.4-2~),
+               php-sabre-vobject (>= 3.4.1),
                php5-curl,
                php5-sqlite,
+               phpab,
                phpunit,
                pkg-php-tools (>= 1.7~)
 Standards-Version: 3.9.6
@@ -24,6 +25,9 @@ Package: php-sabre-dav
 Architecture: all
 Depends: ${misc:Depends}, ${phpcomposer:Debian-require}
 Suggests: ${phpcomposer:Debian-suggest}
+Replaces: ${phpcomposer:Debian-replace}
+Breaks: ${phpcomposer:Debian-conflict}, ${phpcomposer:Debian-replace}
+Provides: ${phpcomposer:Debian-provide}
 Description: ${phpcomposer:description}
  SabreDAV is meant to cover the entire standard, and attempts to allow
  integration using an easy to understand API.
diff --git a/debian/install b/debian/install
index d6ae4c4..32bfc16 100644
--- a/debian/install
+++ b/debian/install
@@ -1,4 +1 @@
-lib/CalDAV	usr/share/php/Sabre
-lib/CardDAV	usr/share/php/Sabre
-lib/DAV		usr/share/php/Sabre
-lib/DAVACL	usr/share/php/Sabre
+lib/*	usr/share/php/Sabre
diff --git a/debian/patches/0001-Use-ClassLoader-from-Symfony-instead-of-autoload.patch b/debian/patches/0001-Use-ClassLoader-from-Symfony-instead-of-autoload.patch
deleted file mode 100644
index dbfb053..0000000
--- a/debian/patches/0001-Use-ClassLoader-from-Symfony-instead-of-autoload.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit at debian.org>
-Date: Tue, 20 May 2014 14:56:49 -0400
-Subject: Use ClassLoader from Symfony instead of autoload
-
-Work around the lack of proper autoload.php from composer by using the
-ClassLoader element from Symfony.
-
-http://symfony.com/doc/current/components/class_loader/class_loader.html
-
-Forwarded: not-needed
----
- tests/bootstrap.php | 16 +++++++++-------
- 1 file changed, 9 insertions(+), 7 deletions(-)
-
-diff --git a/tests/bootstrap.php b/tests/bootstrap.php
-index e74f387..14a2f90 100644
---- a/tests/bootstrap.php
-+++ b/tests/bootstrap.php
-@@ -2,13 +2,15 @@
- 
- set_include_path(__DIR__ . '/../lib/' . PATH_SEPARATOR . __DIR__ . PATH_SEPARATOR . get_include_path());
- 
--$autoLoader = include __DIR__ . '/../vendor/autoload.php';
--
--// SabreDAV tests auto loading
--$autoLoader->add('Sabre\\', __DIR__);
--// VObject tests auto loadiong
--$autoLoader->addPsr4('Sabre\\VObject\\',__DIR__ . '/../vendor/sabre/vobject/tests/VObject');
--
-+require_once 'Symfony/Component/ClassLoader/ClassLoader.php';
-+use Symfony\Component\ClassLoader\ClassLoader;
-+$loader = new ClassLoader();
-+$loader->setUseIncludePath(true);
-+$loader->register();
-+$loader->addPrefixes(array(
-+// ClassLoader does not yet support PSR-4
-+// 	'Sabre' => __DIR__.'/../lib',
-+));
- 
- date_default_timezone_set('UTC');
- 
diff --git a/debian/patches/0001-Use-homemade-autoload.php.patch b/debian/patches/0001-Use-homemade-autoload.php.patch
new file mode 100644
index 0000000..2aeaf1c
--- /dev/null
+++ b/debian/patches/0001-Use-homemade-autoload.php.patch
@@ -0,0 +1,202 @@
+From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit at debian.org>
+Date: Thu, 26 Feb 2015 10:10:46 -0400
+Subject: Use homemade autoload.php
+
+Work around the lack of proper autoload.php from Composer.
+
+Forwarded: not-needed
+---
+ bin/build.php                  | 3 ++-
+ bin/migrateto17.php            | 6 +++---
+ bin/migrateto20.php            | 6 +++---
+ bin/migrateto21.php            | 6 +++---
+ bin/naturalselection           | 2 +-
+ bin/sabredav.php               | 4 ++--
+ examples/addressbookserver.php | 2 +-
+ examples/calendarserver.php    | 2 +-
+ examples/fileserver.php        | 2 +-
+ examples/groupwareserver.php   | 2 +-
+ examples/simplefsserver.php    | 6 +-----
+ 11 files changed, 19 insertions(+), 22 deletions(-)
+
+diff --git a/bin/build.php b/bin/build.php
+index 0e7d7fc..171f34d 100644
+--- a/bin/build.php
++++ b/bin/build.php
+@@ -1,3 +1,4 @@
++#!/usr/bin/php
+ <?php
+ 
+ $tasks = [
+@@ -77,7 +78,7 @@ function init() {
+ 
+     global $version;
+     if (!$version) {
+-        include __DIR__ . '/../vendor/autoload.php';
++        include __DIR__ . '/../lib/autoload.php';
+         $version = Sabre\DAV\Version::VERSION;
+     }
+ 
+diff --git a/bin/migrateto17.php b/bin/migrateto17.php
+index 66a9ee5..00f0d08 100755
+--- a/bin/migrateto17.php
++++ b/bin/migrateto17.php
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env php
++#!/usr/bin/php
+ <?php
+ 
+ echo "SabreDAV migrate script for version 1.7\n";
+@@ -36,8 +36,8 @@ HELLO;
+ // There's a bunch of places where the autoloader could be, so we'll try all of
+ // them.
+ $paths = array(
+-    __DIR__ . '/../vendor/autoload.php',
+-    __DIR__ . '/../../../autoload.php',
++    __DIR__ . '/../lib/autoload.php',
++    __DIR__ . '/../share/php/Sabre/autoload.php',
+ );
+ 
+ foreach($paths as $path) {
+diff --git a/bin/migrateto20.php b/bin/migrateto20.php
+index aa003e8..079968c 100755
+--- a/bin/migrateto20.php
++++ b/bin/migrateto20.php
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env php
++#!/usr/bin/php
+ <?php
+ 
+ echo "SabreDAV migrate script for version 2.0\n";
+@@ -42,8 +42,8 @@ HELLO;
+ // There's a bunch of places where the autoloader could be, so we'll try all of
+ // them.
+ $paths = [
+-    __DIR__ . '/../vendor/autoload.php',
+-    __DIR__ . '/../../../autoload.php',
++    __DIR__ . '/../lib/autoload.php',
++    __DIR__ . '/../share/php/Sabre/autoload.php',
+ ];
+ 
+ foreach($paths as $path) {
+diff --git a/bin/migrateto21.php b/bin/migrateto21.php
+index c0cef52..c83ad3c 100755
+--- a/bin/migrateto21.php
++++ b/bin/migrateto21.php
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env php
++#!/usr/bin/php
+ <?php
+ 
+ echo "SabreDAV migrate script for version 2.1\n";
+@@ -43,8 +43,8 @@ HELLO;
+ // There's a bunch of places where the autoloader could be, so we'll try all of
+ // them.
+ $paths = [
+-    __DIR__ . '/../vendor/autoload.php',
+-    __DIR__ . '/../../../autoload.php',
++    __DIR__ . '/../lib/autoload.php',
++    __DIR__ . '/../share/php/Sabre/autoload.php',
+ ];
+ 
+ foreach($paths as $path) {
+diff --git a/bin/naturalselection b/bin/naturalselection
+index aa5554d..8ccd33b 100755
+--- a/bin/naturalselection
++++ b/bin/naturalselection
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/python
+ 
+ #
+ # Copyright (c) 2009-2010 Evert Pot
+diff --git a/bin/sabredav.php b/bin/sabredav.php
+index 34a674f..def97fd 100755
+--- a/bin/sabredav.php
++++ b/bin/sabredav.php
+@@ -28,8 +28,8 @@ if (php_sapi_name()!=='cli-server') {
+ 
+ 
+ $paths = array(
+-    __DIR__ . '/../vendor/autoload.php',
+-    __DIR__ . '/../../../autoload.php',
++    __DIR__ . '/../lib/autoload.php',
++    __DIR__ . '/autoload.php',
+ );
+ 
+ foreach($paths as $path) {
+diff --git a/examples/addressbookserver.php b/examples/addressbookserver.php
+index 4ae78f7..ae0e6ca 100644
+--- a/examples/addressbookserver.php
++++ b/examples/addressbookserver.php
+@@ -26,7 +26,7 @@ function exception_error_handler($errno, $errstr, $errfile, $errline ) {
+ set_error_handler("exception_error_handler");
+ 
+ // Autoloader
+-require_once 'vendor/autoload.php';
++require_once 'Sabre/autoload.php';
+ 
+ // Backends
+ $authBackend      = new Sabre\DAV\Auth\Backend\PDO($pdo);
+diff --git a/examples/calendarserver.php b/examples/calendarserver.php
+index de08a10..d83e08b 100644
+--- a/examples/calendarserver.php
++++ b/examples/calendarserver.php
+@@ -26,7 +26,7 @@ function exception_error_handler($errno, $errstr, $errfile, $errline ) {
+ set_error_handler("exception_error_handler");
+ 
+ // Files we need
+-require_once 'vendor/autoload.php';
++require_once 'Sabre/autoload.php';
+ 
+ // Backends
+ $authBackend = new Sabre\DAV\Auth\Backend\PDO($pdo);
+diff --git a/examples/fileserver.php b/examples/fileserver.php
+index 952b550..e975bbe 100644
+--- a/examples/fileserver.php
++++ b/examples/fileserver.php
+@@ -20,7 +20,7 @@ $tmpDir = 'tmpdata';
+ 
+ 
+ // Files we need
+-require_once 'vendor/autoload.php';
++require_once 'Sabre/autoload.php';
+ 
+ // Create the root node
+ $root = new \Sabre\DAV\FS\Directory($publicDir);
+diff --git a/examples/groupwareserver.php b/examples/groupwareserver.php
+index 668b92b..d80bddc 100644
+--- a/examples/groupwareserver.php
++++ b/examples/groupwareserver.php
+@@ -48,7 +48,7 @@ function exception_error_handler($errno, $errstr, $errfile, $errline ) {
+ set_error_handler("exception_error_handler");
+ 
+ // Autoloader
+-require_once 'vendor/autoload.php';
++require_once 'Sabre/autoload.php';
+ 
+ /**
+  * The backends. Yes we do really need all of them.
+diff --git a/examples/simplefsserver.php b/examples/simplefsserver.php
+index cf64730..f0bf08e 100644
+--- a/examples/simplefsserver.php
++++ b/examples/simplefsserver.php
+@@ -1,9 +1,5 @@
+ <?php
+ 
+-// !!!! Make sure the Sabre directory is in the include_path !!!
+-// example:
+-// set_include_path('lib/' . PATH_SEPARATOR . get_include_path());
+-
+ /*
+ 
+ This example demonstrates a simple way to create your own virtual filesystems.
+@@ -24,7 +20,7 @@ date_default_timezone_set('Canada/Eastern');
+ $publicDir = 'public';
+ 
+ // Files we need
+-require_once 'vendor/autoload.php';
++require_once 'Sabre/autoload.php';
+ 
+ class MyCollection extends Sabre\DAV\Collection {
+ 
diff --git a/debian/patches/0002-Drop-Composer-autoLoader-calls.patch b/debian/patches/0002-Drop-Composer-autoLoader-calls.patch
new file mode 100644
index 0000000..7c68faf
--- /dev/null
+++ b/debian/patches/0002-Drop-Composer-autoLoader-calls.patch
@@ -0,0 +1,29 @@
+From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit at debian.org>
+Date: Tue, 20 May 2014 14:56:49 -0400
+Subject: Drop Composer autoLoader calls
+
+Work around the lack of proper autoload.php from Composer by using a
+static ClassLoader made by PHPAB.
+
+Forwarded: not-needed
+---
+ tests/bootstrap.php | 6 ------
+ 1 file changed, 6 deletions(-)
+
+diff --git a/tests/bootstrap.php b/tests/bootstrap.php
+index e74f387..7da7881 100644
+--- a/tests/bootstrap.php
++++ b/tests/bootstrap.php
+@@ -4,12 +4,6 @@ set_include_path(__DIR__ . '/../lib/' . PATH_SEPARATOR . __DIR__ . PATH_SEPARATO
+ 
+ $autoLoader = include __DIR__ . '/../vendor/autoload.php';
+ 
+-// SabreDAV tests auto loading
+-$autoLoader->add('Sabre\\', __DIR__);
+-// VObject tests auto loadiong
+-$autoLoader->addPsr4('Sabre\\VObject\\',__DIR__ . '/../vendor/sabre/vobject/tests/VObject');
+-
+-
+ date_default_timezone_set('UTC');
+ 
+ $config = [
diff --git a/debian/patches/0002-Increase-timeout.patch b/debian/patches/0003-Increase-timeout.patch
similarity index 100%
rename from debian/patches/0002-Increase-timeout.patch
rename to debian/patches/0003-Increase-timeout.patch
diff --git a/debian/patches/0003-Work-around-the-lack-of-PSR-4-autoloader.patch b/debian/patches/0003-Work-around-the-lack-of-PSR-4-autoloader.patch
deleted file mode 100644
index 674b9c6..0000000
--- a/debian/patches/0003-Work-around-the-lack-of-PSR-4-autoloader.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit at debian.org>
-Date: Tue, 20 May 2014 16:16:30 -0400
-Subject: Work around the lack of PSR-4 autoloader
-
-Forwarded: not-needed
----
- lib/Sabre | 1 +
- 1 file changed, 1 insertion(+)
- create mode 120000 lib/Sabre
-
-diff --git a/lib/Sabre b/lib/Sabre
-new file mode 120000
-index 0000000..945c9b4
---- /dev/null
-+++ b/lib/Sabre
-@@ -0,0 +1 @@
-+.
-\ No newline at end of file
diff --git a/debian/patches/series b/debian/patches/series
index fa9c6ad..4a5378b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,3 @@
-0001-Use-ClassLoader-from-Symfony-instead-of-autoload.patch
-0002-Increase-timeout.patch
-0003-Work-around-the-lack-of-PSR-4-autoloader.patch
+0001-Use-homemade-autoload.php.patch
+0002-Drop-Composer-autoLoader-calls.patch
+0003-Increase-timeout.patch
diff --git a/debian/rules b/debian/rules
index c870fb7..576d05a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -2,9 +2,25 @@
 %:
 	dh $@ --with phpcomposer -XICON-LICENSE
 
+override_dh_auto_build:
+	dh_auto_build
+	phpab	--output lib/autoload.php \
+		--template debian/autoload.php.tpl \
+		lib
+	mkdir --parents vendor
+	phpab \
+		--output vendor/autoload.php \
+		--basedir vendor \
+		--template debian/autoload.php.tpl \
+		lib tests/Sabre
+
+override_dh_auto_clean:
+	rm -rf tests/temp vendor
+	dh_auto_clean
+
 override_dh_auto_test:
 ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
-	cd tests && phpunit
+	phpunit --configuration tests/phpunit.xml
 	phpcs -p --standard=tests/phpcs/ruleset.xml lib
 else
 	@echo "** tests disabled"
diff --git a/debian/tests/control b/debian/tests/control
index cef8167..8d58c9c 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -1,6 +1,6 @@
 Test-Command: phpcs -p --standard=tests/phpcs/ruleset.xml /usr/share/php/Sabre/*DAV*
 Depends: @, php-codesniffer
 
-Test-Command: quilt pop -f && cd tests && phpunit
+Test-Command: mkdir --parents vendor && phpab --output vendor/autoload.php --basedir vendor --template debian/autoload.tests.php.tpl tests/Sabre && phpunit --configuration tests/phpunit.xml
 Restrictions: rw-build-tree
-Depends: @, php-symfony-class-loader, php5-curl, php5-sqlite, phpunit, quilt
+Depends: @, php5-curl, php5-sqlite, phpab, phpunit

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabredav.git



More information about the Pkg-owncloud-commits mailing list