diff options
-rw-r--r-- | composer.json | 57 | ||||
-rw-r--r-- | php-bartlett-php-compatinfo-db-2.19-rpm.patch | 95 | ||||
-rw-r--r-- | php-bartlett-php-compatinfo-db-3-rpm.patch | 167 | ||||
-rw-r--r-- | php-bartlett-php-compatinfo-db-curltls.patch | 74 | ||||
-rw-r--r-- | php-bartlett-php-compatinfo-db.spec | 204 |
5 files changed, 349 insertions, 248 deletions
diff --git a/composer.json b/composer.json index 4014013..5171be1 100644 --- a/composer.json +++ b/composer.json @@ -4,29 +4,33 @@ "keywords": ["compatibility", "database", "reference"], "type": "library", "license": "BSD-3-Clause", - "homepage": "http://php5.laurent-laville.org/compatinfo/", + "homepage": "http://bartlett.laurent-laville.org/php-compatinfo/", "support": { "source": "https://github.com/llaville/php-compatinfo-db", "issues": "https://github.com/llaville/php-compatinfo-db/issues" }, "require": { - "php": "^7.1", - "composer/semver": "^1.0|^2.0|^3.0", - "ext-curl": "*", - "ext-intl": "*", - "ext-libxml": "*", - "ext-openssl": "*", + "php": "^7.2|^8.0", + "ext-json": "*", "ext-pcre": "*", + "ext-pdo": "*", + "ext-phar": "*", "ext-spl": "*", - "ext-json": "*", - "ext-pdo_sqlite": "*", - "symfony/console": "^4.4|^5.0", "composer/package-versions-deprecated": "^1.8", - "league/tactician": "^1.0", - "laminas/laminas-diagnostics": "^1.3" + "composer/semver": "^1.0|^2.0|^3.0", + "doctrine/orm": "^2.7", + "symfony/config": "^4.4|^5.0", + "symfony/console": "^4.4|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/event-dispatcher": "^4.4|^5.0", + "symfony/messenger": "^4.4|^5.0", + "symfony/requirements-checker": "^2.0", + "symfony/stopwatch": "^4.4|^5.0" }, "require-dev": { - "phpunit/php-timer": "^2.0" + "composer/composer": "^2.0", + "psr/log": "^1.0", + "symfony/phpunit-bridge": "^5.1" }, "authors": [ { @@ -48,7 +52,32 @@ }, "autoload-dev": { "psr-4": { - "Bartlett\\Tests\\CompatInfoDb\\": "tests/" + "Bartlett\\CompatInfoDb\\Tests\\": "tests/" } + }, + "scripts": { + "setup-database": [ + "mkdir -p ${HOME}/.cache/bartlett/ && touch ${HOME}/.cache/bartlett/compatinfo-db.sqlite", + "export DATABASE_URL=sqlite:///${HOME}/.cache/bartlett/compatinfo-db.sqlite", + "vendor/bin/doctrine orm:schema-tool:create", + "bin/compatinfo-db db:init" + ], + "post-install-cmd": [ + "Bartlett\\CompatInfoDb\\ComposerScripts::preparePharMetadata", + "@setup-database" + ], + "post-update-cmd": [ + "Bartlett\\CompatInfoDb\\ComposerScripts::preparePharMetadata", + "@setup-database" + ] + }, + "scripts-descriptions": { + "setup-database": "Initializes SQLite database from JSON files in data directory." + }, + "minimum-stability": "dev", + "prefer-stable": true, + "config": { + "sort-packages": true, + "optimize-autoloader": true } } diff --git a/php-bartlett-php-compatinfo-db-2.19-rpm.patch b/php-bartlett-php-compatinfo-db-2.19-rpm.patch deleted file mode 100644 index 1d1d2f5..0000000 --- a/php-bartlett-php-compatinfo-db-2.19-rpm.patch +++ /dev/null @@ -1,95 +0,0 @@ -diff -up ./bin/compatinfo-db.rpm ./bin/compatinfo-db ---- ./bin/compatinfo-db.rpm 2020-07-11 10:24:45.000000000 +0200 -+++ ./bin/compatinfo-db 2020-07-13 11:22:01.041329662 +0200 -@@ -7,10 +7,7 @@ declare(strict_types=1); - gc_disable(); // performance boost - - $possibleAutoloadPaths = [ -- // local dev repository -- __DIR__ . '/../vendor/autoload.php', -- // dependency -- __DIR__ . '/../../../../vendor/autoload.php', -+ '/usr/share/php/Bartlett/CompatInfoDb/autoload.php', - ]; - - $isAutoloadFound = false; -diff -up ./src/DatabaseFactory.php.rpm ./src/DatabaseFactory.php ---- ./src/DatabaseFactory.php.rpm 2020-07-11 10:24:45.000000000 +0200 -+++ ./src/DatabaseFactory.php 2020-07-13 11:22:01.041329662 +0200 -@@ -35,14 +35,13 @@ class DatabaseFactory - - private static function getSqliteDsn() : array - { -- if (PATH_SEPARATOR == ';') { -- // windows -- $userHome = getenv('USERPROFILE'); -+ if (($db = getenv('BARTLETT_COMPATINFO_DB')) && file_exists($db)) { -+ static::$tempDir = dirname($db); -+ } else if (file_exists($db = '/usr/share/php-bartlett-php-compatinfo-db/' . static::$database)) { -+ static::$tempDir = dirname($db); - } else { -- // unix -- $userHome = getenv('HOME'); -- } -- static::$tempDir = $userHome . '/.bartlett'; -+ static::$tempDir = dirname(dirname(dirname(__DIR__))) . '/data'; -+ } - - return [ - 'driver' => 'pdo_sqlite', -@@ -58,19 +57,6 @@ class DatabaseFactory - { - $dbParams = self::getSqliteDsn(); - -- if (!file_exists(static::$tempDir)) { -- mkdir(static::$tempDir); -- } -- $source = dirname(__DIR__) . '/data/' . static::$database; -- $dest = static::$tempDir . '/' . static::$database; -- -- if (!file_exists($dest) -- || sha1_file($source) !== sha1_file($dest) -- ) { -- // install DB only if necessary (missing or modified) -- copy($source, $dest); -- } -- - return new PDO($dbParams['url']); - } --} -\ Pas de fin de ligne à la fin du fichier -+} -diff -up ./src/Presentation/Console/Application.php.rpm ./src/Presentation/Console/Application.php ---- ./src/Presentation/Console/Application.php.rpm 2020-07-13 11:22:01.041329662 +0200 -+++ ./src/Presentation/Console/Application.php 2020-07-13 11:32:58.975441852 +0200 -@@ -13,8 +13,6 @@ use Bartlett\CompatInfoDb\Presentation\C - use Bartlett\CompatInfoDb\Presentation\Console\Command\ReleaseCommand; - use Bartlett\CompatInfoDb\Presentation\Console\Command\ShowCommand; - --use PackageVersions\Versions; -- - use Psr\Container\ContainerInterface; - - use Symfony\Component\Console\CommandLoader\CommandLoaderInterface; -@@ -40,20 +38,7 @@ class Application extends \Symfony\Compo - - public function __construct(ContainerInterface $container, string $version = 'UNKNOWN') - { -- if ('UNKNOWN' === $version) { -- // composer or git outside world strategy -- $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-db'); -- list($ver, ) = explode('@', $version); -- -- if (strpos($ver, 'dev') === false) { -- $version = $ver; -- } -- } -+ $version = self::VERSION; - parent::__construct(self::NAME, $version); - - $this->container = $container; diff --git a/php-bartlett-php-compatinfo-db-3-rpm.patch b/php-bartlett-php-compatinfo-db-3-rpm.patch new file mode 100644 index 0000000..f2fdfa5 --- /dev/null +++ b/php-bartlett-php-compatinfo-db-3-rpm.patch @@ -0,0 +1,167 @@ +diff -up ./bin/compatinfo-db.rpm ./bin/compatinfo-db +--- ./bin/compatinfo-db.rpm 2021-01-13 14:27:27.323904725 +0100 ++++ ./bin/compatinfo-db 2021-01-13 14:41:23.249677239 +0100 +@@ -10,10 +10,7 @@ if (\Phar::running()) { + ]; + } else { + $possibleAutoloadPaths = [ +- // local dev repository +- __DIR__ . '/../vendor/autoload.php', +- // dependency +- __DIR__ . '/../../../../vendor/autoload.php', ++ '/usr/share/php/Bartlett/CompatInfoDb/autoload.php', + ]; + } + +@@ -41,7 +38,7 @@ use Symfony\Component\DependencyInjectio + putenv('APP_ENV=' . ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? 'prod')); + + /** @var ContainerBuilder $container */ +-$container = require dirname(__DIR__) . '/config/container.php'; ++$container = require '/usr/share/php/Bartlett/CompatInfoDb/config/container.php'; + + /** @var ApplicationInterface $app */ + $app = $container->get(ApplicationInterface::class); +diff -up ./src/Presentation/Console/Application.php.rpm ./src/Presentation/Console/Application.php +--- ./src/Presentation/Console/Application.php.rpm 2021-01-13 14:46:08.774577841 +0100 ++++ ./src/Presentation/Console/Application.php 2021-01-13 14:47:27.310275447 +0100 +@@ -14,8 +14,6 @@ + + namespace Bartlett\CompatInfoDb\Presentation\Console; + +-use PackageVersions\Versions; +- + use Symfony\Component\Config\Exception\FileLocatorFileNotFoundException; + use Symfony\Component\Config\FileLocator; + use Symfony\Component\Console\Application as SymfonyApplication; +@@ -53,20 +51,7 @@ class Application extends SymfonyApplica + */ + public function __construct(string $version = 'UNKNOWN') + { +- if ('UNKNOWN' === $version) { +- // composer or git outside world strategy +- $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-db'); +- list($ver, ) = explode('@', $version); +- +- if (strpos($ver, 'dev') === false) { +- $version = $ver; +- } +- } ++ $version = self::VERSION; + parent::__construct(self::NAME, $version); + } + +diff -up src/config/container.php.rpm src/config/container.php +--- src/config/container.php.rpm 2021-01-09 09:41:56.000000000 +0100 ++++ src/config/container.php 2021-01-13 15:19:20.040876357 +0100 +@@ -16,7 +16,7 @@ use Symfony\Component\Messenger\Dependen + $containerBuilder = new ContainerBuilder(); + $containerBuilder->addCompilerPass(new MessengerPass()); + +-$loader = new PhpFileLoader($containerBuilder, new FileLocator('config/set')); ++$loader = new PhpFileLoader($containerBuilder, new FileLocator(__DIR__ . '/set')); + $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 + ; + } + +- $services->load('Bartlett\CompatInfoDb\\', __DIR__ . '/../../src'); ++ $services->load('Bartlett\CompatInfoDb\\Application\\', __DIR__ . '/../../Application'); ++ $services->load('Bartlett\CompatInfoDb\\Domain\\', __DIR__ . '/../../Domain'); ++ $services->load('Bartlett\CompatInfoDb\\Infrastructure\\', __DIR__ . '/../../Infrastructure'); ++ $services->load('Bartlett\CompatInfoDb\\Presentation\\', __DIR__ . '/../../Presentation'); + + $services->set(JsonFileHandler::class); + $services->set(VersionParser::class); +@@ -88,13 +91,13 @@ return static function (ContainerConfigu + + $dbUrl = getenv('DATABASE_URL'); + if (false === $dbUrl) { +- $dbUrl = 'sqlite:///${HOME}/.cache/bartlett/compatinfo-db.sqlite'; ++ $dbUrl = 'sqlite:////usr/share/php-bartlett-php-compatinfo-db/compatinfo.sqlite'; + putenv('DATABASE_URL=' . $dbUrl); + } + $connectionParams = ['url' => $dbUrl]; + + $services->set(EntityManagerInterface::class) +- ->factory([service(EntityManagerFactory::class), 'create']) ++ ->factory([ref(EntityManagerFactory::class), 'create']) + ->arg('$connection', $connectionParams) + // for Doctrine Command Line Interface + ->public() +diff -up ./cli-config.php.rpm ./cli-config.php +--- ./cli-config.php.rpm 2021-01-13 15:59:08.127715486 +0100 ++++ ./cli-config.php 2021-01-13 15:59:11.798701727 +0100 +@@ -3,9 +3,9 @@ + use Doctrine\ORM\EntityManagerInterface; + use Doctrine\ORM\Tools\Console\ConsoleRunner; + +-require_once __DIR__ . '/vendor/autoload.php'; ++require_once __DIR__ . '/src/autoload.php'; + +-$container = require __DIR__ . '/config/container.php'; ++$container = require __DIR__ . '/src/config/container.php'; + + $entityManager = $container->get(EntityManagerInterface::class); + +diff -up ./tests/Reference/GenericTest.php.rpm ./tests/Reference/GenericTest.php +--- ./tests/Reference/GenericTest.php.rpm 2021-01-13 16:20:36.560808362 +0100 ++++ ./tests/Reference/GenericTest.php 2021-01-13 16:20:38.878799613 +0100 +@@ -103,7 +103,7 @@ abstract class GenericTest extends TestC + */ + public static function setUpBeforeClass(): void + { +- $container = require implode(DIRECTORY_SEPARATOR, [dirname(__DIR__, 2), 'config', 'container.php']); ++ $container = require implode(DIRECTORY_SEPARATOR, [dirname(__DIR__, 2), 'src', 'config', 'container.php']); + + self::$optionalreleases = []; + diff --git a/php-bartlett-php-compatinfo-db-curltls.patch b/php-bartlett-php-compatinfo-db-curltls.patch index c05ac0f..6a7f7f0 100644 --- a/php-bartlett-php-compatinfo-db-curltls.patch +++ b/php-bartlett-php-compatinfo-db-curltls.patch @@ -1,73 +1,59 @@ -diff -up data/references/Curl.constants.json.old data/references/Curl.constants.json ---- data/references/Curl.constants.json.old 2016-01-09 15:10:57.792505666 +0100 -+++ data/references/Curl.constants.json 2016-01-09 15:12:39.665949126 +0100 -@@ -3874,7 +3874,8 @@ +diff -up data/reference/extension/curl/55/constants.json.rhel data/reference/extension/curl/55/constants.json +--- data/reference/extension/curl/55/constants.json.rhel 2021-01-13 14:52:01.078221323 +0100 ++++ data/reference/extension/curl/55/constants.json 2021-01-13 14:56:11.536253445 +0100 +@@ -1861,6 +1861,7 @@ "ext_max": "", "php_min": "5.5.0", "php_max": "", -- "php_excludes": "" -+ "php_excludes": "", -+ "optional": true ++ "optional": true, + "php_excludes": "" }, { - "ext_name_fk": 9, -@@ -3883,7 +3884,8 @@ +@@ -1869,6 +1870,7 @@ "ext_max": "", "php_min": "5.5.0", "php_max": "", -- "php_excludes": "" -+ "php_excludes": "", -+ "optional": true ++ "optional": true, + "php_excludes": "" }, { - "ext_name_fk": 9, -@@ -3892,7 +3894,8 @@ +@@ -1877,6 +1879,7 @@ "ext_max": "", "php_min": "5.5.0", "php_max": "", -- "php_excludes": "" -+ "php_excludes": "", -+ "optional": true ++ "optional": true, + "php_excludes": "" }, { - "ext_name_fk": 9, -@@ -3901,7 +3904,8 @@ +@@ -1885,6 +1888,7 @@ "ext_max": "", "php_min": "5.5.0", "php_max": "", -- "php_excludes": "" -+ "php_excludes": "", -+ "optional": true ++ "optional": true, + "php_excludes": "" }, { - "ext_name_fk": 9, -@@ -3911,7 +3915,8 @@ +@@ -1893,6 +1897,7 @@ + "ext_max": "", "php_min": "5.5.19RC1", "php_max": "", ++ "optional": true, "php_excludes": "5.6.0, 5.6.0RC1, 5.6.0RC2, 5.6.0RC3, 5.6.0RC4, 5.6.1, 5.6.1RC1, 5.6.2", -- "lib_curl": "~7.34" -+ "lib_curl": "~7.34", -+ "optional": true - }, - { - "ext_name_fk": 9, -@@ -3921,7 +3926,8 @@ + "dependencies": [ + { +@@ -1907,6 +1912,7 @@ + "ext_max": "", "php_min": "5.5.19RC1", "php_max": "", ++ "optional": true, "php_excludes": "5.6.0, 5.6.0RC1, 5.6.0RC2, 5.6.0RC3, 5.6.0RC4, 5.6.1, 5.6.1RC1, 5.6.2", -- "lib_curl": "~7.34" -+ "lib_curl": "~7.34", -+ "optional": true - }, - { - "ext_name_fk": 9, -@@ -3931,7 +3937,8 @@ + "dependencies": [ + { +@@ -1921,6 +1927,7 @@ + "ext_max": "", "php_min": "5.5.19RC1", "php_max": "", ++ "optional": true, "php_excludes": "5.6.0, 5.6.0RC1, 5.6.0RC2, 5.6.0RC3, 5.6.0RC4, 5.6.1, 5.6.1RC1, 5.6.2", -- "lib_curl": "~7.34" -+ "lib_curl": "~7.34", -+ "optional": true - }, - { - "ext_name_fk": 9, + "dependencies": [ + { diff --git a/php-bartlett-php-compatinfo-db.spec b/php-bartlett-php-compatinfo-db.spec index de8629f..b6b2107 100644 --- a/php-bartlett-php-compatinfo-db.spec +++ b/php-bartlett-php-compatinfo-db.spec @@ -7,12 +7,12 @@ # Please, preserve the changelog entries # # See https://github.com/llaville/php-compatinfo-db/releases -%global gh_commit 4bc78f3103014c65f598162055838a1abee939fe +%global gh_commit ad60cc8fad669063527c5754cc535ef509520aeb %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) #global gh_date 20151031 %global gh_owner llaville %global gh_project php-compatinfo-db -%global upstream_version 2.19.0 +%global upstream_version 3.1.0 #global upstream_prever RC1 # Namespace %global ns_vendor Bartlett @@ -41,91 +41,89 @@ Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit # Fix autoloader path # Fix sqlite database path # Fix version and avoir composer/package-versions-deprecated (relying on composer.lock) -Patch0: %{name}-2.19-rpm.patch +Patch0: %{name}-3-rpm.patch # CURL_SSLVERSION constants have been backported Patch1: %{name}-curltls.patch # upstream patches BuildArch: noarch -# Needed to build the database from sources -BuildRequires: php(language) >= 7.1 +BuildRequires: php(language) >= 7.2 +BuildRequires: php-json +BuildRequires: php-pcre +BuildRequires: php-pdo +BuildRequires: php-phar +BuildRequires: php-spl +# From composer.json, "require-dev" +# "composer/composer": "^2.0", +# "psr/log": "^1.0", +# "symfony/phpunit-bridge": "^5.1" # remirepo:1 %if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 BuildRequires: (php-composer(composer/semver) >= 3.0 with php-composer(composer/semver) < 4) -BuildRequires: (php-composer(symfony/console) >= 4.4 with php-composer(symfony/console) < 6) -BuildRequires: (php-composer(league/tactician) >= 1.0 with php-composer(league/tactician) < 2) -BuildRequires: (php-composer(laminas/laminas-diagnostics) >= 1.3 with php-composer(laminas/laminas-diagnostics) < 2) +BuildRequires: (php-composer(doctrine/orm) >= 2.7 with php-composer(doctrine/orm) < 4) +BuildRequires: (php-composer(symfony/requirements-checker) >= 2.0 with php-composer(symfony/requirements-checker) < 3) # remirepo:8 %else BuildRequires: php-composer-semver3 -BuildRequires: php-symfony-console4 >= 4.4 -BuildRequires: php-composer(league/tactician) < 2 -BuildRequires: php-composer(league/tactician) >= 1.0 -BuildRequires: php-composer(laminas/laminas-diagnostics) < 2 -BuildRequires: php-composer(laminas/laminas-diagnostics) >= 1.3 +BuildRequires: php-doctrine-orm >= 2.7 +BuildRequires: php-symfony-requirements-checker >= 2.0 %endif -BuildRequires: php-pdo -BuildRequires: php-reflection -BuildRequires: php-curl -BuildRequires: php-intl -BuildRequires: php-libxml -BuildRequires: php-openssl -BuildRequires: php-pcre -BuildRequires: php-spl -BuildRequires: php-json -BuildRequires: php-pdo_sqlite +BuildRequires: php-symfony4-config >= 4.4 +BuildRequires: php-symfony4-console >= 4.4 +BuildRequires: php-symfony4-dependency-injection >= 4.4 +BuildRequires: php-symfony4-event-dispatcher >= 4.4 +BuildRequires: php-symfony4-messenger >= 4.4 +BuildRequires: php-symfony4-stopwatch >= 4.4 # For our patch / autoloader BuildRequires: php-composer(fedora/autoloader) # From composer.json, "require-dev": { # "phpunit/php-timer": "^2.0" BuildRequires: php-cli %if %{with tests} -BuildRequires: php-composer(phpunit/phpunit) +BuildRequires: phpunit9 %endif # From composer.json, "require" -# "php": "^7.1", -# "composer/semver": "^1.0|^2.0|^3.0", -# "ext-curl": "*", -# "ext-intl": "*", -# "ext-libxml": "*", -# "ext-openssl": "*", +# "php": "^7.2|^8.0", +# "ext-json": "*", # "ext-pcre": "*", +# "ext-pdo": "*", +# "ext-phar": "*", # "ext-spl": "*", -# "ext-json": "*", -# "ext-pdo_sqlite": "*", -# "symfony/console": "^4.4||^5.0", # "composer/package-versions-deprecated": "^1.8", -# "league/tactician": "^1.0", -# "laminas/laminas-diagnostics": "^1.3" -Requires: php(language) >= 7.1 +# "composer/semver": "^1.0|^2.0|^3.0", +# "doctrine/orm": "^2.7", +# "symfony/config": "^4.4|^5.0", +# "symfony/console": "^4.4|^5.0", +# "symfony/dependency-injection": "^4.4|^5.0", +# "symfony/event-dispatcher": "^4.4|^5.0", +# "symfony/messenger": "^4.4|^5.0", +# "symfony/requirements-checker": "^2.0", +# "symfony/stopwatch": "^4.4|^5.0" +Requires: php(language) >= 7.2 +Requires: php-json +Requires: php-pcre +Requires: php-pdo +Requires: php-phar +Requires: php-spl # remirepo:1 %if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 Requires: (php-composer(composer/semver) >= 3.0 with php-composer(composer/semver) < 4) -Requires: (php-composer(symfony/console) >= 4.4 with php-composer(symfony/console) < 6) -Requires: (php-composer(league/tactician) >= 1.0 with php-composer(league/tactician) < 2) -Requires: (php-composer(laminas/laminas-diagnostics) >= 1.3 with php-composer(laminas/laminas-diagnostics) < 2) +Requires: (php-composer(doctrine/orm) >= 2.7 with php-composer(doctrine/orm) < 4) +Requires: (php-composer(symfony/requirements-checker) >= 2.0 with php-composer(symfony/requirements-checker) < 3) # remirepo:8 %else -Requires: php-composer-semver3 -Requires: php-symfony-console4 >= 4.4 -Requires: php-composer(league/tactician) < 2 -Requires: php-composer(league/tactician) >= 1.0 -Requires: php-composer(laminas/laminas-diagnostics) < 2 -Requires: php-composer(laminas/laminas-diagnostics) >= 1.3 +Requires: php-composer-semver3 >= 3.0 +Requires: php-doctrine-orm >= 2.7 +Requires: php-symfony-requirements-checker >= 2.0 %endif -Requires: php-pdo -Requires: php-reflection -Requires: php-curl -Requires: php-date -Requires: php-intl -Requires: php-json -Requires: php-libxml -Requires: php-openssl -Requires: php-pcre -Requires: php-spl -Requires: php-pdo_sqlite +Requires: php-symfony4-config >= 4.4 +Requires: php-symfony4-console >= 4.4 +Requires: php-symfony4-dependency-injection >= 4.4 +Requires: php-symfony4-event-dispatcher >= 4.4 +Requires: php-symfony4-messenger >= 4.4 +Requires: php-symfony4-stopwatch >= 4.4 # Required by autoloader Requires: php-composer(fedora/autoloader) @@ -144,6 +142,11 @@ Conflicts: php-bartlett-PHP-CompatInfo < 5 %patch0 -p1 -b .rpm %patch1 -p0 -b .curltls +sed -e 's/Command::SUCCESS/0/' -i src/Presentation/Console/Command/*.php + +: relocate +mv config src/config + cat << 'EOF' | tee src/autoload.php <?php /** @@ -155,20 +158,22 @@ require_once '%{_datadir}/php/Fedora/Autoloader/autoload.php'; \Fedora\Autoloader\Autoload::addPsr4('Bartlett\\CompatInfoDb\\', __DIR__); \Fedora\Autoloader\Dependencies::required(array( '%{_datadir}/php/Composer/Semver3/autoload.php', - [ - '%{_datadir}/php/Symfony5/Component/Console/autoload.php', - '%{_datadir}/php/Symfony4/Component/Console/autoload.php', - ], - '%{_datadir}/php/League/Tactician/autoload.php', - '%{_datadir}/php/Laminas/Diagnostics/autoload.php', + '%{_datadir}/php/Symfony4/Component/Config/autoload.php', + '%{_datadir}/php/Symfony4/Component/Console/autoload.php', + '%{_datadir}/php/Symfony4/Component/DependencyInjection/autoload.php', + '%{_datadir}/php/Symfony4/Component/EventDispatcher/autoload.php', + '%{_datadir}/php/Symfony4/Component/Messenger/autoload.php', + '%{_datadir}/php/Symfony4/Component/Stopwatch/autoload.php', + '%{_datadir}/php/Symfony/Requirements/autoload.php', + '%{_datadir}/php/Doctrine/ORM/autoload.php', )); EOF # Use package version -grep "%{version}" src/Presentation/Console/Application.php +grep "%{version}" src/Presentation/Console/ApplicationInterface.php # Cleanup patched files -find src -name \*rpm -delete -print +# find src -name \*rpm -delete -print %build @@ -177,29 +182,17 @@ OPT=$(php -r ' require "src/autoload.php"; switch (PHP_MAJOR_VERSION . PHP_MINOR_VERSION) { - case "54": - $max = Bartlett\CompatInfoDb\ExtensionFactory::LATEST_PHP_5_4; - break; - case "55": - $max = Bartlett\CompatInfoDb\ExtensionFactory::LATEST_PHP_5_5; - break; - case "56": - $max = Bartlett\CompatInfoDb\ExtensionFactory::LATEST_PHP_5_6; - break; - case "70": - $max = Bartlett\CompatInfoDb\ExtensionFactory::LATEST_PHP_7_0; - break; - case "71": - $max = Bartlett\CompatInfoDb\ExtensionFactory::LATEST_PHP_7_1; - break; case "72": - $max = Bartlett\CompatInfoDb\ExtensionFactory::LATEST_PHP_7_2; + $max = Bartlett\CompatInfoDb\Domain\Factory\ExtensionVersionProviderInterface::LATEST_PHP_7_2; break; case "73": - $max = Bartlett\CompatInfoDb\ExtensionFactory::LATEST_PHP_7_3; + $max = Bartlett\CompatInfoDb\Domain\Factory\ExtensionVersionProviderInterface::LATEST_PHP_7_3; break; case "74": - $max = Bartlett\CompatInfoDb\ExtensionFactory::LATEST_PHP_7_4; + $max = Bartlett\CompatInfoDb\Domain\Factory\ExtensionVersionProviderInterface::LATEST_PHP_7_4; + break; + case "80": + $max = Bartlett\CompatInfoDb\Domain\Factory\ExtensionVersionProviderInterface::LATEST_PHP_8_0; break; default: exit(0); @@ -213,45 +206,51 @@ OPT=$(php -r ' } ') if [ -n "$OPT" ]; then - sed -e "$OPT" -i src/ExtensionFactory.php + sed -e "$OPT" -i src/Domain/Factory/ExtensionVersionProviderInterface.php fi -grep " LATEST" src/ExtensionFactory.php +grep " LATEST" src/Domain/Factory/ExtensionVersionProviderInterface.php : Create command using local sources sed -e "s:%{_datadir}/php/%{ns_vendor}/%{ns_project}:$PWD/src:" \ -e 's:../data:data:' \ bin/compatinfo-db >compatinfo-db -: Diag -%{_bindir}/php -d date.timezone=Europe/Paris compatinfo-db bartlett:diagnose - -: Fix references database -%{_bindir}/php -d date.timezone=Europe/Paris compatinfo-db bartlett:db:release:php +export DATABASE_URL=sqlite:///${PWD}/compatinfo.sqlite +doctrine orm:schema-tool:create : Generate the references database -%{_bindir}/php -d date.timezone=Europe/Paris compatinfo-db bartlett:db:init +%{_bindir}/php -d memory_limit=1G -d date.timezone=Europe/Paris compatinfo-db db:init + +: Diag +%{_bindir}/php -d date.timezone=Europe/Paris compatinfo-db diagnose + %install mkdir -p %{buildroot}%{_datadir}/php/%{ns_vendor} cp -pr src %{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project} -install -D -p -m 644 data/compatinfo.sqlite %{buildroot}%{_datadir}/%{name}/compatinfo.sqlite -install -D -p -m 755 bin/compatinfo-db %{buildroot}%{_bindir}/%{name} +install -D -p -m 644 compatinfo.sqlite %{buildroot}%{_datadir}/%{name}/compatinfo.sqlite +install -D -p -m 755 bin/compatinfo-db %{buildroot}%{_bindir}/%{name} %if %{with tests} %check -export BARTLETT_COMPATINFO_DB=%{buildroot}%{_datadir}/%{name}/compatinfo.sqlite +export DATABASE_URL=sqlite:///%{buildroot}%{_datadir}/%{name}/compatinfo.sqlite cat << 'EOF' | tee tests/bootstrap.php <?php require_once '%{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}/autoload.php'; -\Fedora\Autoloader\Autoload::addPsr4('Bartlett\\Tests\\CompatInfoDb\\', __DIR__); +\Fedora\Autoloader\Autoload::addPsr4('Bartlett\\CompatInfoDb\\Tests\\', __DIR__); EOF +# https://github.com/llaville/php-compatinfo-db/issues/62 +rm -r tests/Reference/Extension/PhpBundle/Oci8 +# https://github.com/llaville/php-compatinfo-db/issues/63 +rm -r tests/Reference/Extension/PhpPecl/Http + ret=0 -%{_bindir}/phpunit \ +%{_bindir}/phpunit9 \ --include-path %{buildroot}%{_datadir}/php \ -d memory_limit=1G || ret=1 @@ -271,6 +270,21 @@ exit $ret %changelog +* Wed Jan 13 2021 Remi Collet <remi@remirepo.net> - 3.1.0-1 +- update to 3.1.0 +- drop dependency on league/tactician +- drop dependency on laminas/laminas-diagnostics +- add dependency on doctrine/orm +- add dependency on symfony/config +- add dependency on symfony/dependency-injection +- add dependency on symfony/event-dispatcher +- add dependency on symfony/messenger +- add dependency on symfony/requirements-checker +- switch to phpunit9 + +* Thu Jan 7 2021 Remi Collet <remi@remirepo.net> - 3.0.2-1 +- update to 3.0.2 + * Mon Oct 5 2020 Remi Collet <remi@remirepo.net> - 2.19.0-1 - update to 2.19.0 |