From 3766f476a7a80dea5d8b414e7a594820cc81fb20 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 3 Jan 2022 08:08:08 +0100 Subject: update to 6.0.2 open https://github.com/llaville/php-compatinfo/issues/316 regression, compatibility with Symfony 4 --- composer.json | 12 ++-- php-bartlett-PHP-CompatInfo-6.0.0-rpm.patch | 86 --------------------------- php-bartlett-PHP-CompatInfo-6.0.2-rpm.patch | 90 +++++++++++++++++++++++++++++ php-bartlett-PHP-CompatInfo-6.0.2-sf4.patch | 36 ++++++++++++ php-bartlett-PHP-CompatInfo.spec | 19 ++++-- 5 files changed, 145 insertions(+), 98 deletions(-) delete mode 100644 php-bartlett-PHP-CompatInfo-6.0.0-rpm.patch create mode 100644 php-bartlett-PHP-CompatInfo-6.0.2-rpm.patch create mode 100644 php-bartlett-PHP-CompatInfo-6.0.2-sf4.patch diff --git a/composer.json b/composer.json index 474d0a3..8ac475c 100644 --- a/composer.json +++ b/composer.json @@ -4,10 +4,10 @@ "keywords": ["compatibility", "version"], "type": "library", "license": "BSD-3-Clause", - "homepage": "https://github.com/llaville/php-compatinfo", + "homepage": "http://php5.laurent-laville.org/compatinfo/", "support": { - "source": "https://github.com/llaville/php-compatinfo", - "issues": "https://github.com/llaville/php-compatinfo/issues" + "source": "https://github.com/llaville/php-compat-info", + "issues": "https://github.com/llaville/php-compat-info/issues" }, "require": { "php": "^7.4|^8.0", @@ -36,6 +36,7 @@ "authors": [ { "name": "Laurent Laville", + "email": "pear@laurent-laville.org", "homepage": "https://github.com/llaville", "role": "Lead" }, @@ -82,9 +83,6 @@ "prefer-stable": true, "config": { "sort-packages": true, - "optimize-autoloader": true, - "allow-plugins": { - "composer/package-versions-deprecated": true - } + "optimize-autoloader": true } } diff --git a/php-bartlett-PHP-CompatInfo-6.0.0-rpm.patch b/php-bartlett-PHP-CompatInfo-6.0.0-rpm.patch deleted file mode 100644 index e511f63..0000000 --- a/php-bartlett-PHP-CompatInfo-6.0.0-rpm.patch +++ /dev/null @@ -1,86 +0,0 @@ -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-6.0.2-rpm.patch b/php-bartlett-PHP-CompatInfo-6.0.2-rpm.patch new file mode 100644 index 0000000..8ef71b1 --- /dev/null +++ b/php-bartlett-PHP-CompatInfo-6.0.2-rpm.patch @@ -0,0 +1,90 @@ +diff -up ./bin/phpcompatinfo.rpm ./bin/phpcompatinfo +--- ./bin/phpcompatinfo.rpm 2021-12-27 16:34:16.000000000 +0100 ++++ ./bin/phpcompatinfo 2022-01-03 07:54:38.530643005 +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-27 16:34:16.000000000 +0100 ++++ ./config/bootstrap.php 2022-01-03 07:54:38.530643005 +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-27 16:34:16.000000000 +0100 ++++ ./config/set/default.php 2022-01-03 07:56:00.619428733 +0100 +@@ -32,11 +32,7 @@ use function Symfony\Component\Dependenc + * @return void + */ + return static function (ContainerConfigurator $containerConfigurator): void { +- if (file_exists(dirname(__DIR__, 2) . '/vendor')) { +- $configSet = dirname(__DIR__, 2) . '/vendor/bartlett/php-compatinfo-db/config/set/default.php'; +- } else { +- $configSet = dirname(__DIR__, 3) . '/php-compatinfo-db/config/set/default.php'; +- } ++ $configSet = '/usr/share/php/Bartlett/CompatInfoDb/config/set/default.php'; + $containerConfigurator->import($configSet); + $containerConfigurator->import(__DIR__ . '/common.php'); + $containerConfigurator->import(__DIR__ . '/../packages/messenger.php'); +@@ -93,7 +89,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/Infrastructure/Framework/Symfony/DependencyInjection/ContainerFactory.php.rpm ./src/Infrastructure/Framework/Symfony/DependencyInjection/ContainerFactory.php +--- ./src/Infrastructure/Framework/Symfony/DependencyInjection/ContainerFactory.php.rpm 2021-12-27 16:34:16.000000000 +0100 ++++ ./src/Infrastructure/Framework/Symfony/DependencyInjection/ContainerFactory.php 2022-01-03 07:54:38.530643005 +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 -up ./src/Presentation/Console/Application.php.rpm ./src/Presentation/Console/Application.php +--- ./src/Presentation/Console/Application.php.rpm 2021-12-27 16:34:16.000000000 +0100 ++++ ./src/Presentation/Console/Application.php 2022-01-03 07:54:38.530643005 +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 --git a/php-bartlett-PHP-CompatInfo-6.0.2-sf4.patch b/php-bartlett-PHP-CompatInfo-6.0.2-sf4.patch new file mode 100644 index 0000000..298dc70 --- /dev/null +++ b/php-bartlett-PHP-CompatInfo-6.0.2-sf4.patch @@ -0,0 +1,36 @@ +From b110f1e6cebf3e9e0a946ecb64ba2eebb085589f Mon Sep 17 00:00:00 2001 +From: Laurent Laville +Date: Mon, 13 Dec 2021 12:25:26 +0100 +Subject: [PATCH] fix Symfony 4 compatibility (see issue #310) (#311) + +--- + src/Application/Event/Dispatcher/EventDispatcher.php | 2 +- + src/Presentation/Console/Style.php | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/Application/Event/Dispatcher/EventDispatcher.php b/src/Application/Event/Dispatcher/EventDispatcher.php +index 2353e2b8..e6558d03 100644 +--- a/src/Application/Event/Dispatcher/EventDispatcher.php ++++ b/src/Application/Event/Dispatcher/EventDispatcher.php +@@ -75,7 +75,7 @@ public function __construct( + /** + * {@inheritDoc} + */ +- public function dispatch(object $event, string $eventName = null): object ++ public function dispatch($event, string $eventName = null): object + { + $triggered = false; + foreach ($this->extensionLoader->getNames() as $extensionName) { +diff --git a/src/Presentation/Console/Style.php b/src/Presentation/Console/Style.php +index 89bafcd2..14e6c427 100644 +--- a/src/Presentation/Console/Style.php ++++ b/src/Presentation/Console/Style.php +@@ -13,7 +13,7 @@ final class Style extends SymfonyStyle implements StyleInterface + /** + * {@inheritDoc} + */ +- public function createProgressBar(int $max = 0) ++ public function createProgressBar($max = 0) + { + $progressBar = parent::createProgressBar($max); + diff --git a/php-bartlett-PHP-CompatInfo.spec b/php-bartlett-PHP-CompatInfo.spec index 42bf8d3..1651c31 100644 --- a/php-bartlett-PHP-CompatInfo.spec +++ b/php-bartlett-PHP-CompatInfo.spec @@ -1,6 +1,6 @@ # remirepo/fedora spec file for php-bartlett-PHP-CompatInfo # -# Copyright (c) 2011-2021 Remi Collet +# Copyright (c) 2011-2022 Remi Collet # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/4.0/ # @@ -11,7 +11,7 @@ %undefine __brp_mangle_shebangs %{!?php_version: %global php_version %(php -r 'echo PHP_VERSION;' 2>/dev/null)} -%global gh_commit 5978aea8eb937157c72b8217dcaac148e6f5ae7d +%global gh_commit 4beab5e0a5c27fb81a3ba0b262b3ed85a19500be %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 6.0.1 +%global upstream_version 6.0.2 #global upstream_prever RC1 Name: php-bartlett-PHP-CompatInfo @@ -36,7 +36,9 @@ Source1: fedora-review-check # Autoload and config path # avoid jean85/pretty-package-versions -Patch0: %{name}-6.0.0-rpm.patch +Patch0: %{name}-6.0.2-rpm.patch +# upstream patch for Symfony 4 +Patch1: %{name}-6.0.2-sf4.patch BuildArch: noarch BuildRequires: php(language) >= 7.4 @@ -154,6 +156,7 @@ Documentation: http://php5.laurent-laville.org/compatinfo/manual/current/en/ %setup -q -n %{gh_project}-%{gh_commit} %patch0 -p1 -b .rpm +%patch1 -p1 -b .sf4 phpab \ --template fedora \ @@ -194,7 +197,8 @@ cat << 'EOF' | tee -a src/autoload.php EOF # Cleanup patched files -find src -name \*rpm -delete -print +find src -name \*.rpm -delete -print +find src -name \*.sf4 -delete -print # fix path in configuration sed -e 's:/src::' -i config/set/*php @@ -263,6 +267,11 @@ fi %changelog +* Mon Jan 3 2022 Remi Collet - 6.0.2-1 +- update to 6.0.2 +- open https://github.com/llaville/php-compatinfo/issues/316 + regression, compatibility with Symfony 4 + * Mon Dec 13 2021 Remi Collet - 6.0.1-1 - update to 6.0.1 - raise dependency on PHP 7.4 -- cgit