diff options
-rw-r--r-- | composer.json | 14 | ||||
-rw-r--r-- | php-bartlett-PHP-Reflect-autoload.php | 6 | ||||
-rw-r--r-- | php-bartlett-PHP-Reflect-rpm.patch | 88 | ||||
-rw-r--r-- | php-bartlett-PHP-Reflect.spec | 78 |
4 files changed, 115 insertions, 71 deletions
diff --git a/composer.json b/composer.json index 9bf7b8f..43bd81e 100644 --- a/composer.json +++ b/composer.json @@ -26,18 +26,20 @@ "symfony/console": "^3.0|^4.0", "symfony/stopwatch": "^3.0|^4.0", "symfony/dependency-injection": "^3.0|^4.0", - "phpdocumentor/reflection-docblock": "^3.0", "justinrainbow/json-schema": "^1.3", "seld/jsonlint": "^1.1", - "psr/log": "^1.0" + "psr/log": "^1.0", + "league/tactician": "^1.0", + "jean85/pretty-package-versions": "^1.2", + "zendframework/zenddiagnostics": "^1.4" }, "require-dev": { - "monolog/monolog": "^1.10" + "monolog/monolog": "^1.10", + "andrewsville/php-token-reflection": "^1.4" }, "suggest": { "doctrine/cache": "Allow caching results", - "bartlett/phpunit-loggertestlistener": "Allow logging unit tests to your favorite PSR-3 logger interface", - "bartlett/umlwriter": "Allow writing UML class diagrams (Graphviz or PlantUML)" + "bartlett/phpunit-loggertestlistener": "Allow logging unit tests to your favorite PSR-3 logger interface" }, "authors": [ { @@ -52,7 +54,7 @@ ], "autoload": { "psr-4": { - "Bartlett\\": "src/Bartlett" + "Bartlett\\": "src/" } }, "autoload-dev": { diff --git a/php-bartlett-PHP-Reflect-autoload.php b/php-bartlett-PHP-Reflect-autoload.php index 4b8bcb5..5e4527c 100644 --- a/php-bartlett-PHP-Reflect-autoload.php +++ b/php-bartlett-PHP-Reflect-autoload.php @@ -14,13 +14,13 @@ require_once '/usr/share/php/Fedora/Autoloader/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', + '/usr/share/php/League/Tactician/autoload.php', + '/usr/share/php/ZendDiagnostics/autoload.php', ]); \Fedora\Autoloader\Dependencies::optional([ '/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', + '/usr/share/php/TokenReflection/autoload.php', ]); -$vendorDir = '/usr/share/php'; diff --git a/php-bartlett-PHP-Reflect-rpm.patch b/php-bartlett-PHP-Reflect-rpm.patch index a219426..fd17d4c 100644 --- a/php-bartlett-PHP-Reflect-rpm.patch +++ b/php-bartlett-PHP-Reflect-rpm.patch @@ -1,6 +1,6 @@ diff -up ./bin/phpreflect.json.dist.rpm ./bin/phpreflect.json.dist ---- ./bin/phpreflect.json.dist.rpm 2018-11-25 10:01:50.000000000 +0100 -+++ ./bin/phpreflect.json.dist 2018-11-26 11:37:03.281529780 +0100 +--- ./bin/phpreflect.json.dist.rpm 2019-04-07 17:37:00.000000000 +0200 ++++ ./bin/phpreflect.json.dist 2019-04-09 14:47:07.638174748 +0200 @@ -6,6 +6,19 @@ } ], @@ -22,50 +22,62 @@ diff -up ./bin/phpreflect.json.dist.rpm ./bin/phpreflect.json.dist "analysers": [ ], diff -up ./bin/phpreflect.rpm ./bin/phpreflect ---- ./bin/phpreflect.rpm 2018-11-25 10:01:50.000000000 +0100 -+++ ./bin/phpreflect 2018-11-26 11:37:12.715581845 +0100 -@@ -2,22 +2,16 @@ - <?php - $appName = 'phpReflect'; +--- ./bin/phpreflect.rpm 2019-04-09 14:47:07.639174753 +0200 ++++ ./bin/phpreflect 2019-04-09 14:53:18.251134771 +0200 +@@ -6,28 +6,12 @@ declare(strict_types=1); --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)); -- } -- -- if (!getenv("BARTLETTRC")) { -- putenv("BARTLETTRC=" . strtolower($appName) . '.json'); -- } + gc_disable(); // performance boost + +-$possibleAutoloadPaths = [ +- // local dev repository +- __DIR__ . '/../vendor/autoload.php', +- // dependency +- __DIR__ . '/../../../../vendor/autoload.php', +-]; +$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'); - } --$loader = require_once $vendorDir . '/autoload.php'; --$loader->setUseIncludePath(true); -+if (!getenv("BARTLETTRC")) { -+ putenv("BARTLETTRC=" . strtolower($appName) . '.json'); -+} -+ ++ } + +-$isAutoloadFound = false; +-foreach ($possibleAutoloadPaths as $possibleAutoloadPath) { +- if (file_exists($possibleAutoloadPath)) { +- require_once $possibleAutoloadPath; +- $isAutoloadFound = true; +- break; +- } +-} +- +-if ($isAutoloadFound === false) { +- throw new RuntimeException(sprintf( +- 'Unable to find "vendor/autoload.php" in "%s" paths.', +- implode('", "', $possibleAutoloadPaths) +- )); +-} +require_once $vendorDir . '/Bartlett/Reflect/autoload.php'; -+ - if (PHP_SAPI !== 'cli') { - return; -@@ -28,5 +22,5 @@ use Bartlett\Reflect\Console\Application + $application = new \Bartlett\Reflect\Presentation\Console\Application('phpReflect'); + $application->run(); +diff -up ./src/Reflect/Presentation/Console/Application.php.rpm ./src/Reflect/Presentation/Console/Application.php +--- ./src/Reflect/Presentation/Console/Application.php.rpm 2019-04-09 14:51:38.632607939 +0200 ++++ ./src/Reflect/Presentation/Console/Application.php 2019-04-09 14:52:25.779857292 +0200 +@@ -82,12 +82,7 @@ class Application extends \Symfony\Compo - Environment::setScanDir(); + public function __construct(string $name = 'UNKNOWN') + { +- try { +- $version = \Jean85\PrettyVersions::getVersion('bartlett/php-reflect')->getPrettyVersion(); +- } catch (\OutOfBoundsException $e) { +- $version = 'UNKNOWN'; +- } +- parent::__construct($name, $version); ++ parent::__construct($name, @VERSION@); --$application = new Application($appName, '5.0-dev'); -+$application = new Application($appName, '@package_version@'); - $application->run(); + $this->baseDir = dirname(dirname(dirname(dirname(__DIR__)))); + } diff -up ./tests/bootstrap.php.rpm ./tests/bootstrap.php ---- ./tests/bootstrap.php.rpm 2018-11-25 10:01:50.000000000 +0100 -+++ ./tests/bootstrap.php 2018-11-26 11:37:03.281529780 +0100 +--- ./tests/bootstrap.php.rpm 2019-04-07 17:37:00.000000000 +0200 ++++ ./tests/bootstrap.php 2019-04-09 14:47:07.639174753 +0200 @@ -1,11 +1,10 @@ <?php @@ -76,7 +88,7 @@ diff -up ./tests/bootstrap.php.rpm ./tests/bootstrap.php -$loader = require_once $vendorDir . '/autoload.php'; -$loader->addClassMap( - array( -+require_once 'Bartlett/Reflect/autoload.php'; ++require_once '@BUILDROOT@/usr/share/php/Bartlett/Reflect/autoload.php'; +$tab = array( 'Bartlett\Tests\Reflect\Analyser\FooAnalyser' => __DIR__ . '/Analyser/FooAnalyser.php', diff --git a/php-bartlett-PHP-Reflect.spec b/php-bartlett-PHP-Reflect.spec index ff20278..b1e4b29 100644 --- a/php-bartlett-PHP-Reflect.spec +++ b/php-bartlett-PHP-Reflect.spec @@ -7,13 +7,13 @@ # Please, preserve the changelog entries # %global bootstrap 0 -%global gh_commit 577395256a2b8fa43f4de747254bd236372de8b8 +%global gh_commit 983763e11d1898965e2b8ccf4b163182a2c713b2 %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) #global gh_date 20150331 %global gh_owner llaville %global gh_project php-reflect %global upstream_version 5.0.0 -%global upstream_prever alpha1 +%global upstream_prever alpha3 %if %{bootstrap} %global with_tests 0%{?_with_tests:1} %else @@ -32,7 +32,8 @@ License: BSD URL: http://php5.laurent-laville.org/reflect/ Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{name}-%{upstream_version}%{?upstream_prever}-%{gh_short}.tar.gz -# Autoloader for RPM - die composer ! +# Fix autoloader path +# Fix version and avoir jean85/pretty-package-versions (relying on composer.lock) Source1: %{name}-autoload.php # Enable cache plugin @@ -48,21 +49,26 @@ BuildRequires: %{phpunit} BuildRequires: (php-composer(sebastian/version) >= 1.0 with php-composer(sebastian/version) < 3) BuildRequires: (php-composer(nikic/php-parser) >= 4.0 with php-composer(nikic/php-parser) < 5) BuildRequires: (php-composer(doctrine/collections) >= 1.4 with php-composer(doctrine/collections) < 2) -BuildRequires: (php-composer(phpdocumentor/reflection-docblock) >= 3.0 with php-composer(phpdocumentor/reflection-docblock) < 4) BuildRequires: (php-composer(seld/jsonlint) >= 1.1 with php-composer(seld/jsonlint) < 2) BuildRequires: (php-composer(justinrainbow/json-schema) >= 1.3 with php-composer(justinrainbow/json-schema) < 2) BuildRequires: (php-composer(monolog/monolog) >= 1.10 with php-composer(monolog/monolog) < 2) BuildRequires: (php-composer(psr/log) >= 1.0 with php-composer(psr/log) < 2) +BuildRequires: (php-composer(league/tactician) >= 1.0 with php-composer(league/tactician) < 2) +BuildRequires: (php-composer(zendframework/zenddiagnostics) >= 1.4 with php-composer(zendframework/zenddiagnostics) < 2) BuildRequires: (php-composer(doctrine/cache) >= 1.3 with php-composer(doctrine/cache) < 2) -# remirepo:19 +# "require-dev": { +# "monolog/monolog": "~1.10", +# "andrewsville/php-token-reflection": "^1.4" +BuildRequires: (php-composer(monolog/monolog) >= 1.10 with php-composer(monolog/monolog) < 2) +BuildRequires: (php-composer(andrewsville/php-token-reflection) >= 1.4 with php-composer(andrewsville/php-token-reflection) < 2) + +# remirepo:25 %else BuildRequires: php-composer(sebastian/version) >= 1.0 BuildRequires: php-composer(sebastian/version) < 3 BuildRequires: php-nikic-php-parser4 BuildRequires: php-composer(doctrine/collections) >= 1.4 BuildRequires: php-composer(doctrine/collections) < 2 -BuildRequires: php-composer(phpdocumentor/reflection-docblock) >= 3.0 -BuildRequires: php-composer(phpdocumentor/reflection-docblock) < 4 BuildRequires: php-composer(seld/jsonlint) >= 1.1 BuildRequires: php-composer(seld/jsonlint) < 2 BuildRequires: php-composer(justinrainbow/json-schema) >= 1.3 @@ -71,8 +77,16 @@ BuildRequires: php-composer(monolog/monolog) >= 1.10 BuildRequires: php-composer(monolog/monolog) < 2 BuildRequires: php-composer(psr/log) >= 1.0 BuildRequires: php-composer(psr/log) < 2 -BuildRequires: php-composer(doctrine/cache) >= 1.3 -BuildRequires: php-composer(doctrine/cache) < 2 +BuildRequires: php-composer(league/tactician) < 2 +BuildRequires: php-composer(league/tactician) >= 1.0 +BuildRequires: php-composer(zendframework/zenddiagnostics) < 2 +BuildRequires: php-composer(zendframework/zenddiagnostics) >= 1.4 +BuildRequires: php-composer(doctrine/cache) < 2 +BuildRequires: php-composer(doctrine/cache) >= 1.3 +BuildRequires: php-composer(monolog/monolog) < 2 +BuildRequires: php-composer(monolog/monolog) >= 1.10 +BuildRequires: php-composer(andrewsville/php-token-reflection) < 2 +BuildRequires: php-composer(andrewsville/php-token-reflection) >= 1.4 %endif BuildRequires: %{sym_prefix}-event-dispatcher BuildRequires: %{sym_prefix}-finder @@ -99,10 +113,12 @@ BuildRequires: php-composer(fedora/autoloader) # "symfony/console": "^3.0|^4.0", # "symfony/stopwatch": "^3.0|^4.0", # "symfony/dependency-injection": "^3.0|^4.0", -# "phpdocumentor/reflection-docblock": "^3.0", # "justinrainbow/json-schema": "^1.3", # "seld/jsonlint": "^1.1" -# "psr/log": "^1.0" +# "psr/log": "^1.0", +# "league/tactician": "^1.0", +# "jean85/pretty-package-versions": "^1.2", +# "zendframework/zenddiagnostics": "^1.4" Requires: php(language) >= 7.1 Requires: php-cli Requires: php-reflection @@ -117,27 +133,30 @@ Requires: php-tokenizer Requires: (php-composer(sebastian/version) >= 1.0 with php-composer(sebastian/version) < 3) Requires: (php-composer(nikic/php-parser) >= 4.0 with php-composer(nikic/php-parser) < 5) Requires: (php-composer(doctrine/collections) >= 1.4 with php-composer(doctrine/collections) < 2) -Requires: (php-composer(phpdocumentor/reflection-docblock) >= 3.0 with php-composer(phpdocumentor/reflection-docblock) < 4) Requires: (php-composer(seld/jsonlint) >= 1.1 with php-composer(seld/jsonlint) < 2) Requires: (php-composer(justinrainbow/json-schema) >= 1.3 with php-composer(justinrainbow/json-schema) < 2) Requires: (php-composer(psr/log) >= 1.0 with php-composer(psr/log) < 2) +Requires: (php-composer(league/tactician) >= 1.0 with php-composer(league/tactician) < 2) +Requires: (php-composer(zendframework/zenddiagnostics) >= 1.4 with php-composer(zendframework/zenddiagnostics) < 2) # Mandatory for our patch Requires: (php-composer(doctrine/cache) >= 1.3 with php-composer(doctrine/cache) < 2) -# remirepo:18 +# remirepo:20 %else Requires: php-composer(sebastian/version) >= 1.0 Requires: php-composer(sebastian/version) < 3 Requires: php-nikic-php-parser4 Requires: php-composer(doctrine/collections) >= 1.4 Requires: php-composer(doctrine/collections) < 2 -Requires: php-composer(phpdocumentor/reflection-docblock) >= 3.0 -Requires: php-composer(phpdocumentor/reflection-docblock) < 4 Requires: php-composer(seld/jsonlint) >= 1.1 Requires: php-composer(seld/jsonlint) < 2 Requires: php-composer(justinrainbow/json-schema) >= 1.3 Requires: php-composer(justinrainbow/json-schema) < 2 Requires: php-composer(psr/log) >= 1.0 Requires: php-composer(psr/log) < 2 +Requires: php-composer(league/tactician) < 2 +Requires: php-composer(league/tactician) >= 1.0 +Requires: php-composer(zendframework/zenddiagnostics) < 2 +Requires: php-composer(zendframework/zenddiagnostics) >= 1.4 # Mandatory for our patch Requires: php-composer(doctrine/cache) >= 1.3 Requires: php-composer(doctrine/cache) < 2 @@ -147,12 +166,9 @@ Requires: %{sym_prefix}-finder Requires: %{sym_prefix}-console Requires: %{sym_prefix}-stopwatch Requires: %{sym_prefix}-dependency-injection -# "require-dev": { -# "monolog/monolog": "~1.10", # "suggest": { # "doctrine/cache": "Allow caching results" -# "bartlett/phpunit-loggertestlistener": "Allow logging unit tests to your favorite PSR-3 logger interface", -# "bartlett/umlwriter": "Allow writing UML class diagrams (Graphviz or PlantUML)" +# "bartlett/phpunit-loggertestlistener": "Allow logging unit tests to your favorite PSR-3 logger interface" %if ! %{bootstrap} %if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 Requires: (php-composer(bartlett/umlwriter) >= 1.0 with php-composer(bartlett/umlwriter) < 2) @@ -183,10 +199,14 @@ Documentation: http://php5.laurent-laville.org/reflect/manual/current/en/ %patch0 -p1 -b .rpm find . -name \*.rpm -delete -print -cp %{SOURCE1} src/Bartlett/Reflect/autoload.php +# Use package version +sed -e 's/@VERSION@/%{upstream_version}%{?upstream_prever}/' \ + -i src/Reflect/Presentation/Console/Application.php + +cp %{SOURCE1} src/Reflect/autoload.php -sed -e 's/@package_version@/%{?upstream_prever:-%{upstream_prever}}/' \ - -i $(find src -name \*.php) bin/phpreflect +mv src/Reflect/Appplication src/Reflect/Application +sed -e 's/Appplication/Application/' -i src/Reflect/Application/Command/Analyser*php %build @@ -194,8 +214,8 @@ sed -e 's/@package_version@/%{?upstream_prever:-%{upstream_prever}}/' \ %install -mkdir -p %{buildroot}%{_datadir}/php -cp -pr src/Bartlett %{buildroot}%{_datadir}/php/Bartlett +mkdir -p %{buildroot}%{_datadir}/php +cp -pr src %{buildroot}%{_datadir}/php/Bartlett install -D -p -m 755 bin/phpreflect %{buildroot}%{_bindir}/phpreflect install -D -p -m 644 bin/phpreflect.json.dist %{buildroot}%{_sysconfdir}/phpreflect.json @@ -204,6 +224,8 @@ install -D -p -m 644 bin/phpreflect.1 %{buildroot}%{_mandir}/man1/phpref %check %if %{with_tests} +sed -e 's:@BUILDROOT@:%{buildroot}:' -i tests/bootstrap.php + ret=0 for cmdarg in "php %{phpunit}" php71 php72 php73; do if which $cmdarg; then @@ -237,6 +259,14 @@ fi %changelog +* Tue Apr 9 2019 Remi Collet <remi@remirepo.net> - 5.0.0~alpha3-1 +- update to 5.0.0-alpha3 +- add dependency on league/tactician +- add dependency on zendframework/zenddiagnostics +- drop dependency on phpdocumentor/reflection-docblock +- open https://github.com/llaville/php-reflect/pull/32 + fix typo in Appplication + * Mon Jan 21 2019 Remi Collet <remi@remirepo.net> - 5.0.0~alpha1-1 - update to 5.0.0-alpha1 - raise dependency on PHP 7.1 |