summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2016-10-31 18:06:35 +0100
committerRemi Collet <fedora@famillecollet.com>2016-10-31 18:06:35 +0100
commit72014bf649b1e0b99ad92888421eece9602fc6d6 (patch)
tree738179d89cb75ba9d614fe6f8be37b479ecc81d5
parentdfd093d99c6a5817239a45ea6e34bcfcdf398317 (diff)
php-bartlett-PHP-Reflect: fedora autoloader
-rw-r--r--php-bartlett-PHP-Reflect-4.0.0-rpm.patch19
-rw-r--r--php-bartlett-PHP-Reflect-autoload.php53
-rw-r--r--php-bartlett-PHP-Reflect.spec10
3 files changed, 32 insertions, 50 deletions
diff --git a/php-bartlett-PHP-Reflect-4.0.0-rpm.patch b/php-bartlett-PHP-Reflect-4.0.0-rpm.patch
index dac0ea6..4ac7137 100644
--- a/php-bartlett-PHP-Reflect-4.0.0-rpm.patch
+++ b/php-bartlett-PHP-Reflect-4.0.0-rpm.patch
@@ -95,10 +95,10 @@ diff -up ./src/Bartlett/Reflect/Console/Application.php.rpm ./src/Bartlett/Refle
$this->release = $appVersion;
$defaultAnalyser = (strcasecmp($appName, 'phpcompatinfo') === 0)
-diff -up ./tests/bootstrap.php.rpm ./tests/bootstrap.php
---- ./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 @@
+diff -up tests/bootstrap.php.rpm tests/bootstrap.php
+--- ./tests/bootstrap.php.rpm 2016-09-22 20:49:42.000000000 +0200
++++ ./tests/bootstrap.php 2016-10-31 18:03:22.837465194 +0100
+@@ -1,11 +1,10 @@
<?php
$baseDir = dirname(__DIR__);
@@ -108,26 +108,23 @@ diff -up ./tests/bootstrap.php.rpm ./tests/bootstrap.php
-$loader = require_once $vendorDir . '/autoload.php';
-$loader->addClassMap(
- array(
++require_once 'Bartlett/Reflect/autoload.php';
+$tab = array(
'Bartlett\Tests\Reflect\Analyser\FooAnalyser'
=> __DIR__ . '/Analyser/FooAnalyser.php',
'Bartlett\Tests\Reflect\Analyser\BarAnalyser'
-@@ -14,5 +12,17 @@ $loader->addClassMap(
+@@ -14,5 +13,13 @@ $loader->addClassMap(
=> __DIR__ . '/Model/GenericModelTest.php',
'Bartlett\Tests\Reflect\Environment\YourLogger'
=> __DIR__ . '/Environment/YourLogger.php',
- )
);
+
-+require_once 'Bartlett/Reflect/autoload.php';
-+$fedoraClassLoader->addPrefix('Bartlett\\Tests\\Reflect', $baseDir . '/tests');
++\Fedora\Autoloader\Autoload::addClassMap($tab, '/');
++\Fedora\Autoloader\Autoload::addPsr4('Bartlett\\Tests\\Reflect', $baseDir . '/tests');
+
+// 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 --git a/php-bartlett-PHP-Reflect-autoload.php b/php-bartlett-PHP-Reflect-autoload.php
index fc451b5..5f23681 100644
--- a/php-bartlett-PHP-Reflect-autoload.php
+++ b/php-bartlett-PHP-Reflect-autoload.php
@@ -3,42 +3,25 @@
* 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';
- }
+require_once '/usr/share/php/Fedora/Autoloader/autoload.php';
- $fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader();
- $fedoraClassLoader->register();
-}
-$fedoraClassLoader->addPrefixes(array(
- 'Symfony\\Component' => $vendorDir,
- 'Bartlett' => dirname(dirname(__DIR__)),
+\Fedora\Autoloader\Autoload::addPsr4('Bartlett\\', dirname(__DIR__));
+\Fedora\Autoloader\Dependencies::required(array(
+ '/usr/share/php/Symfony/Component/autoload.php',
+ '/usr/share/php/PhpParser/autoload.php',
+ '/usr/share/php/Seld/JsonLint/autoload.php',
+ '/usr/share/php/JsonSchema/autoload.php',
+ '/usr/share/php/SebastianBergmann/Version/autoload.php',
+ '/usr/share/php/Doctrine/Common/Collections/autoload.php',
+ '/usr/share/php/Doctrine/Common/Cache/autoload.php',
+ '/usr/share/php/phpDocumentor/Reflection/DocBlock/autoload.php',
+));
+\Fedora\Autoloader\Dependencies::optional(array(
+ '/usr/share/php/Bartlett/CompatInfo/autoload.php', // Needed when installed for 'Bartlett\CompatInfo\Analyser\CompatibilityAnalyser'
+ '/usr/share/php/Bartlett/UmlWriter/autoload.php',
+ '/usr/share/php/Psr/Log/autoload.php',
+ '/usr/share/php/Monolog/autoload.php',
));
-// Needed when installed for 'Bartlett\CompatInfo\Analyser\CompatibilityAnalyser'
-if (is_dir("$vendorDir/Bartlett/CompatInfo")) {
- $fedoraClassLoader->addPrefix('Bartlett\\CompatInfo', $vendorDir);
-}
-
-// Dependencies (autoloader => required)
-foreach(array(
- "$vendorDir/PhpParser/autoload.php" => true,
- "$vendorDir/Seld/JsonLint/autoload.php" => true,
- "$vendorDir/JsonSchema/autoload.php" => true,
- "$vendorDir/SebastianBergmann/Version/autoload.php" => true,
- "$vendorDir/Doctrine/Common/Collections/autoload.php" => true,
- "$vendorDir/Doctrine/Common/Cache/autoload.php" => true,
- "$vendorDir/phpDocumentor/Reflection/DocBlock/autoload.php" => true,
- "$vendorDir/Bartlett/UmlWriter/autoload.php" => false,
- "$vendorDir/Psr/Log/autoload.php" => false,
- "$vendorDir/Monolog/autoload.php" => false,
-) as $dependencyAutoloader => $required) {
- if ($required || file_exists($dependencyAutoloader)) {
- require_once $dependencyAutoloader;
- }
-}
+$vendorDir = '/usr/share/php';
diff --git a/php-bartlett-PHP-Reflect.spec b/php-bartlett-PHP-Reflect.spec
index 5b96e48..ec3f5aa 100644
--- a/php-bartlett-PHP-Reflect.spec
+++ b/php-bartlett-PHP-Reflect.spec
@@ -21,7 +21,7 @@
Name: php-bartlett-PHP-Reflect
Version: 4.0.2
-%global specrel 1
+%global specrel 2
Release: %{?gh_date:0.%{specrel}.%{?prever}%{!?prever:%{gh_date}git%{gh_short}}}%{!?gh_date:%{specrel}}%{?dist}
Summary: Adds the ability to reverse-engineer PHP
@@ -58,7 +58,7 @@ BuildRequires: php-composer(monolog/monolog) >= 1.10
# 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
+BuildRequires: php-composer(fedora/autoloader)
%endif
# From composer.json, "require": {
@@ -134,8 +134,7 @@ Suggests: php-composer(monolog/monolog)
%endif
%endif
# For our patch / autoloader
-Requires: php-composer(symfony/class-loader) >= 2.5
-Requires: php-composer(symfony/class-loader) < 3
+Requires: php-composer(fedora/autoloader)
Requires: php-doctrine-collections >= 1.3.0-2
Requires: php-doctrine-cache >= 1.4.1
Requires: php-PsrLog >= 1.0.0-8
@@ -220,6 +219,9 @@ fi
%changelog
+* Mon Oct 31 2016 Remi Collet <remi@fedoraproject.org> - 4.0.2-2
+- switch to fedora/autoloader
+
* Fri Sep 23 2016 Remi Collet <remi@fedoraproject.org> - 4.0.2-1
- update to 4.0.2