[Pkg-owncloud-commits] [php-sabre-vobject] 63/65: Provide homemade autoload.php
David Prévot
taffit at moszumanska.debian.org
Tue Feb 24 23:57:21 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository php-sabre-vobject.
commit 48ee68bcfd65b51973d325539e8aa86fe1aafe28
Author: David Prévot <taffit at debian.org>
Date: Tue Feb 24 15:21:04 2015 -0400
Provide homemade autoload.php
---
debian/clean | 1 +
debian/control | 3 +-
...ssLoader-from-Symfony-instead-of-autoload.patch | 47 --------
.../patches/0001-Use-homemade-autoloader.php.patch | 129 +++++++++++++++++++++
...ject-Workaround-the-lack-of-PSR-4-support.patch | 27 -----
...Loader-from-Symfony-instead-of-autoLoader.patch | 31 +++++
debian/patches/series | 4 +-
debian/rules | 6 +-
debian/tests/control | 2 +-
9 files changed, 171 insertions(+), 79 deletions(-)
diff --git a/debian/clean b/debian/clean
new file mode 100644
index 0000000..6d47d7c
--- /dev/null
+++ b/debian/clean
@@ -0,0 +1 @@
+lib/autoload.php
diff --git a/debian/control b/debian/control
index 7851737..fdd8f64 100644
--- a/debian/control
+++ b/debian/control
@@ -5,7 +5,8 @@ Maintainer: ownCloud for Debian maintainers <pkg-owncloud-maintainers at lists.alio
Uploaders: David Prévot <taffit at debian.org>
Build-Depends: debhelper (>= 9),
php-codesniffer,
- php-symfony-class-loader,
+ php-symfony-class-loader (>= 2.5),
+ phpab,
phpunit,
pkg-php-tools (>= 1.7~)
Standards-Version: 3.9.6
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 e39466a..0000000
--- a/debian/patches/0001-Use-ClassLoader-from-Symfony-instead-of-autoload.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit at debian.org>
-Date: Wed, 19 Mar 2014 11:07:08 -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 | 22 +++++++++-------------
- 1 file changed, 9 insertions(+), 13 deletions(-)
-
-diff --git a/tests/bootstrap.php b/tests/bootstrap.php
-index a01f8f9..46ff855 100644
---- a/tests/bootstrap.php
-+++ b/tests/bootstrap.php
-@@ -2,19 +2,15 @@
-
- date_default_timezone_set('UTC');
-
--$try = array(
-- __DIR__ . '/../vendor/autoload.php',
-- __DIR__ . '/../../../autoload.php',
--);
--
--foreach($try as $path) {
-- if (file_exists($path)) {
-- $autoLoader = include $path;
-- break;
-- }
--}
--
--$autoLoader->addPsr4('Sabre\\VObject\\',__DIR__ . '/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',
-+));
-
- if (!defined('SABRE_TEMPDIR')) {
- define('SABRE_TEMPDIR', __DIR__ . '/temp/');
diff --git a/debian/patches/0001-Use-homemade-autoloader.php.patch b/debian/patches/0001-Use-homemade-autoloader.php.patch
new file mode 100644
index 0000000..36ea97c
--- /dev/null
+++ b/debian/patches/0001-Use-homemade-autoloader.php.patch
@@ -0,0 +1,129 @@
+From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit at debian.org>
+Date: Tue, 24 Feb 2015 15:37:47 -0400
+Subject: Use homemade autoloader.php
+
+Work around the lack of proper autoload.php from Composer.
+
+Forwarded: not-needed
+---
+ bin/bench.php | 4 ++--
+ bin/fetch_windows_zones.php | 2 +-
+ bin/generate_vcards | 6 +++---
+ bin/generateicalendardata.php | 4 ++--
+ bin/rrulebench.php | 2 +-
+ bin/vobject | 6 +++---
+ tests/bootstrap.php | 4 ++--
+ 7 files changed, 14 insertions(+), 14 deletions(-)
+
+diff --git a/bin/bench.php b/bin/bench.php
+index b949c8e..970b7d9 100755
+--- a/bin/bench.php
++++ b/bin/bench.php
+@@ -1,7 +1,7 @@
+-#!/usr/bin/env php
++#!/usr/bin/php
+ <?php
+
+-include __DIR__ . '/../vendor/autoload.php';
++include __DIR__ . '/../lib/autoload.php';
+
+ $data = stream_get_contents(STDIN);
+
+diff --git a/bin/fetch_windows_zones.php b/bin/fetch_windows_zones.php
+index a577c52..f258597 100755
+--- a/bin/fetch_windows_zones.php
++++ b/bin/fetch_windows_zones.php
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env php
++#!/usr/bin/php
+ <?php
+
+ $windowsZonesUrl = 'http://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml';
+diff --git a/bin/generate_vcards b/bin/generate_vcards
+index 638f63b..54dbda0 100755
+--- a/bin/generate_vcards
++++ b/bin/generate_vcards
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env php
++#!/usr/bin/php
+ <?php
+
+ namespace Sabre\VObject;
+@@ -6,8 +6,8 @@ namespace Sabre\VObject;
+ // This sucks.. we have to try to find the composer autoloader. But chances
+ // are, we can't find it this way. So we'll do our bestest
+ $paths = array(
+- __DIR__ . '/../vendor/autoload.php', // In case vobject is cloned directly
+- __DIR__ . '/../../../autoload.php', // In case vobject is a composer dependency.
++ __DIR__ . '/../lib/autoload.php', // In case vobject is used from the package tree
++ __DIR__ . '/../share/php/Sabre/VObject/autoload.php', // In case vobject is used from the system path.
+ );
+
+ foreach($paths as $path) {
+diff --git a/bin/generateicalendardata.php b/bin/generateicalendardata.php
+index 92c8c10..070362e 100755
+--- a/bin/generateicalendardata.php
++++ b/bin/generateicalendardata.php
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env php
++#!/usr/bin/php
+ <?php
+
+ use Sabre\VObject;
+@@ -25,7 +25,7 @@ $events = 100;
+
+ if (isset($argv[1])) $events = (int)$argv[1];
+
+-include __DIR__ . '/../vendor/autoload.php';
++include __DIR__ . '/../lib/autoload.php';
+
+ fwrite(STDERR, "Generating " . $events . " events\n");
+
+diff --git a/bin/rrulebench.php b/bin/rrulebench.php
+index f151819..6f262e7 100644
+--- a/bin/rrulebench.php
++++ b/bin/rrulebench.php
+@@ -1,6 +1,6 @@
+ <?php
+
+-include __DIR__ . '/../vendor/autoload.php';
++include __DIR__ . '/../lib/autoload.php';
+
+ if ($argc < 4) {
+ echo "sabre/vobject ", Sabre\VObject\Version::VERSION, " RRULE benchmark\n";
+diff --git a/bin/vobject b/bin/vobject
+index e52b4fb..23f2f55 100755
+--- a/bin/vobject
++++ b/bin/vobject
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env php
++#!/usr/bin/php
+ <?php
+
+ namespace Sabre\VObject;
+@@ -6,8 +6,8 @@ namespace Sabre\VObject;
+ // This sucks.. we have to try to find the composer autoloader. But chances
+ // are, we can't find it this way. So we'll do our bestest
+ $paths = array(
+- __DIR__ . '/../vendor/autoload.php', // In case vobject is cloned directly
+- __DIR__ . '/../../../autoload.php', // In case vobject is a composer dependency.
++ __DIR__ . '/../lib/autoload.php', // In case vobject is used from the package tree
++ __DIR__ . '/../share/php/Sabre/VObject/autoload.php', // In case vobject is used from the system path.
+ );
+
+ foreach($paths as $path) {
+diff --git a/tests/bootstrap.php b/tests/bootstrap.php
+index a01f8f9..bb0e694 100644
+--- a/tests/bootstrap.php
++++ b/tests/bootstrap.php
+@@ -3,8 +3,8 @@
+ date_default_timezone_set('UTC');
+
+ $try = array(
+- __DIR__ . '/../vendor/autoload.php',
+- __DIR__ . '/../../../autoload.php',
++ __DIR__ . '/../lib/autoload.php',
++ '/usr/share/php/Sabre/VObject/autoload.php',
+ );
+
+ foreach($try as $path) {
diff --git a/debian/patches/0002-Subject-Workaround-the-lack-of-PSR-4-support.patch b/debian/patches/0002-Subject-Workaround-the-lack-of-PSR-4-support.patch
deleted file mode 100644
index efb92ea..0000000
--- a/debian/patches/0002-Subject-Workaround-the-lack-of-PSR-4-support.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit at debian.org>
-Date: Fri, 8 Aug 2014 22:07:08 -0400
-Subject: Subject: Workaround the lack of PSR-4 support
-
----
- Sabre/VObject | 1 +
- tests/Sabre/VObject | 1 +
- 2 files changed, 2 insertions(+)
- create mode 120000 Sabre/VObject
- create mode 120000 tests/Sabre/VObject
-
-diff --git a/Sabre/VObject b/Sabre/VObject
-new file mode 120000
-index 0000000..dc598c5
---- /dev/null
-+++ b/Sabre/VObject
-@@ -0,0 +1 @@
-+../lib
-\ No newline at end of file
-diff --git a/tests/Sabre/VObject b/tests/Sabre/VObject
-new file mode 120000
-index 0000000..8aa194c
---- /dev/null
-+++ b/tests/Sabre/VObject
-@@ -0,0 +1 @@
-+../VObject
-\ No newline at end of file
diff --git a/debian/patches/0002-Use-ClassLoader-from-Symfony-instead-of-autoLoader.patch b/debian/patches/0002-Use-ClassLoader-from-Symfony-instead-of-autoLoader.patch
new file mode 100644
index 0000000..435b556
--- /dev/null
+++ b/debian/patches/0002-Use-ClassLoader-from-Symfony-instead-of-autoLoader.patch
@@ -0,0 +1,31 @@
+From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit at debian.org>
+Date: Tue, 24 Feb 2015 16:16:15 -0400
+Subject: Use ClassLoader from Symfony instead of autoLoader
+
+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/psr4_class_loader.html#usage
+---
+ tests/bootstrap.php | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/tests/bootstrap.php b/tests/bootstrap.php
+index bb0e694..5f35ee0 100644
+--- a/tests/bootstrap.php
++++ b/tests/bootstrap.php
+@@ -14,7 +14,13 @@ foreach($try as $path) {
+ }
+ }
+
+-$autoLoader->addPsr4('Sabre\\VObject\\',__DIR__ . '/VObject');
++use Symfony\Component\ClassLoader\Psr4ClassLoader;
++
++require_once 'Symfony/Component/ClassLoader/Psr4ClassLoader.php';
++
++$loader = new Psr4ClassLoader();
++$loader->addPrefix('Sabre\\VObject\\',__DIR__ . '/VObject');
++$loader->register();
+
+ if (!defined('SABRE_TEMPDIR')) {
+ define('SABRE_TEMPDIR', __DIR__ . '/temp/');
diff --git a/debian/patches/series b/debian/patches/series
index 3358cd9..c8dbad4 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,2 @@
-0001-Use-ClassLoader-from-Symfony-instead-of-autoload.patch
-0002-Subject-Workaround-the-lack-of-PSR-4-support.patch
+0001-Use-homemade-autoloader.php.patch
+0002-Use-ClassLoader-from-Symfony-instead-of-autoLoader.patch
diff --git a/debian/rules b/debian/rules
index 35cc52d..0701379 100755
--- a/debian/rules
+++ b/debian/rules
@@ -2,13 +2,17 @@
%:
dh $@ --with phpcomposer
+override_dh_auto_build:
+ dh_auto_build
+ phpab --output lib/autoload.php 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 --include-path=..
+ cd tests && phpunit
phpcs -v --standard=tests/phpcs/ruleset.xml lib
else
@echo "** tests disabled"
diff --git a/debian/tests/control b/debian/tests/control
index b18ea98..4b901ae 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -3,4 +3,4 @@ Depends: @, php-codesniffer
Test-Command: cd tests && phpunit
Restrictions: rw-build-tree
-Depends: @, php-symfony-class-loader, phpunit
+Depends: @, php-symfony-class-loader (>= 2.5), phpunit
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabre-vobject.git
More information about the Pkg-owncloud-commits
mailing list