From 479abdf0e6c827180a7c42565c9b58888363d5d5 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 13 Dec 2021 15:01:22 +0100 Subject: update to 6.0.1 raise dependency on PHP 7.4 drop dependency on bartlett/php-reflect add dependency on nikic/php-parser --- composer.json | 36 ++++++----- php-bartlett-PHP-CompatInfo-5.5.4-rpm.patch | 93 ----------------------------- php-bartlett-PHP-CompatInfo-6.0.0-rpm.patch | 86 ++++++++++++++++++++++++++ php-bartlett-PHP-CompatInfo.spec | 52 +++++++++------- 4 files changed, 137 insertions(+), 130 deletions(-) delete mode 100644 php-bartlett-PHP-CompatInfo-5.5.4-rpm.patch create mode 100644 php-bartlett-PHP-CompatInfo-6.0.0-rpm.patch diff --git a/composer.json b/composer.json index 0d87468..474d0a3 100644 --- a/composer.json +++ b/composer.json @@ -4,23 +4,21 @@ "keywords": ["compatibility", "version"], "type": "library", "license": "BSD-3-Clause", - "homepage": "http://php5.laurent-laville.org/compatinfo/", + "homepage": "https://github.com/llaville/php-compatinfo", "support": { - "source": "https://github.com/llaville/php-compat-info", - "issues": "https://github.com/llaville/php-compat-info/issues" + "source": "https://github.com/llaville/php-compatinfo", + "issues": "https://github.com/llaville/php-compatinfo/issues" }, "require": { - "php": "^7.2|^8.0", + "php": "^7.4|^8.0", + "ext-json": "*", "ext-libxml": "*", "ext-pcre": "*", "ext-spl": "*", - "ext-json": "*", - "ext-pdo": "*", - "ext-pdo_sqlite": "*", - "bartlett/php-reflect": "^4.4", "bartlett/php-compatinfo-db": "^3.6", - "doctrine/collections": "^1.4", "composer/package-versions-deprecated": "^1.8", + "doctrine/collections": "^1.4", + "nikic/php-parser": "^4.10", "psr/log": "^1.0", "ramsey/uuid": "^3.9|^4.0", "symfony/config": "^4.4|^5.0", @@ -31,10 +29,13 @@ "symfony/serializer": "^4.4|^5.0", "symfony/stopwatch": "^4.4|^5.0" }, + "require-dev": { + "composer/composer": "^2.0", + "symfony/phpunit-bridge": "^5.1" + }, "authors": [ { "name": "Laurent Laville", - "email": "pear@laurent-laville.org", "homepage": "https://github.com/llaville", "role": "Lead" }, @@ -49,12 +50,13 @@ ], "autoload": { "psr-4": { - "Bartlett\\": "src/Bartlett" - } + "Bartlett\\CompatInfo\\": "src/" + }, + "files": ["src/Infrastructure/Framework/Symfony/Polyfill.php"] }, "autoload-dev": { "psr-4": { - "Bartlett\\Tests\\CompatInfo\\": "tests/" + "Bartlett\\CompatInfo\\Tests\\": "tests/" } }, "scripts": { @@ -63,11 +65,13 @@ "export DATABASE_URL=sqlite:///${HOME}/.cache/bartlett/compatinfo-db.sqlite" ], "post-install-cmd": [ + "Bartlett\\CompatInfo\\ComposerScripts::preparePharMetadata", "@setup-database", "vendor/bin/doctrine orm:schema-tool:create", "vendor/bartlett/php-compatinfo-db/bin/compatinfo-db db:init" ], "post-update-cmd": [ + "Bartlett\\CompatInfo\\ComposerScripts::preparePharMetadata", "@setup-database" ] }, @@ -77,6 +81,10 @@ "minimum-stability": "dev", "prefer-stable": true, "config": { - "optimize-autoloader": true + "sort-packages": true, + "optimize-autoloader": true, + "allow-plugins": { + "composer/package-versions-deprecated": true + } } } diff --git a/php-bartlett-PHP-CompatInfo-5.5.4-rpm.patch b/php-bartlett-PHP-CompatInfo-5.5.4-rpm.patch deleted file mode 100644 index 80e3196..0000000 --- a/php-bartlett-PHP-CompatInfo-5.5.4-rpm.patch +++ /dev/null @@ -1,93 +0,0 @@ -diff -up ./bin/phpcompatinfo.rpm ./bin/phpcompatinfo ---- ./bin/phpcompatinfo.rpm 2021-12-10 15:36:22.000000000 +0100 -+++ ./bin/phpcompatinfo 2021-12-10 16:26:30.756115071 +0100 -@@ -8,12 +8,12 @@ if (PHP_SAPI !== 'cli') { - - gc_disable(); // performance boost - --require_once dirname(__DIR__) . '/config/bootstrap.php'; -+require_once '/usr/share/php/Bartlett/CompatInfo/config/bootstrap.php'; - - use Bartlett\CompatInfo\Console\ApplicationInterface; - - /** @var \Symfony\Component\DependencyInjection\ContainerBuilder $container */ --$container = require dirname(__DIR__) . '/config/container.php'; -+$container = require '/usr/share/php/Bartlett/CompatInfo/config/container.php'; - - $app = $container->get(ApplicationInterface::class); - $app->setContainer($container); -diff -up ./config/bootstrap.php.rpm ./config/bootstrap.php ---- ./config/bootstrap.php.rpm 2021-12-10 15:36:22.000000000 +0100 -+++ ./config/bootstrap.php 2021-12-10 16:26:30.757115067 +0100 -@@ -6,6 +6,8 @@ if (\Phar::running()) { - ]; - } else { - $possibleAutoloadPaths = [ -+ // RPM -+ __DIR__ . '/../autoload.php', - // local dev repository - __DIR__ . '/../vendor/autoload.php', - // dependency -diff -up ./config/set/default.php.rpm ./config/set/default.php ---- ./config/set/default.php.rpm 2021-12-10 16:26:30.757115067 +0100 -+++ ./config/set/default.php 2021-12-10 16:28:22.196710654 +0100 -@@ -32,7 +32,7 @@ use function Symfony\Component\Dependenc - * @return void - */ - return static function (ContainerConfigurator $containerConfigurator): void { -- $containerConfigurator->import(dirname(__DIR__, 2) . '/vendor/bartlett/php-compatinfo-db/config/set/default.php'); -+ $containerConfigurator->import('/usr/share/php/Bartlett/CompatInfoDb/config/set/default.php'); - $containerConfigurator->import(__DIR__ . '/common.php'); - - $parameters = $containerConfigurator->parameters(); -diff -up ./src/Bartlett/CompatInfo/Console/Application.php.rpm ./src/Bartlett/CompatInfo/Console/Application.php ---- ./src/Bartlett/CompatInfo/Console/Application.php.rpm 2021-12-10 15:36:22.000000000 +0100 -+++ ./src/Bartlett/CompatInfo/Console/Application.php 2021-12-10 16:26:30.757115067 +0100 -@@ -30,8 +30,6 @@ use Symfony\Component\DependencyInjectio - use Symfony\Component\EventDispatcher\EventDispatcher; - use Symfony\Component\EventDispatcher\EventDispatcherInterface ; - --use PackageVersions\Versions; -- - use Phar; - use function substr_count; - -@@ -78,14 +76,6 @@ class Application extends BaseApplicatio - $version = self::VERSION; - } elseif (substr_count($version, '.') === 2) { - // release is in X.Y.Z format -- } else { -- // composer or git strategy -- $version = Versions::getVersion('bartlett/php-compatinfo'); -- list($ver, ) = explode('@', $version); -- -- if (strpos($ver, 'dev') === false) { -- $version = $ver; -- } - } - parent::__construct(self::NAME, $version); - -diff -up ./tests/Reference/ParameterTest.php.rpm ./tests/Reference/ParameterTest.php ---- ./tests/Reference/ParameterTest.php.rpm 2021-12-10 15:36:22.000000000 +0100 -+++ ./tests/Reference/ParameterTest.php 2021-12-10 16:26:30.757115067 +0100 -@@ -42,7 +42,7 @@ final class ParameterTest extends SniffT - */ - public function functionProvider() - { -- $container = require __DIR__ . '/../../config/container.php'; -+ $container = require '@BUILDPATH@/config/container.php'; - $repository = $container->get(FunctionRepository::class); - $functions = []; - foreach ($repository->getAll() as $function) { -diff -up ./tests/TestCase.php.rpm ./tests/TestCase.php ---- ./tests/TestCase.php.rpm 2021-12-10 15:36:22.000000000 +0100 -+++ ./tests/TestCase.php 2021-12-10 16:26:30.757115067 +0100 -@@ -46,7 +46,7 @@ abstract class TestCase extends \PHPUnit - */ - protected function executeAnalysis(string $dataSource): array - { -- $container = require __DIR__ . '/../config/container.php'; -+ $container = require '@BUILDPATH@/config/container.php'; - $references = $container->get(ReferenceCollectionInterface::class); - $sniffs = $container->get(SniffCollection::class); - diff --git a/php-bartlett-PHP-CompatInfo-6.0.0-rpm.patch b/php-bartlett-PHP-CompatInfo-6.0.0-rpm.patch new file mode 100644 index 0000000..e511f63 --- /dev/null +++ b/php-bartlett-PHP-CompatInfo-6.0.0-rpm.patch @@ -0,0 +1,86 @@ +diff -up ./bin/phpcompatinfo.rpm ./bin/phpcompatinfo +--- ./bin/phpcompatinfo.rpm 2021-12-13 14:10:12.445234956 +0100 ++++ ./bin/phpcompatinfo 2021-12-13 14:11:01.438091460 +0100 +@@ -8,7 +8,7 @@ if (PHP_SAPI !== 'cli') { + + gc_disable(); // performance boost + +-require_once dirname(__DIR__) . '/config/bootstrap.php'; ++require_once '/usr/share/php/Bartlett/CompatInfo/config/bootstrap.php'; + + use Bartlett\CompatInfo\Infrastructure\Framework\Symfony\DependencyInjection\ContainerFactory; + use Bartlett\CompatInfo\Presentation\Console\ApplicationInterface; +diff -up ./config/bootstrap.php.rpm ./config/bootstrap.php +--- ./config/bootstrap.php.rpm 2021-12-13 13:15:10.000000000 +0100 ++++ ./config/bootstrap.php 2021-12-13 14:10:12.445234956 +0100 +@@ -6,6 +6,8 @@ if (\Phar::running()) { + ]; + } else { + $possibleAutoloadPaths = [ ++ // RPM ++ __DIR__ . '/../autoload.php', + // local dev repository + __DIR__ . '/../vendor/autoload.php', + // dependency +diff -up ./config/set/default.php.rpm ./config/set/default.php +--- ./config/set/default.php.rpm 2021-12-13 14:10:12.445234956 +0100 ++++ ./config/set/default.php 2021-12-13 14:14:41.830445824 +0100 +@@ -32,7 +32,7 @@ use function Symfony\Component\Dependenc + * @return void + */ + return static function (ContainerConfigurator $containerConfigurator): void { +- $containerConfigurator->import(dirname(__DIR__, 2) . '/vendor/bartlett/php-compatinfo-db/config/set/default.php'); ++ $containerConfigurator->import('/usr/share/php/Bartlett/CompatInfoDb/config/set/default.php'); + $containerConfigurator->import(__DIR__ . '/common.php'); + $containerConfigurator->import(__DIR__ . '/../packages/messenger.php'); + +@@ -88,7 +88,9 @@ return static function (ContainerConfigu + ->tag('phpcompatinfo.sniff') + ; + +- $services->load('Bartlett\CompatInfo\\', __DIR__ . '/../../src'); ++ $services->load('Bartlett\CompatInfo\\Application\\', __DIR__ . '/../../Application'); ++ $services->load('Bartlett\CompatInfo\\Infrastructure\\', __DIR__ . '/../../Infrastructure'); ++ $services->load('Bartlett\CompatInfo\\Presentation\\', __DIR__ . '/../../Presentation'); + + // @link https://symfony.com/doc/current/service_container/tags.html#reference-tagged-services + $services->set(SniffCollectionInterface::class, SniffCollection::class) +diff -up ./src/Presentation/Console/Application.php.rpm ./src/Presentation/Console/Application.php +--- ./src/Presentation/Console/Application.php.rpm 2021-12-13 14:16:35.187113793 +0100 ++++ ./src/Presentation/Console/Application.php 2021-12-13 14:16:46.822079705 +0100 +@@ -13,8 +13,6 @@ + + namespace Bartlett\CompatInfo\Presentation\Console; + +-use PackageVersions\Versions; +- + use Symfony\Component\Config\Exception\FileLocatorFileNotFoundException; + use Symfony\Component\Config\FileLocator; + use Symfony\Component\Console\Application as SymfonyApplication; +@@ -71,14 +69,6 @@ class Application extends SymfonyApplica + $version = self::VERSION; + } elseif (substr_count($version, '.') === 2) { + // release is in X.Y.Z format +- } else { +- // composer or git strategy +- $version = Versions::getVersion('bartlett/php-compatinfo'); +- list($ver, ) = explode('@', $version); +- +- if (strpos($ver, 'dev') === false) { +- $version = $ver; +- } + } + parent::__construct(self::NAME, $version); + } +diff -up ./src/Infrastructure/Framework/Symfony/DependencyInjection/ContainerFactory.php.rpm ./src/Infrastructure/Framework/Symfony/DependencyInjection/ContainerFactory.php +--- ./src/Infrastructure/Framework/Symfony/DependencyInjection/ContainerFactory.php.rpm 2021-12-13 14:26:26.391380450 +0100 ++++ ./src/Infrastructure/Framework/Symfony/DependencyInjection/ContainerFactory.php 2021-12-13 14:26:32.148363508 +0100 +@@ -23,7 +23,7 @@ class ContainerFactory + $containerBuilder = new ContainerBuilder(); + $containerBuilder->addCompilerPass(new MessengerPass()); + +- $loader = new PhpFileLoader($containerBuilder, new FileLocator(dirname(__DIR__, 5) . '/config/set')); ++ $loader = new PhpFileLoader($containerBuilder, new FileLocator(dirname(__DIR__, 4) . '/config/set')); + $loader->load($set . '.php'); + $containerBuilder->compile(); // mandatory or the sniffCollection won't be populated + return $containerBuilder; diff --git a/php-bartlett-PHP-CompatInfo.spec b/php-bartlett-PHP-CompatInfo.spec index 362aa93..2dbe617 100644 --- a/php-bartlett-PHP-CompatInfo.spec +++ b/php-bartlett-PHP-CompatInfo.spec @@ -11,7 +11,7 @@ %undefine __brp_mangle_shebangs %{!?php_version: %global php_version %(php -r 'echo PHP_VERSION;' 2>/dev/null)} -%global gh_commit e3b01295c0c46c3b751ef4a01dc41ad696815bc6 +%global gh_commit 5978aea8eb937157c72b8217dcaac148e6f5ae7d %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) #global gh_date 20151005 %global gh_owner llaville @@ -19,7 +19,7 @@ #global prever RC2 %bcond_without tests -%global upstream_version 5.5.4 +%global upstream_version 6.0.1 #global upstream_prever RC1 Name: php-bartlett-PHP-CompatInfo @@ -36,16 +36,15 @@ Source1: fedora-review-check # Autoload and config path # avoid jean85/pretty-package-versions -Patch0: %{name}-5.5.4-rpm.patch +Patch0: %{name}-6.0.0-rpm.patch BuildArch: noarch -BuildRequires: php(language) >= 7.2 +BuildRequires: php(language) >= 7.4 %if %{with tests} # to run test suite BuildRequires: php-pdo_sqlite # remirepo:1 %if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 -BuildRequires: (php-composer(bartlett/php-reflect) >= 4.4 with php-composer(bartlett/php-reflect) < 5) BuildRequires: (php-composer(bartlett/php-compatinfo-db) >= 3.6 with php-composer(bartlett/php-compatinfo-db) < 4) BuildRequires: (php-composer(psr/log) >= 1.0 with php-composer(psr/log) < 2) BuildRequires: (php-composer(ramsey/uuid) >= 4.0 with php-composer(ramsey/uuid) < 5) @@ -57,9 +56,9 @@ BuildRequires: (php-composer(symfony/finder) >= 4.4 with php-comp BuildRequires: (php-composer(symfony/serializer) >= 4.4 with php-composer(symfony/serializer) < 6) BuildRequires: (php-composer(symfony/stopwatch) >= 4.4 with php-composer(symfony/stopwatch) < 6) BuildRequires: (php-composer(doctrine/collections) >= 1.4 with php-composer(doctrine/collections) < 2) +BuildRequires: (php-composer(nikic/php-parser) >= 4.10 with php-composer(nikic/php-parser) < 5) # remirepo:14 %else -BuildRequires: php-bartlett-PHP-Reflect >= 4.4 BuildRequires: php-bartlett-php-compatinfo-db >= 3.6 BuildRequires: php-PsrLog >= 1.0 BuildRequires: php-ramsey-uuid >= 4.0 @@ -71,6 +70,7 @@ BuildRequires: php-symfony4-finder >= 4.4 BuildRequires: php-symfony4-serializer >= 4.4 BuildRequires: php-symfony4-stopwatch >= 4.4 BuildRequires: php-doctrine-collections >= 1.4 +BuildRequires: php-nikic-php-parser4 >= 4.10 %endif %global phpunit %{_bindir}/phpunit9 BuildRequires: %{phpunit} @@ -79,16 +79,15 @@ BuildRequires: php-fedora-autoloader-devel %endif # From composer.json, "require" -# "php": "^7.2|^8.0", +# "php": "^7.4|^8.0", +# "ext-json": "*", # "ext-libxml": "*", # "ext-pcre": "*", # "ext-spl": "*", -# "ext-json": "*", -# "ext-pdo": "*", -# "ext-pdo_sqlite": "*", # "bartlett/php-reflect": "^4.4", # "bartlett/php-compatinfo-db": "^3.6", # "doctrine/collections": "^1.4", +# "nikic/php-parser": "^4.10", # "composer/package-versions-deprecated": "^1.8", # "psr/log": "^1.0", # "ramsey/uuid": "^3.9|^4.0", @@ -99,17 +98,15 @@ BuildRequires: php-fedora-autoloader-devel # "symfony/dependency-injection": "^4.4|^5.0", # "symfony/serializer": "^4.4|^5.0", # "symfony/stopwatch": "^4.4|^5.0" -Requires: php(language) >= 7.2 +Requires: php(language) >= 7.4 Requires: php-cli Requires: php-json Requires: php-libxml Requires: php-pcre -Requires: php-pdo Requires: php-pdo_sqlite Requires: php-spl # remirepo:1 %if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 -Requires: (php-composer(bartlett/php-reflect) >= 4.4 with php-composer(bartlett/php-reflect) < 5) Requires: (php-composer(bartlett/php-compatinfo-db) >= 3.6 with php-composer(bartlett/php-compatinfo-db) < 4) Requires: (php-composer(psr/log) >= 1.0 with php-composer(psr/log) < 2) Requires: (php-composer(ramsey/uuid) >= 4.0 with php-composer(ramsey/uuid) < 5) @@ -121,6 +118,7 @@ Requires: (php-composer(symfony/finder) >= 4.4 with php-comp Requires: (php-composer(symfony/serializer) >= 4.4 with php-composer(symfony/serializer) < 6) Requires: (php-composer(symfony/stopwatch) >= 4.4 with php-composer(symfony/stopwatch) < 6) Requires: (php-composer(doctrine/collections) >= 1.4 with php-composer(doctrine/collections) < 2) +Requires: (php-composer(nikic/php-parser) >= 4.10 with php-composer(nikic/php-parser) < 5) # remirepo:14 %else Requires: php-bartlett-PHP-Reflect >= 4.4 @@ -135,6 +133,7 @@ Requires: php-symfony4-finder >= 4.4 Requires: php-symfony4-serializer >= 4.4 Requires: php-symfony4-stopwatch >= 4.4 Requires: php-doctrine-collections >= 1.4 +Requires: php-nikic-php-parser4 >= 4.10 %endif # Required by autoloader Requires: php-composer(fedora/autoloader) @@ -159,12 +158,12 @@ Documentation: http://php5.laurent-laville.org/compatinfo/manual/current/en/ phpab \ --template fedora \ - --output src/Bartlett/CompatInfo/autoload.php \ - src/Bartlett/CompatInfo -cat << 'EOF' | tee -a src/Bartlett/CompatInfo/autoload.php + --output src/autoload.php \ + src +cat << 'EOF' | tee -a src/autoload.php \Fedora\Autoloader\Dependencies::required([ - '%{_datadir}/php/Bartlett/Reflect/autoload.php', + '%{_datadir}/php/PhpParser4/autoload.php', '%{_datadir}/php/Bartlett/CompatInfoDb/autoload.php', '%{_datadir}/php/Psr/Log/autoload.php', '%{_datadir}/php/Ramsey/Uuid/autoload.php', @@ -191,6 +190,7 @@ cat << 'EOF' | tee -a src/Bartlett/CompatInfo/autoload.php '%{_datadir}/php/Symfony4/Component/Stopwatch/autoload.php', ], '%{_datadir}/php/Doctrine/Common/Collections/autoload.php', + __DIR__ . '/Infrastructure/Framework/Symfony/Polyfill.php', ]); EOF @@ -198,11 +198,11 @@ EOF find src -name \*rpm -delete -print # fix path in configuration -sed -e 's:src/Bartlett/CompatInfo/::' -i config/set/*php -mv config src/Bartlett/CompatInfo/config +sed -e 's:/src::' -i config/set/*php +mv config src/config # Check package version -FILE=src/Bartlett/CompatInfo/Console/Application.php +FILE=src/Presentation/Console/ApplicationInterface.php #sed -e 's/5.5.1/#{version}/' -i $FILE grep " VERSION" $FILE grep %{version} $FILE @@ -213,8 +213,8 @@ grep %{version} $FILE %install -mkdir -p %{buildroot}%{_datadir}/php -cp -pr src/Bartlett %{buildroot}%{_datadir}/php/Bartlett +mkdir -p %{buildroot}%{_datadir}/php/Bartlett +cp -pr src %{buildroot}%{_datadir}/php/Bartlett/CompatInfo install -D -p -m 755 bin/phpcompatinfo %{buildroot}%{_bindir}/phpcompatinfo install -D -p -m 644 bin/phpcompatinfo.1 %{buildroot}%{_mandir}/man1/phpcompatinfo.1 @@ -228,7 +228,7 @@ mkdir config cat << 'EOF' | tee config/bootstrap.php - 6.0.1-1 +- update to 6.0.1 +- raise dependency on PHP 7.4 +- drop dependency on bartlett/php-reflect +- add dependency on nikic/php-parser + * Fri Dec 10 2021 Remi Collet - 5.5.4-1 - update to 5.5.4 - raise dependency on bartlett/php-compatinfo-db 3.6 -- cgit