[Pkg-owncloud-commits] [php-sabredav] 70/75: Provide homemade autoload.php

David Prévot taffit at moszumanska.debian.org
Thu Feb 26 18:51:56 UTC 2015


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

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

commit bb2d450d80e1088ffe646c0070c0a2004d32b654
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                            |  25 +++
 debian/clean                                       |   2 +-
 debian/control                                     |   4 +
 debian/install                                     |   5 +-
 .../patches/0001-Use-homemade-autoload.php.patch   | 217 +++++++++++++++++++++
 ...oader-from-Symfony-instead-of-autoLoader.patch} |  24 +--
 ...e-timeout.patch => 0003-Increase-timeout.patch} |   0
 ...-Work-around-the-lack-of-PSR-4-autoloader.patch |  18 --
 .../Use-installed-class-for-DEP-8-tests.patch      |  22 +++
 debian/patches/series                              |   6 +-
 debian/rules                                       |  12 +-
 debian/tests/control                               |   4 +-
 debian/tests/phpunit                               |   6 +
 13 files changed, 302 insertions(+), 43 deletions(-)

diff --git a/debian/autoload.php.tpl b/debian/autoload.php.tpl
new file mode 100644
index 0000000..625325e
--- /dev/null
+++ b/debian/autoload.php.tpl
@@ -0,0 +1,25 @@
+<?php
+
+require_once 'Sabre/VObject/autoload.php';
+require_once 'Sabre/Event/autoload.php';
+require_once 'Sabre/HTTP/autoload.php';
+require_once 'Sabre/Uri/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 6b84921..411fad5 100644
--- a/debian/control
+++ b/debian/control
@@ -14,6 +14,7 @@ Build-Depends: debhelper (>= 8.0.0),
                php-symfony-class-loader,
                php5-curl,
                php5-sqlite,
+               phpab,
                phpunit,
                pkg-php-tools (>= 1.7~)
 Standards-Version: 3.9.6
