diff options
author | Remi Collet <remi@remirepo.net> | 2021-01-14 08:46:12 +0100 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2021-01-14 08:46:12 +0100 |
commit | aa459b5c0becf24753c18e3752f5fed9970f18c4 (patch) | |
tree | d6662059386a408247fdf1c44b6859b92e8f6693 | |
parent | 2308b6d7b907cdebbec2e9062de6a8e0ef48129f (diff) |
add upstream patch for Symfony 4
-rw-r--r-- | php-bartlett-php-compatinfo-db-3-rpm.patch | 41 | ||||
-rw-r--r-- | php-bartlett-php-compatinfo-db-upstream.patch | 264 | ||||
-rw-r--r-- | php-bartlett-php-compatinfo-db.spec | 12 |
3 files changed, 273 insertions, 44 deletions
diff --git a/php-bartlett-php-compatinfo-db-3-rpm.patch b/php-bartlett-php-compatinfo-db-3-rpm.patch index f2fdfa5..755d971 100644 --- a/php-bartlett-php-compatinfo-db-3-rpm.patch +++ b/php-bartlett-php-compatinfo-db-3-rpm.patch @@ -68,48 +68,9 @@ diff -up src/config/container.php.rpm src/config/container.php $loader->load('default.php'); $containerBuilder->compile(); -diff -up src/config/set/common.php.rpm src/config/set/common.php ---- src/config/set/common.php.rpm 2021-01-13 15:52:20.781252210 +0100 -+++ src/config/set/common.php 2021-01-13 15:52:24.199239157 +0100 -@@ -15,7 +15,7 @@ use Symfony\Component\DependencyInjectio - use Symfony\Component\EventDispatcher\EventDispatcherInterface; - use Symfony\Component\EventDispatcher\EventSubscriberInterface; - use Symfony\Component\Stopwatch\Stopwatch; --use function Symfony\Component\DependencyInjection\Loader\Configurator\service; -+use function Symfony\Component\DependencyInjection\Loader\Configurator\ref; - use function Symfony\Component\DependencyInjection\Loader\Configurator\tagged_iterator; - - /** -@@ -43,7 +43,7 @@ return static function (ContainerConfigu - ; - - $services->set(ApplicationInterface::class, Application::class) -- ->call('setDispatcher', [service(EventDispatcherInterface::class)]) -+ ->call('setDispatcher', [ref(EventDispatcherInterface::class)]) - // for bin file - ->public() - ; -@@ -58,7 +58,7 @@ return static function (ContainerConfigu - $services->set(Stopwatch::class); - - $services->set(ProfileEventSubscriber::class) -- ->args([service(Stopwatch::class)]) -+ ->args([ref(Stopwatch::class)]) - ; - $services->alias(EventSubscriberInterface::class . ' $profileEventSubscriber', ProfileEventSubscriber::class); - diff -up src/config/set/default.php.rpm src/config/set/default.php --- src/config/set/default.php.rpm 2021-01-09 09:41:56.000000000 +0100 +++ src/config/set/default.php 2021-01-13 15:52:55.350120197 +0100 -@@ -25,7 +25,7 @@ use Doctrine\ORM\EntityManagerInterface; - - use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; - use Symfony\Component\Messenger\Command\DebugCommand; --use function Symfony\Component\DependencyInjection\Loader\Configurator\service; -+use function Symfony\Component\DependencyInjection\Loader\Configurator\ref; - - /** - * Build the Container with default parameters and services @@ -69,7 +69,10 @@ return static function (ContainerConfigu ; } @@ -134,7 +95,7 @@ diff -up src/config/set/default.php.rpm src/config/set/default.php $services->set(EntityManagerInterface::class) - ->factory([service(EntityManagerFactory::class), 'create']) -+ ->factory([ref(EntityManagerFactory::class), 'create']) ++ ->factory([service(EntityManagerFactory::class), 'create']) ->arg('$connection', $connectionParams) // for Doctrine Command Line Interface ->public() diff --git a/php-bartlett-php-compatinfo-db-upstream.patch b/php-bartlett-php-compatinfo-db-upstream.patch new file mode 100644 index 0000000..82345d1 --- /dev/null +++ b/php-bartlett-php-compatinfo-db-upstream.patch @@ -0,0 +1,264 @@ +From d05aaa27ebd0d0d5fe61c34da10d4362c3223ea1 Mon Sep 17 00:00:00 2001 +From: Laurent Laville <laurent.laville@gmail.com> +Date: Thu, 14 Jan 2021 07:22:07 +0000 +Subject: [PATCH] fixes Symfony BC issue (#61) + +--- + CHANGELOG-3.x.md | 4 ++ + composer.json | 3 +- + config/set/common.php | 2 +- + config/set/default.php | 2 +- + .../Framework/Symfony/Polyfill.php | 40 +++++++++++++++++++ + .../Console/Command/AbstractCommand.php | 3 ++ + .../Console/Command/DiagnoseCommand.php | 3 +- + .../Console/Command/InitCommand.php | 3 +- + .../Console/Command/ListCommand.php | 3 +- + .../Console/Command/ReleaseCommand.php | 5 +-- + .../Console/Command/ShowCommand.php | 6 +-- + 11 files changed, 59 insertions(+), 15 deletions(-) + create mode 100644 src/Infrastructure/Framework/Symfony/Polyfill.php + +diff --git a/CHANGELOG-3.x.md b/CHANGELOG-3.x.md +index 2dc124b..0229ff1 100644 +--- a/CHANGELOG-3.x.md ++++ b/CHANGELOG-3.x.md +@@ -6,6 +6,10 @@ using the [Keep a CHANGELOG](http://keepachangelog.com) principles. + + ## [Unreleased] + ++### Fixed ++ ++- [#61](https://github.com/llaville/php-compatinfo-db/issues/61) Keep Symfony 4.4 Backward Compatibility ++ + ## [3.1.0] - 2021-01-09 + + ### Added +diff --git a/composer.json b/composer.json +index 5171be1..3448740 100644 +--- a/composer.json ++++ b/composer.json +@@ -48,7 +48,8 @@ + "autoload": { + "psr-4": { + "Bartlett\\CompatInfoDb\\": "src/" +- } ++ }, ++ "files": ["src/Infrastructure/Framework/Symfony/Polyfill.php"] + }, + "autoload-dev": { + "psr-4": { +diff --git a/config/set/common.php b/config/set/common.php +index ef25457..f480a16 100644 +--- a/config/set/common.php ++++ b/config/set/common.php +@@ -7,6 +7,7 @@ + use Bartlett\CompatInfoDb\Presentation\Console\Command\FactoryCommandLoader; + use Bartlett\CompatInfoDb\Presentation\Console\Input\Input; + use Bartlett\CompatInfoDb\Presentation\Console\Output\Output; ++use function Bartlett\CompatInfoDb\Infrastructure\Framework\Symfony\service; + + use Symfony\Component\Console\CommandLoader\CommandLoaderInterface; + use Symfony\Component\Console\Input\InputInterface; +@@ -15,7 +16,6 @@ + use Symfony\Component\EventDispatcher\EventDispatcherInterface; + use Symfony\Component\EventDispatcher\EventSubscriberInterface; + use Symfony\Component\Stopwatch\Stopwatch; +-use function Symfony\Component\DependencyInjection\Loader\Configurator\service; + use function Symfony\Component\DependencyInjection\Loader\Configurator\tagged_iterator; + + /** +diff --git a/config/set/default.php b/config/set/default.php +index 413eb33..25ff7e8 100644 +--- a/config/set/default.php ++++ b/config/set/default.php +@@ -16,6 +16,7 @@ + use Bartlett\CompatInfoDb\Infrastructure\Persistence\Doctrine\Repository\PlatformRepository as InfrastructurePlatformRepository; + use Bartlett\CompatInfoDb\Application\Service\JsonFileHandler; + use Bartlett\CompatInfoDb\Presentation\Console\Command\CommandInterface; ++use function Bartlett\CompatInfoDb\Infrastructure\Framework\Symfony\service; + + use Composer\Semver\VersionParser; + +@@ -25,7 +26,6 @@ + + use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; + use Symfony\Component\Messenger\Command\DebugCommand; +-use function Symfony\Component\DependencyInjection\Loader\Configurator\service; + + /** + * Build the Container with default parameters and services +diff --git a/src/Infrastructure/Framework/Symfony/Polyfill.php b/src/Infrastructure/Framework/Symfony/Polyfill.php +new file mode 100644 +index 0000000..7aff5e5 +--- /dev/null ++++ b/src/Infrastructure/Framework/Symfony/Polyfill.php +@@ -0,0 +1,40 @@ ++<?php declare(strict_types=1); ++ ++/** ++ * Keep BC between Symfony 4.4 and Symfony 5.x ++ * ++ * PHP version 7 ++ * ++ * @category PHP ++ * @package PHP_CompatInfo_Db ++ * @author Laurent Laville <pear@laurent-laville.org> ++ * @license https://opensource.org/licenses/BSD-3-Clause The 3-Clause BSD License ++ * @link http://bartlett.laurent-laville.org/php-compatinfo/ ++ */ ++ ++namespace Bartlett\CompatInfoDb\Infrastructure\Framework\Symfony; ++ ++use Symfony\Component\DependencyInjection\Loader\Configurator\ReferenceConfigurator; ++ ++/** ++ * @since 3.1.1 ++ * @see https://github.com/llaville/php-compatinfo-db/issues/61 ++ */ ++final class Polyfill ++{ ++ /** ++ * Creates a reference to a service. ++ * ++ * @param string $serviceId ++ * @return ReferenceConfigurator ++ */ ++ public static function service(string $serviceId): ReferenceConfigurator ++ { ++ return new ReferenceConfigurator($serviceId); ++ } ++} ++ ++function service(string $serviceId): ReferenceConfigurator ++{ ++ return Polyfill::service($serviceId); ++} +diff --git a/src/Presentation/Console/Command/AbstractCommand.php b/src/Presentation/Console/Command/AbstractCommand.php +index 998905f..5a9b2a3 100644 +--- a/src/Presentation/Console/Command/AbstractCommand.php ++++ b/src/Presentation/Console/Command/AbstractCommand.php +@@ -24,6 +24,9 @@ + */ + abstract class AbstractCommand extends Command + { ++ public const SUCCESS = 0; ++ public const FAILURE = 1; ++ + /** @var CommandBusInterface */ + protected $commandBus; + +diff --git a/src/Presentation/Console/Command/DiagnoseCommand.php b/src/Presentation/Console/Command/DiagnoseCommand.php +index 01527fd..6f2881c 100644 +--- a/src/Presentation/Console/Command/DiagnoseCommand.php ++++ b/src/Presentation/Console/Command/DiagnoseCommand.php +@@ -22,7 +22,6 @@ + + use Doctrine\ORM\EntityManagerInterface; + +-use Symfony\Component\Console\Command\Command; + use Symfony\Component\Console\Input\InputInterface; + use Symfony\Component\Console\Output\OutputInterface; + +@@ -65,6 +64,6 @@ protected function execute(InputInterface $input, OutputInterface $output) + $checker->setAppName('PHP CompatInfoDB'); + $checker->printDiagnostic($projectRequirements); + +- return Command::SUCCESS; ++ return self::SUCCESS; + } + } +diff --git a/src/Presentation/Console/Command/InitCommand.php b/src/Presentation/Console/Command/InitCommand.php +index b1e5722..80c54fa 100644 +--- a/src/Presentation/Console/Command/InitCommand.php ++++ b/src/Presentation/Console/Command/InitCommand.php +@@ -18,7 +18,6 @@ + use Bartlett\CompatInfoDb\Presentation\Console\ApplicationInterface; + use Bartlett\CompatInfoDb\Presentation\Console\Style; + +-use Symfony\Component\Console\Command\Command; + use Symfony\Component\Console\Input\InputArgument; + use Symfony\Component\Console\Input\InputInterface; + use Symfony\Component\Console\Output\OutputInterface; +@@ -59,7 +58,7 @@ protected function execute(InputInterface $input, OutputInterface $output) + + $exitCode = $this->queryBus->query($initQuery); + +- if (Command::SUCCESS === $exitCode) { ++ if (self::SUCCESS === $exitCode) { + $io->success('Database built successfully!'); + } else { + $io->warning('Database already exists.'); +diff --git a/src/Presentation/Console/Command/ListCommand.php b/src/Presentation/Console/Command/ListCommand.php +index 350ccb8..3f47f6d 100644 +--- a/src/Presentation/Console/Command/ListCommand.php ++++ b/src/Presentation/Console/Command/ListCommand.php +@@ -20,7 +20,6 @@ + use Bartlett\CompatInfoDb\Presentation\Console\ApplicationInterface; + use Bartlett\CompatInfoDb\Presentation\Console\Style; + +-use Symfony\Component\Console\Command\Command; + use Symfony\Component\Console\Input\InputInterface; + use Symfony\Component\Console\Output\OutputInterface; + use Symfony\Component\Console\Helper\TableSeparator; +@@ -105,6 +104,6 @@ protected function execute(InputInterface $input, OutputInterface $output) + ) + ); + +- return Command::SUCCESS; ++ return self::SUCCESS; + } + } +diff --git a/src/Presentation/Console/Command/ReleaseCommand.php b/src/Presentation/Console/Command/ReleaseCommand.php +index 2315f5d..8f2049d 100644 +--- a/src/Presentation/Console/Command/ReleaseCommand.php ++++ b/src/Presentation/Console/Command/ReleaseCommand.php +@@ -15,9 +15,8 @@ + namespace Bartlett\CompatInfoDb\Presentation\Console\Command; + + use Bartlett\CompatInfoDb\Application\Command\Release\ReleaseCommand as AppReleaseCommand; +- + use Bartlett\CompatInfoDb\Presentation\Console\Style; +-use Symfony\Component\Console\Command\Command; ++ + use Symfony\Component\Console\Input\InputArgument; + use Symfony\Component\Console\Input\InputInterface; + use Symfony\Component\Console\Output\OutputInterface; +@@ -69,6 +68,6 @@ protected function execute(InputInterface $input, OutputInterface $output) + $io->success('New release was added in JSON files'); + $io->note('Do not forget to update constants of ExtensionVersionProviderInterface'); + +- return Command::SUCCESS; ++ return self::SUCCESS; + } + } +diff --git a/src/Presentation/Console/Command/ShowCommand.php b/src/Presentation/Console/Command/ShowCommand.php +index 7b3254f..c16bfce 100644 +--- a/src/Presentation/Console/Command/ShowCommand.php ++++ b/src/Presentation/Console/Command/ShowCommand.php +@@ -81,7 +81,7 @@ protected function execute(InputInterface $input, OutputInterface $output) + + if (null === $extension) { + $io->error(sprintf('Extension "%s" is not available', $showQuery->getExtension())); +- return Command::FAILURE; ++ return self::FAILURE; + } + + $summary = true; +@@ -120,7 +120,7 @@ protected function execute(InputInterface $input, OutputInterface $output) + } + + if (!$summary) { +- return Command::SUCCESS; ++ return self::SUCCESS; + } + + $io->title('Reference Summary'); +@@ -157,7 +157,7 @@ protected function execute(InputInterface $input, OutputInterface $output) + ' Methods %10d' + ); + +- return Command::SUCCESS; ++ return self::SUCCESS; + } + + private function formatSection(array $data, string $section, StyleInterface $io): void diff --git a/php-bartlett-php-compatinfo-db.spec b/php-bartlett-php-compatinfo-db.spec index 3ea1bf1..218c963 100644 --- a/php-bartlett-php-compatinfo-db.spec +++ b/php-bartlett-php-compatinfo-db.spec @@ -30,7 +30,7 @@ Name: php-%{c_vendor}-%{c_project} Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}} -%global specrel 1 +%global specrel 2 Release: %{?gh_date:1%{specrel}.%{?prever}%{!?prever:%{gh_date}git%{gh_short}}}%{!?gh_date:%{specrel}}%{?dist} Summary: Reference Database to be used with php-compatinfo library @@ -44,6 +44,8 @@ Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit Patch0: %{name}-3-rpm.patch # CURL_SSLVERSION constants have been backported Patch1: %{name}-curltls.patch +# Upstream +Patch2: %{name}-upstream.patch # upstream patches @@ -141,9 +143,7 @@ Conflicts: php-bartlett-PHP-CompatInfo < 5 %patch0 -p1 -b .rpm %patch1 -p0 -b .curltls - -# https://github.com/llaville/php-compatinfo-db/issues/61 -sed -e 's/Command::SUCCESS/0/' -i src/Presentation/Console/Command/*.php +%patch2 -p1 -b .up : relocate mv config src/config @@ -167,6 +167,7 @@ require_once '%{_datadir}/php/Fedora/Autoloader/autoload.php'; '%{_datadir}/php/Symfony4/Component/Stopwatch/autoload.php', '%{_datadir}/php/Symfony/Requirements/autoload.php', '%{_datadir}/php/Doctrine/ORM/autoload.php', + __DIR__ . '/Infrastructure/Framework/Symfony/Polyfill.php', )); EOF @@ -271,6 +272,9 @@ exit $ret %changelog +* Thu Jan 14 2021 Remi Collet <remi@remirepo.net> - 3.1.0-2 +- add upstream patch for Symfony 4 + * Wed Jan 13 2021 Remi Collet <remi@remirepo.net> - 3.1.0-1 - update to 3.1.0 - drop dependency on league/tactician |