[Pkg-owncloud-commits] [php-sabredav] 08/11: Provide homemade autoload.php

David Prévot taffit at moszumanska.debian.org
Tue Mar 31 22:25:23 UTC 2015


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

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

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

    Provide homemade autoload.php
    
    The previously provided one is totally useless.
---
 debian/autoload.php.tpl                            |  22 +++
 debian/clean                                       |   2 +-
 debian/control                                     |  10 +-
 ...ssLoader-from-Symfony-instead-of-autoload.patch |  32 ----
 .../patches/0001-Use-homemade-autoload.php.patch   | 167 +++++++++++++++++++++
 .../Use-installed-class-for-DEP-8-tests.patch      |  21 +--
 debian/patches/series                              |   2 +-
 debian/rules                                       |  12 +-
 debian/tests/control                               |   2 +-
 debian/tests/phpunit                               |   4 +-
 10 files changed, 222 insertions(+), 52 deletions(-)

diff --git a/debian/autoload.php.tpl b/debian/autoload.php.tpl
new file mode 100644
index 0000000..d9894be
--- /dev/null
+++ b/debian/autoload.php.tpl
@@ -0,0 +1,22 @@
+<?php
+
+require_once 'Sabre/VObject/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..f9de1ce 100644
--- a/debian/clean
+++ b/debian/clean
@@ -1,2 +1,2 @@
+lib/Sabre/autoload.php
 tests/.sabredav