@@ -25,6 +26,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-homemade-autoload.php.patch b/debian/patches/0001-Use-homemade-autoload.php.patch
new file mode 100644
index 0000000..29afc6b
--- /dev/null
+++ b/debian/patches/0001-Use-homemade-autoload.php.patch
@@ -0,0 +1,217 @@
+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                  | 4 ++--
+ 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 +-----
+ tests/bootstrap.php            | 2 +-
+ 12 files changed, 20 insertions(+), 24 deletions(-)
+
+diff --git a/bin/build.php b/bin/build.php
+index f861138..79336d1 100755
+--- a/bin/build.php
++++ b/bin/build.php
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env php
++#!/usr/bin/php
+ <?php
+ 
+ $tasks = [
+@@ -78,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..3a858ae 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__ . '/../share/php/Sabre/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/tests/bootstrap.php b/tests/bootstrap.php
+index e254236..7ddbef2 100644
+--- a/tests/bootstrap.php
++++ b/tests/bootstrap.php
+@@ -2,7 +2,7 @@
+ 
+ set_include_path(__DIR__ . '/../lib/' . PATH_SEPARATOR . __DIR__ . PATH_SEPARATOR . get_include_path());
+ 
+-$autoLoader = include __DIR__ . '/../vendor/autoload.php';
++$autoLoader = include __DIR__ . '/../lib/autoload.php';
+ 
+ // SabreDAV tests auto loading
+ $autoLoader->add('Sabre\\', __DIR__);
diff --git a/debian/patches/0001-Use-ClassLoader-from-Symfony-instead-of-autoload.patch b/debian/patches/0002-Use-ClassLoader-from-Symfony-instead-of-autoLoader.patch
similarity index 58%
rename from debian/patches/0001-Use-ClassLoader-from-Symfony-instead-of-autoload.patch
rename to debian/patches/0002-Use-ClassLoader-from-Symfony-instead-of-autoLoader.patch
index a363a56..bcb8faa 100644
--- a/debian/patches/0001-Use-ClassLoader-from-Symfony-instead-of-autoload.patch
+++ b/debian/patches/0002-Use-ClassLoader-from-Symfony-instead-of-autoLoader.patch
@@ -1,41 +1,37 @@
 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
+Subject: Use ClassLoader from Symfony instead of autoLoader
 
-Work around the lack of proper autoload.php from composer by using the
+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(-)
+ tests/bootstrap.php | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
 
 diff --git a/tests/bootstrap.php b/tests/bootstrap.php
-index e254236..14a2f90 100644
+index 7ddbef2..4fdfec2 100644
 --- a/tests/bootstrap.php
 +++ b/tests/bootstrap.php
-@@ -2,13 +2,15 @@
+@@ -4,10 +4,14 @@ set_include_path(__DIR__ . '/../lib/' . PATH_SEPARATOR . __DIR__ . PATH_SEPARATO
  
- set_include_path(__DIR__ . '/../lib/' . PATH_SEPARATOR . __DIR__ . PATH_SEPARATOR . get_include_path());
+ $autoLoader = include __DIR__ . '/../lib/autoload.php';
  
--$autoLoader = include __DIR__ . '/../vendor/autoload.php';
--
 -// SabreDAV tests auto loading
 -$autoLoader->add('Sabre\\', __DIR__);
 -// VObject tests auto loading
 -$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->setUseIncludePath(true);
 +$loader->register();
 +$loader->addPrefixes(array(
-+// ClassLoader does not yet support PSR-4
-+// 	'Sabre' => __DIR__.'/../lib',
++	'Sabre' => __DIR__,
 +));
  
- date_default_timezone_set('UTC');
  
+ date_default_timezone_set('UTC');
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/DEP-8/Use-installed-class-for-DEP-8-tests.patch b/debian/patches/DEP-8/Use-installed-class-for-DEP-8-tests.patch
new file mode 100644
index 0000000..01a8424
--- /dev/null
+++ b/debian/patches/DEP-8/Use-installed-class-for-DEP-8-tests.patch
@@ -0,0 +1,22 @@
+From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit at debian.org>
+Date: Thu, 26 Feb 2015 10:18:08 -0400
+Subject: Use installed class for DEP-8 tests
+
+Gbp: Topic DEP-8
+---
+ tests/bootstrap.php | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tests/bootstrap.php b/tests/bootstrap.php
+index 4fdfec2..e01e9d3 100644
+--- a/tests/bootstrap.php
++++ b/tests/bootstrap.php
+@@ -2,7 +2,7 @@
+ 
+ set_include_path(__DIR__ . '/../lib/' . PATH_SEPARATOR . __DIR__ . PATH_SEPARATOR . get_include_path());
+ 
+-$autoLoader = include __DIR__ . '/../lib/autoload.php';
++$autoLoader = include 'Sabre/autoload.php';
+ 
+ require_once 'Symfony/Component/ClassLoader/ClassLoader.php';
+ use Symfony\Component\ClassLoader\ClassLoader;
diff --git a/debian/patches/series b/debian/patches/series
index fa9c6ad..534e718 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-Use-ClassLoader-from-Symfony-instead-of-autoLoader.patch
+0003-Increase-timeout.patch
diff --git a/debian/rules b/debian/rules
index c870fb7..683d1fb 100755
--- a/debian/rules
+++ b/debian/rules
@@ -2,9 +2,19 @@
 %:
 	dh $@ --with phpcomposer -XICON-LICENSE
 
+override_dh_auto_build:
+	dh_auto_build
+	phpab	--output lib/autoload.php \
+		--template debian/autoload.php.tpl \
+		lib
+
+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
 	phpcs -p --standard=tests/phpcs/ruleset.xml lib
 else
 	@echo "** tests disabled"
diff --git a/debian/tests/control b/debian/tests/control
index cef8167..191a840 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
+Tests: phpunit
 Restrictions: rw-build-tree
-Depends: @, php-symfony-class-loader, php5-curl, php5-sqlite, phpunit, quilt
+Depends: @, patch, php-symfony-class-loader, php5-curl, php5-sqlite, phpunit
diff --git a/debian/tests/phpunit b/debian/tests/phpunit
new file mode 100755
index 0000000..f6c532e
--- /dev/null
+++ b/debian/tests/phpunit
@@ -0,0 +1,6 @@
+#! /bin/sh
+patch -p1 < debian/patches/DEP-8/Use-installed-class-for-DEP-8-tests.patch
+phpunit --configuration tests/phpunit.xml
+exit=$?
+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