summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--php-bartlett-PHP-Reflect-3.1.1-rpm.patch (renamed from php-bartlett-PHP-Reflect-3.0.0-rpm.patch)121
-rw-r--r--php-bartlett-PHP-Reflect-autoload.php46
-rw-r--r--php-bartlett-PHP-Reflect.spec29
3 files changed, 126 insertions, 70 deletions
diff --git a/php-bartlett-PHP-Reflect-3.0.0-rpm.patch b/php-bartlett-PHP-Reflect-3.1.1-rpm.patch
index 80e32f4..c4efe0c 100644
--- a/php-bartlett-PHP-Reflect-3.0.0-rpm.patch
+++ b/php-bartlett-PHP-Reflect-3.1.1-rpm.patch
@@ -1,6 +1,6 @@
diff -up ./bin/phpreflect.json.dist.rpm ./bin/phpreflect.json.dist
---- ./bin/phpreflect.json.dist.rpm 2015-05-11 12:55:49.000000000 +0200
-+++ ./bin/phpreflect.json.dist 2015-05-11 13:22:14.660514268 +0200
+--- ./bin/phpreflect.json.dist.rpm 2015-06-18 13:30:46.000000000 +0200
++++ ./bin/phpreflect.json.dist 2015-06-26 09:18:15.577663962 +0200
@@ -6,6 +6,19 @@
}
],
@@ -23,61 +23,69 @@ diff -up ./bin/phpreflect.json.dist.rpm ./bin/phpreflect.json.dist
],
diff -up ./bin/phpreflect.rpm ./bin/phpreflect
--- ./bin/phpreflect.rpm 2015-06-18 13:30:46.000000000 +0200
-+++ ./bin/phpreflect 2015-06-21 20:10:01.185883366 +0200
-@@ -5,19 +5,35 @@ $appName = 'phpReflect';
- if (\Phar::running()) {
- $vendorDir = 'phar://' . strtolower($appName) . '.phar/vendor';
- } else {
++++ ./bin/phpreflect 2015-06-26 10:06:59.277781055 +0200
+@@ -2,35 +2,16 @@
+ <?php
+ $appName = 'phpReflect';
+
+-if (\Phar::running()) {
+- $vendorDir = 'phar://' . strtolower($appName) . '.phar/vendor';
+-} else {
- $baseDir = dirname(__DIR__);
- $vendorDir = $baseDir . '/vendor';
-
- if (!file_exists($vendorDir . '/autoload.php')) {
- $vendorDir = dirname(dirname($baseDir));
- }
-+ $vendorDir = '/usr/share/php';
+-
+- if (!getenv("BARTLETTRC")) {
+- putenv("BARTLETTRC=" . strtolower($appName) . '.json');
+- }
++$vendorDir = '/usr/share/php';
++if (is_file('/usr/share/php-bartlett-PHP-CompatInfo/compatinfo.sqlite')) {
+ putenv('BARTLETT_COMPATINFO_DB=/usr/share/php-bartlett-PHP-CompatInfo/compatinfo.sqlite');
-
- if (!getenv("BARTLETTRC")) {
- putenv("BARTLETTRC=" . strtolower($appName) . '.json');
- }
}
-$loader = require_once $vendorDir . '/autoload.php';
-$loader->setUseIncludePath(true);
+-
+-if (\Phar::running()) {
+- if ($home) {
+- // when optional resources are not embedded in phar distribution,
+- // avoid PHP Warnings, and lookup first in global vendor dir (COMPOSER_HOME) if exists
+- $classMapfiltered = $fallbackClassMap($loader->getClassMap(), 'Net_Growl');
+- $loader->addClassMap($classMapfiltered);
+-
+- // try to find PEAR Net_Growl classes package in folder $fallbackNetGrowlDir (see phar-stub.php)
+- $loader->add(false, $fallbackNetGrowlDir);
+- }
++if (!getenv("BARTLETTRC")) {
++ putenv("BARTLETTRC=" . strtolower($appName) . '.json');
+ }
+
++require_once $vendorDir . '/Bartlett/Reflect/autoload.php';
+
-+require_once $vendorDir . '/PhpParser/Autoloader.php';
-+PhpParser\Autoloader::register();
-+
-+require_once $vendorDir . '/Symfony/Component/ClassLoader/UniversalClassLoader.php';
-+require_once $vendorDir . '/SebastianBergmann/Version/autoload.php';
-+
-+use Symfony\Component\ClassLoader\UniversalClassLoader;
-+
-+$loader = new UniversalClassLoader();
-+$loader->registerNamespaces(array(
-+ 'Symfony\\Component' => $vendorDir,
-+ 'Doctrine\\Common' => $vendorDir,
-+ 'phpDocumentor\\Reflection' => $vendorDir,
-+ 'Seld\\JsonLint' => $vendorDir,
-+ 'JsonSchema' => $vendorDir,
-+ 'Psr\\Log' => $vendorDir,
-+ 'Monolog' => $vendorDir,
-+ 'Bartlett' => $vendorDir,
-+));
-+$loader->useIncludePath(true);
-+$loader->register();
-
- if (\Phar::running()) {
- if ($home) {
-@@ -40,5 +56,5 @@ use Bartlett\Reflect\Console\Application
-
+ if (PHP_SAPI !== 'cli') {
+ return;
+ }
+@@ -40,5 +21,5 @@ use Bartlett\Reflect\Console\Application
+
Environment::setScanDir();
-
+
-$application = new Application($appName, '3.1');
+$application = new Application($appName, '@package_version@');
$application->run();
diff -up ./src/Bartlett/Reflect/Console/Application.php.rpm ./src/Bartlett/Reflect/Console/Application.php
---- ./src/Bartlett/Reflect/Console/Application.php.rpm 2015-05-11 12:55:49.000000000 +0200
-+++ ./src/Bartlett/Reflect/Console/Application.php 2015-05-11 13:22:14.661514273 +0200
+--- ./src/Bartlett/Reflect/Console/Application.php.rpm 2015-06-18 13:30:46.000000000 +0200
++++ ./src/Bartlett/Reflect/Console/Application.php 2015-06-26 09:18:15.584663991 +0200
+@@ -42,7 +42,7 @@ use Symfony\Component\EventDispatcher\Ev
+ * @package PHP_Reflect
+ * @author Laurent Laville <pear@laurent-laville.org>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+- * @version Release: @package_version@
++ * @version Release: 3.1.1
+ * @link http://php5.laurent-laville.org/reflect/
+ * @since Class available since Release 3.0.0-alpha1
+ */
@@ -82,7 +82,7 @@ class Application extends BaseApplicatio
$jsonFile = './' . getenv("BARTLETTRC");
}
@@ -88,8 +96,8 @@ diff -up ./src/Bartlett/Reflect/Console/Application.php.rpm ./src/Bartlett/Refle
$defaultAnalyser = (strcasecmp($appName, 'phpcompatinfo') === 0)
diff -up ./tests/bootstrap.php.rpm ./tests/bootstrap.php
---- ./tests/bootstrap.php.rpm 2015-05-11 12:55:49.000000000 +0200
-+++ ./tests/bootstrap.php 2015-05-11 13:22:14.661514273 +0200
+--- ./tests/bootstrap.php.rpm 2015-06-18 13:30:46.000000000 +0200
++++ ./tests/bootstrap.php 2015-06-26 10:07:14.589844514 +0200
@@ -1,11 +1,9 @@
<?php
@@ -104,35 +112,28 @@ diff -up ./tests/bootstrap.php.rpm ./tests/bootstrap.php
'Bartlett\Tests\Reflect\Analyser\FooAnalyser'
=> __DIR__ . '/Analyser/FooAnalyser.php',
'Bartlett\Tests\Reflect\Analyser\BarAnalyser'
-@@ -14,5 +12,24 @@ $loader->addClassMap(
+@@ -14,5 +12,17 @@ $loader->addClassMap(
=> __DIR__ . '/Model/GenericModelTest.php',
'Bartlett\Tests\Reflect\Environment\YourLogger'
=> __DIR__ . '/Environment/YourLogger.php',
- )
);
-+require_once $vendorDir . '/PhpParser/Autoloader.php';
-+PhpParser\Autoloader::register();
+
-+require_once $vendorDir . '/Symfony/Component/ClassLoader/UniversalClassLoader.php';
++require_once 'Bartlett/Reflect/autoload.php';
++$fedoraClassLoader->addPrefix('Bartlett\\Tests\\Reflect', $baseDir . '/tests');
+
-+use Symfony\Component\ClassLoader\UniversalClassLoader;
-+
-+$loader = new UniversalClassLoader();
-+$loader->registerNamespaces(array(
-+ 'Bartlett\\Tests\\Reflect' => $baseDir . '/tests',
-+ 'Bartlett\\UmlWriter' => $vendorDir,
-+ 'Bartlett' => $baseDir . '/src',
-+ 'Monolog' => $vendorDir,
-+));
-+$loader->useIncludePath(true);
-+$loader->register();
++// Needed when installed for 'Bartlett\CompatInfo\Analyser\CompatibilityAnalyser'
++if (is_file('/usr/share/php-bartlett-PHP-CompatInfo/compatinfo.sqlite')) {
++ putenv("BARTLETT_COMPATINFO_DB=/usr/share/php-bartlett-PHP-CompatInfo/compatinfo.sqlite");
++}
++//print_r($fedoraClassLoader->getPrefixes());
+
+foreach ($tab as $class => $file) {
+ require_once $file;
+}
diff -up ./tests/Environment/YourLogger.php.rpm ./tests/Environment/YourLogger.php
---- ./tests/Environment/YourLogger.php.rpm 2015-05-11 12:55:49.000000000 +0200
-+++ ./tests/Environment/YourLogger.php 2015-05-11 13:22:14.661514273 +0200
+--- ./tests/Environment/YourLogger.php.rpm 2015-06-18 13:30:46.000000000 +0200
++++ ./tests/Environment/YourLogger.php 2015-06-26 09:18:15.578663966 +0200
@@ -14,6 +14,7 @@ class YourLogger extends Logger
if (!file_exists($tempDir)) {
mkdir($tempDir, 0755, true);
diff --git a/php-bartlett-PHP-Reflect-autoload.php b/php-bartlett-PHP-Reflect-autoload.php
new file mode 100644
index 0000000..9fe6a64
--- /dev/null
+++ b/php-bartlett-PHP-Reflect-autoload.php
@@ -0,0 +1,46 @@
+<?php
+/**
+ * Autoloader for bartlett/php-reflect and its dependencies
+ */
+
+$vendorDir = '/usr/share/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';
+ }
+
+ $fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader();
+ $fedoraClassLoader->register();
+}
+$fedoraClassLoader->addPrefixes(array(
+ 'Symfony\\Component' => $vendorDir,
+ 'JsonSchema' => $vendorDir,
+ 'Seld\\JsonLint' => $vendorDir,
+ 'Bartlett' => dirname(dirname(__DIR__)),
+));
+
+// Mandatory dependencies
+require_once $vendorDir . '/PhpParser/Autoloader.php';
+PhpParser\Autoloader::register();
+require_once $vendorDir . '/SebastianBergmann/Version/autoload.php';
+require_once $vendorDir . '/Doctrine/Common/Collections/autoload.php';
+require_once $vendorDir . '/Doctrine/Common/Cache/autoload.php';
+require_once $vendorDir . '/phpDocumentor/Reflection/DocBlock/autoload.php';
+
+// Needed when installed for 'Bartlett\CompatInfo\Analyser\CompatibilityAnalyser'
+if (is_dir($vendorDir . '/Bartlett/CompatInfo')) {
+ $fedoraClassLoader->addPrefix('Bartlett\\CompatInfo', $vendorDir);
+}
+
+// Optional dependencies
+if (file_exists($vendorDir . '/Bartlett/UmlWriter/autoload.php')) {
+ require_once $vendorDir . '/Bartlett/UmlWriter/autoload.php';
+}
+if (is_dir($vendorDir . '/Psr/Log')) {
+ $fedoraClassLoader->addPrefix('Psr\\Log', $vendorDir);
+}
+if (is_dir($vendorDir . '/Monolog')) {
+ $fedoraClassLoader->addPrefix('Monolog', $vendorDir);
+}
diff --git a/php-bartlett-PHP-Reflect.spec b/php-bartlett-PHP-Reflect.spec
index 34b46ae..8e192c1 100644
--- a/php-bartlett-PHP-Reflect.spec
+++ b/php-bartlett-PHP-Reflect.spec
@@ -21,7 +21,7 @@
Name: php-bartlett-PHP-Reflect
Version: 3.1.1
-%global specrel 2
+%global specrel 3
Release: %{?gh_date:0.%{specrel}.%{?prever}%{!?prever:%{gh_date}git%{gh_short}}}%{!?gh_date:%{specrel}}%{?dist}
Summary: Adds the ability to reverse-engineer PHP
@@ -31,8 +31,10 @@ URL: http://php5.laurent-laville.org/reflect/
Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}%{?prever}-%{gh_short}.tar.gz
# Autoloader for RPM - die composer !
+Source1: %{name}-autoload.php
+
# Enable cache plugin
-Patch0: %{name}-3.0.0-rpm.patch
+Patch0: %{name}-3.1.1-rpm.patch
BuildArch: noarch
BuildRequires: php(language) >= 5.3
@@ -42,7 +44,6 @@ BuildRequires: %{_bindir}/phpunit
BuildRequires: php-composer(sebastian/version) >= 1.0
BuildRequires: php-composer(nikic/php-parser) >= 1.2.2
BuildRequires: php-composer(doctrine/collections) >= 1.2
-BuildRequires: php-composer(symfony/class-loader) >= 2.5
BuildRequires: php-composer(symfony/event-dispatcher) >= 2.5
BuildRequires: php-composer(symfony/finder) >= 2.5
BuildRequires: php-composer(symfony/console) >= 2.5
@@ -52,7 +53,10 @@ BuildRequires: php-composer(phpdocumentor/reflection-docblock) >= 2.0
BuildRequires: php-composer(seld/jsonlint) >= 1.1
BuildRequires: php-composer(justinrainbow/json-schema) >= 1.3
BuildRequires: php-composer(monolog/monolog) >= 1.10
-BuildRequires: php-composer(bartlett/umlwriter) >= 1.0
+# For our patch / autoloader
+BuildRequires: php-doctrine-collections >= 1.3.0-2
+BuildRequires: php-doctrine-cache >= 1.4.1
+BuildRequires: php-composer(symfony/class-loader) >= 2.5
%endif
# From composer.json, "require": {
@@ -122,9 +126,11 @@ Requires: php-composer(psr/log) >= 1.0
Requires: php-composer(bartlett/umlwriter) >= 1.0
Requires: php-composer(bartlett/umlwriter) < 2
%endif
-# For our patch
+# For our patch / autoloader
Requires: php-composer(symfony/class-loader) >= 2.5
Requires: php-composer(symfony/class-loader) < 3
+Requires: php-doctrine-collections >= 1.3.0-2
+Requires: php-doctrine-cache >= 1.4.1
Obsoletes: php-channel-bartlett <= 1.3
@@ -142,6 +148,7 @@ Documentation: http://php5.laurent-laville.org/reflect/manual/current/en/
%setup -q -n %{gh_project}-%{gh_commit}
%patch0 -p1 -b .rpm
+cp %{SOURCE1} src/Bartlett/Reflect/autoload.php
sed -e 's/@package_version@/%{version}%{?prever}/' \
-i $(find src -name \*.php) bin/phpreflect
@@ -162,12 +169,11 @@ install -D -p -m 644 bin/phpreflect.1 %{buildroot}%{_mandir}/man1/phpref
%check
%if %{with_tests}
-# Required when bartlett/php-compatinfo installed (local build)
-export BARTLETT_COMPATINFO_DB=%{_datadir}/php-bartlett-PHP-CompatInfo/compatinfo.sqlite
-
-# Version 3.0.0 : OK, but incomplete, skipped, or risky tests!
+# Version 3.1.1 : OK, but incomplete, skipped, or risky tests!
# Tests: 122, Assertions: 123, Incomplete: 3.
-%{_bindir}/phpunit -v
+%{_bindir}/phpunit \
+ --include-path=%{buildroot}%{_datadir}/php \
+ --verbose
%else
: Test suite disabled
%endif
@@ -191,6 +197,9 @@ fi
%changelog
+* Fri Jun 26 2015 Remi Collet <remi@fedoraproject.org> - 3.1.1-3
+- rewrite autoloader
+
* Sun Jun 21 2015 Remi Collet <remi@fedoraproject.org> - 3.1.1-2
- fix autoloader