-tests/temp/*
diff --git a/debian/control b/debian/control
index cb99e3b..fc0c936 100644
--- a/debian/control
+++ b/debian/control
@@ -6,10 +6,10 @@ Uploaders: Thomas Mueller <thomas.mueller at tmit.eu>,
            Paul van Tilburg <paulvt at debian.org>,
            David Prévot <taffit at debian.org>
 Build-Depends: debhelper (>= 8.0.0),
-               php-sabre-vobject,
-               php-symfony-class-loader,
+               php-sabre-vobject (>= 2.1.7),
                php5-curl,
                php5-sqlite,
+               phpab,
                phpunit,
                pkg-php-tools (>= 1.7~)
 Standards-Version: 3.9.6
@@ -19,8 +19,12 @@ Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-owncloud/php-sabredav.git
 
 Package: php-sabre-dav
 Architecture: all
-Depends: ${misc:Depends}, ${phpcomposer:Debian-require}
+Depends: php-sabre-vobject (>= 2.1.7),
+         ${misc:Depends},
+         ${phpcomposer:Debian-require}
 Suggests: ${phpcomposer:Debian-suggest}
+Replaces: ${phpcomposer:Debian-replace}
+Breaks: ${phpcomposer:Debian-conflict}, ${phpcomposer:Debian-replace}
 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/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 b878006..0000000
--- a/debian/patches/0001-Use-ClassLoader-from-Symfony-instead-of-autoload.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit at debian.org>
-Date: Wed, 19 Mar 2014 11:19:26 -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 | 9 ++++++++-
- 1 file changed, 8 insertions(+), 1 deletion(-)
-
-diff --git a/tests/bootstrap.php b/tests/bootstrap.php
-index a6493ce..972e278 100644
---- a/tests/bootstrap.php
-+++ b/tests/bootstrap.php
-@@ -6,7 +6,14 @@ define('SABRE_MYSQLPASS','');
- 
- set_include_path(__DIR__ . '/../lib/' . PATH_SEPARATOR . __DIR__ . PATH_SEPARATOR . get_include_path());
- 
--include __DIR__ . '/../vendor/autoload.php';
-+require_once 'Symfony/Component/ClassLoader/ClassLoader.php';
-+use Symfony\Component\ClassLoader\ClassLoader;
-+$loader = new ClassLoader();
-+$loader->setUseIncludePath(true);
-+$loader->register();
-+$loader->addPrefixes(array(
-+	'Sabre' => __DIR__.'/../lib',
-+));
- include 'Sabre/TestUtil.php';
- include 'Sabre/DAVServerTest.php';
- 
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..b969e13
--- /dev/null
+++ b/debian/patches/0001-Use-homemade-autoload.php.patch
@@ -0,0 +1,167 @@
+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                  | 2 +-
+ bin/migrateto17.php            | 6 +++---
+ bin/naturalselection.py        | 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 +-----
+ tests/bootstrap.php            | 2 +-
+ 10 files changed, 13 insertions(+), 17 deletions(-)
+
+diff --git a/bin/build.php b/bin/build.php
+index 11cca1e..86a77b0 100644
+--- a/bin/build.php
++++ b/bin/build.php
+@@ -77,7 +77,7 @@ function init() {
+ 
+     global $version;
+     if (!$version) {
+-        include __DIR__ . '/../vendor/autoload.php';
++        include __DIR__ . '/../lib/Sabre/autoload.php';
+         $version = Sabre\DAV\Version::VERSION;
+     }
+ 
+diff --git a/bin/migrateto17.php b/bin/migrateto17.php
+index 66a9ee5..099aece 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/Sabre/autoload.php',
++    __DIR__ . '/../share/php/Sabre/autoload.php',
+ );
+ 
+ foreach($paths as $path) {
+diff --git a/bin/naturalselection.py b/bin/naturalselection.py
+index aa5554d..8ccd33b 100755
+--- a/bin/naturalselection.py
++++ b/bin/naturalselection.py
+@@ -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..34f79b1 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/Sabre/autoload.php',
++    __DIR__ . '/autoload.php',
+ );
+ 
+ foreach($paths as $path) {
+diff --git a/examples/addressbookserver.php b/examples/addressbookserver.php
+index b8986bc..18e7975 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 a8e5c5f..de62a23 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 c0f06e9..0494e83 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 f1b4a11..64a289d 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/tests/bootstrap.php b/tests/bootstrap.php
+index a6493ce..1cb5db5 100644
+--- a/tests/bootstrap.php
++++ b/tests/bootstrap.php
+@@ -6,7 +6,7 @@ define('SABRE_MYSQLPASS','');
+ 
+ set_include_path(__DIR__ . '/../lib/' . PATH_SEPARATOR . __DIR__ . PATH_SEPARATOR . get_include_path());
+ 
+-include __DIR__ . '/../vendor/autoload.php';
++include __DIR__ . '/../lib/Sabre/autoload.php';
+ include 'Sabre/TestUtil.php';
+ include 'Sabre/DAVServerTest.php';
+ 
diff --git a/debian/patches/DEP-8/Use-installed-class-for-DEP-8-tests.patch b/debian/patches/DEP-8/Use-installed-class-for-DEP-8-tests.patch
index 9d0e440..c4ec6a2 100644
--- a/debian/patches/DEP-8/Use-installed-class-for-DEP-8-tests.patch
+++ b/debian/patches/DEP-8/Use-installed-class-for-DEP-8-tests.patch
@@ -1,21 +1,22 @@
 From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit at debian.org>
-Date: Wed, 19 Mar 2014 11:24:42 -0400
+Date: Thu, 26 Feb 2015 10:18:08 -0400
 Subject: Use installed class for DEP-8 tests
 
 Gbp: Topic DEP-8
 ---
- tests/bootstrap.php | 1 -
- 1 file changed, 1 deletion(-)
+ tests/bootstrap.php | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/tests/bootstrap.php b/tests/bootstrap.php
-index 972e278..847beea 100644
+index 1cb5db5..aee8a8e 100644
 --- a/tests/bootstrap.php
 +++ b/tests/bootstrap.php
-@@ -12,7 +12,6 @@ $loader = new ClassLoader();
- $loader->setUseIncludePath(true);
- $loader->register();
- $loader->addPrefixes(array(
--	'Sabre' => __DIR__.'/../lib',
- ));
+@@ -6,7 +6,7 @@ define('SABRE_MYSQLPASS','');
+ 
+ set_include_path(__DIR__ . '/../lib/' . PATH_SEPARATOR . __DIR__ . PATH_SEPARATOR . get_include_path());
+ 
+-include __DIR__ . '/../lib/Sabre/autoload.php';
++include 'Sabre/autoload.php';
  include 'Sabre/TestUtil.php';
  include 'Sabre/DAVServerTest.php';
+ 
diff --git a/debian/patches/series b/debian/patches/series
index e4166b6..91f7a1b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1 @@
-0001-Use-ClassLoader-from-Symfony-instead-of-autoload.patch
+0001-Use-homemade-autoload.php.patch
diff --git a/debian/rules b/debian/rules
index 6fd9e74..fe23c4f 100755
--- a/debian/rules
+++ b/debian/rules
@@ -2,9 +2,19 @@
 %:
 	dh $@ --with phpcomposer
 
+override_dh_auto_build:
+	dh_auto_build
+	phpab	--output lib/Sabre/autoload.php \
+		--template debian/autoload.php.tpl \
+		lib/Sabre
+
+override_dh_auto_clean:
+	rm -rf tests/temp
+	dh_auto_clean
+
 override_dh_auto_test:
 ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
-	cd tests && phpunit
+	phpunit --configuration tests/phpunit.xml
 else
 	@echo "** tests disabled"
 endif
diff --git a/debian/tests/control b/debian/tests/control
index 7b31ca7..08b747a 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -1,3 +1,3 @@
 Tests: phpunit
 Restrictions: rw-build-tree
-Depends: @, patch, php-symfony-class-loader, php5-curl, php5-sqlite, phpunit
+Depends: @, patch, php5-curl, php5-sqlite, phpunit
diff --git a/debian/tests/phpunit b/debian/tests/phpunit
index 7584ea9..f6c532e 100755
--- a/debian/tests/phpunit
+++ b/debian/tests/phpunit
@@ -1,8 +1,6 @@
 #! /bin/sh
 patch -p1 < debian/patches/DEP-8/Use-installed-class-for-DEP-8-tests.patch
-cd tests
-phpunit
+phpunit --configuration tests/phpunit.xml
 exit=$?
-cd ..
 patch -Rp1 < debian/patches/DEP-8/Use-installed-class-for-DEP-8-tests.patch
 exit $exit

-- 
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