From 20ac7954c7d9f1e069be5a391dac6359d64f5404 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 7 Dec 2015 10:10:02 +0100 Subject: php-bartlett-PHP-CompatInfo: 5.0.0 (wip) --- php-bartlett-PHP-CompatInfo-4.5.0-rpm.patch | 120 ------------------------- php-bartlett-PHP-CompatInfo-5.0.0-autoload.php | 23 +++++ php-bartlett-PHP-CompatInfo-5.0.0-rpm.patch | 85 ++++++++++++++++++ php-bartlett-PHP-CompatInfo-autoload.php | 22 ----- php-bartlett-PHP-CompatInfo.spec | 45 +++++----- 5 files changed, 129 insertions(+), 166 deletions(-) delete mode 100644 php-bartlett-PHP-CompatInfo-4.5.0-rpm.patch create mode 100644 php-bartlett-PHP-CompatInfo-5.0.0-autoload.php create mode 100644 php-bartlett-PHP-CompatInfo-5.0.0-rpm.patch delete mode 100644 php-bartlett-PHP-CompatInfo-autoload.php diff --git a/php-bartlett-PHP-CompatInfo-4.5.0-rpm.patch b/php-bartlett-PHP-CompatInfo-4.5.0-rpm.patch deleted file mode 100644 index 60280df..0000000 --- a/php-bartlett-PHP-CompatInfo-4.5.0-rpm.patch +++ /dev/null @@ -1,120 +0,0 @@ -diff -up ./bin/phpcompatinfo.json.dist.rpm ./bin/phpcompatinfo.json.dist ---- ./bin/phpcompatinfo.json.dist.rpm 2015-07-11 10:04:30.000000000 +0200 -+++ ./bin/phpcompatinfo.json.dist 2015-07-13 09:06:15.108698079 +0200 -@@ -6,6 +6,19 @@ - } - ], - "plugins": [ -+ { -+ "name": "Cache", -+ "class": "Bartlett\\Reflect\\Plugin\\CachePlugin", -+ "options": { -+ "adapter": "DoctrineCacheAdapter", -+ "backend": { -+ "class": "Doctrine\\Common\\Cache\\FilesystemCache", -+ "args": [ -+ "%{HOME}/.cache/php-reflect" -+ ] -+ } -+ } -+ } - ], - "analysers" : [ - ], -diff -up ./bin/phpcompatinfo.rpm ./bin/phpcompatinfo ---- ./bin/phpcompatinfo.rpm 2015-07-11 10:04:30.000000000 +0200 -+++ ./bin/phpcompatinfo 2015-07-13 09:06:15.114698099 +0200 -@@ -1,23 +1,12 @@ - #!/usr/bin/env php - setUseIncludePath(true); - - if (\Phar::running()) { - if ($home) { -@@ -35,18 +24,10 @@ if (PHP_SAPI !== 'cli') { - return; - } - --if (\Phar::running()) { -- try { -- Bartlett\CompatInfo\Environment::checkRequirements(); -- } catch (\RuntimeException $e) { -- die ($e->getMessage()); -- } --} -- - use Bartlett\Reflect\Environment; - use Bartlett\CompatInfo\Console\Application; - - Environment::setScanDir(); - --$application = new Application($appName, '4.5'); -+$application = new Application($appName, '@package_version@'); - $application->run(); -diff -up ./data/handleDB.php.rpm ./data/handleDB.php ---- ./data/handleDB.php.rpm 2015-07-11 10:04:30.000000000 +0200 -+++ ./data/handleDB.php 2015-07-13 09:06:15.108698079 +0200 -@@ -11,7 +11,8 @@ - * @since Release 4.0.0alpha3 - */ - --require_once dirname(__DIR__) . '/vendor/autoload.php'; -+require_once __DIR__ . '/../src/Bartlett/CompatInfo/autoload.php'; -+ - require_once __DIR__ . '/ReferenceCollection.php'; - - use Bartlett\CompatInfo\Reference\ExtensionFactory; -diff -up ./src/Bartlett/CompatInfo/Environment.php.rpm ./src/Bartlett/CompatInfo/Environment.php ---- ./src/Bartlett/CompatInfo/Environment.php.rpm 2015-07-13 09:10:10.271476463 +0200 -+++ ./src/Bartlett/CompatInfo/Environment.php 2015-07-13 09:10:52.422615982 +0200 -@@ -36,6 +36,12 @@ class Environment - */ - public static function initRefDb() - { -+ if (($database = getenv('BARTLETT_COMPATINFO_DB')) && file_exists($database)) { -+ return new \PDO('sqlite:' . $database); -+ } else if (file_exists($database = '/usr/share/php-bartlett-PHP-CompatInfo/compatinfo.sqlite')) { -+ return new \PDO('sqlite:' . $database); -+ } -+ - $database = 'compatinfo.sqlite'; - $tempDir = sys_get_temp_dir() . '/bartlett'; - -diff -up ./tests/bootstrap.php.rpm ./tests/bootstrap.php ---- ./tests/bootstrap.php.rpm 2015-07-11 10:04:30.000000000 +0200 -+++ ./tests/bootstrap.php 2015-07-13 09:06:15.108698079 +0200 -@@ -1,8 +1,11 @@ - addPrefix('Bartlett\\Tests\\CompatInfo', $baseDir . '/tests'); - -+putenv('BARTLETT_COMPATINFO_DB='.dirname(__DIR__).'/data/compatinfo.sqlite'); -+# Class not catched by autoloader - require __DIR__ . '/Reference/GenericTest.php'; diff --git a/php-bartlett-PHP-CompatInfo-5.0.0-autoload.php b/php-bartlett-PHP-CompatInfo-5.0.0-autoload.php new file mode 100644 index 0000000..cf3b6a5 --- /dev/null +++ b/php-bartlett-PHP-CompatInfo-5.0.0-autoload.php @@ -0,0 +1,23 @@ +register(); +} +$fedoraClassLoader->addPrefixes(array( + 'Bartlett\\CompatInfo' => dirname(dirname(__DIR__)), +)); + +// Dependencies +require_once $vendorDir . '/Bartlett/Reflect/autoload.php'; +require_once $vendorDir . '/Bartlett/CompatInfoDb/autoload.php'; diff --git a/php-bartlett-PHP-CompatInfo-5.0.0-rpm.patch b/php-bartlett-PHP-CompatInfo-5.0.0-rpm.patch new file mode 100644 index 0000000..5a4a301 --- /dev/null +++ b/php-bartlett-PHP-CompatInfo-5.0.0-rpm.patch @@ -0,0 +1,85 @@ +diff -up ./bin/phpcompatinfo.json.dist.rpm ./bin/phpcompatinfo.json.dist +--- ./bin/phpcompatinfo.json.dist.rpm 2015-12-05 10:11:45.000000000 +0100 ++++ ./bin/phpcompatinfo.json.dist 2015-12-07 09:08:39.785273332 +0100 +@@ -6,6 +6,19 @@ + } + ], + "plugins": [ ++ { ++ "name": "Cache", ++ "class": "Bartlett\\Reflect\\Plugin\\CachePlugin", ++ "options": { ++ "adapter": "DoctrineCacheAdapter", ++ "backend": { ++ "class": "Doctrine\\Common\\Cache\\FilesystemCache", ++ "args": [ ++ "%{HOME}/.cache/php-reflect" ++ ] ++ } ++ } ++ } + ], + "analysers" : [ + ], +diff -up ./bin/phpcompatinfo.rpm ./bin/phpcompatinfo +--- ./bin/phpcompatinfo.rpm 2015-12-05 10:11:45.000000000 +0100 ++++ ./bin/phpcompatinfo 2015-12-07 09:14:17.072783363 +0100 +@@ -1,52 +1,21 @@ + #!/usr/bin/env php + setUseIncludePath(true); +- +-if (\Phar::running()) { +- if ($home) { +- // when optional resources are not embedded in phar distribution, +- // avoid PHP Warnings, and lookup first in global vendor dir (COMPOSER_HOME) if exists +- $classMapfiltered = $fallbackClassMap($loader->getClassMap(), 'Net_Growl'); +- $loader->addClassMap($classMapfiltered); +- +- // try to find PEAR Net_Growl classes package in folder $fallbackNetGrowlDir (see phar-stub.php) +- $loader->add(false, $fallbackNetGrowlDir); +- } ++require_once $vendorDir . '/Bartlett/CompatInfo/autoload.php'; ++if (!getenv("BARTLETTRC")) { ++ putenv("BARTLETTRC=" . strtolower($appName) . '.json'); + } + + if (PHP_SAPI !== 'cli') { + return; + } + +-if (\Phar::running()) { +- try { +- Bartlett\CompatInfoDb\Environment::checkRequirements(); +- } catch (\RuntimeException $e) { +- die ($e->getMessage()); +- } +-} +- + use Bartlett\Reflect\Environment; + use Bartlett\CompatInfo\Console\Application; + + Environment::setScanDir(); + +-$application = new Application($appName, '5.0'); ++$application = new Application($appName, '@package_version@'); + $application->run(); +diff -up ./tests/bootstrap.php.rpm ./tests/bootstrap.php diff --git a/php-bartlett-PHP-CompatInfo-autoload.php b/php-bartlett-PHP-CompatInfo-autoload.php deleted file mode 100644 index 62dd824..0000000 --- a/php-bartlett-PHP-CompatInfo-autoload.php +++ /dev/null @@ -1,22 +0,0 @@ -register(); -} -$fedoraClassLoader->addPrefixes(array( - 'Bartlett\\CompatInfo' => dirname(dirname(__DIR__)), -)); - -// Dependencies -require_once $vendorDir . '/Bartlett/Reflect/autoload.php'; diff --git a/php-bartlett-PHP-CompatInfo.spec b/php-bartlett-PHP-CompatInfo.spec index dea9446..f695312 100644 --- a/php-bartlett-PHP-CompatInfo.spec +++ b/php-bartlett-PHP-CompatInfo.spec @@ -7,7 +7,7 @@ # Please, preserve the changelog entries # %{!?php_version: %global php_version %(php -r 'echo PHP_VERSION;' 2>/dev/null)} -%global gh_commit 4fc02f5dc9e07039e3baafe53a287547dd8675bd +%global gh_commit 1b65ee36ac475e2ce3a20fae612659ea933338c6 %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) #global gh_date 20151005 %global gh_owner llaville @@ -16,7 +16,7 @@ %global with_tests %{?_without_tests:0}%{!?_without_tests:1} Name: php-bartlett-PHP-CompatInfo -Version: 4.5.2 +Version: 5.0.0 %global specrel 1 Release: %{?gh_date:0.%{specrel}.%{?prever}%{!?prever:%{gh_date}git%{gh_short}}}%{!?gh_date:%{specrel}}%{?dist} Summary: Find out version and the extensions required for a piece of code to run @@ -30,41 +30,44 @@ Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit Source1: fedora-review-check # Autoloader for RPM - die composer ! -Source2: %{name}-autoload.php +Source2: %{name}-5.0.0-autoload.php # Autoload and sqlite database path -Patch0: %{name}-4.5.0-rpm.patch +Patch0: %{name}-5.0.0-rpm.patch BuildArch: noarch -BuildRequires: php(language) >= 5.3.2 +BuildRequires: php(language) >= 5.4.0 %if %{with_tests} # to run test suite BuildRequires: %{_bindir}/phpunit BuildRequires: php-pdo_sqlite -BuildRequires: php-composer(bartlett/php-reflect) >= 3.1 +BuildRequires: php-composer(bartlett/php-reflect) >= 4.0 +BuildRequires: php-composer(bartlett/php-compatinfo-db) >= 1.0 # For our patch / autoloader BuildRequires: php-composer(symfony/class-loader) -BuildRequires: php-bartlett-PHP-Reflect >= 3.1.1-3 %endif # From composer.json, "require" -# "php": ">=5.3.2", +# "php": ">=5.4.0", # "ext-libxml": "*", # "ext-pcre": "*", # "ext-spl": "*", # "ext-json": "*", # "ext-pdo_sqlite": "*", # "symfony/console": "~2.5", -# "bartlett/php-reflect": "~3.1", -Requires: php(language) >= 5.3.2 +# "bartlett/php-reflect": "~4.0", +# "bartlett/php-compatinfo-db": "~1.0" +Requires: php(language) >= 5.4.0 Requires: php-cli Requires: php-json Requires: php-libxml Requires: php-pcre Requires: php-pdo_sqlite Requires: php-spl -Requires: php-composer(bartlett/php-reflect) >= 3.1 -Requires: php-composer(bartlett/php-reflect) < 4 +Requires: php-composer(bartlett/php-reflect) >= 4.0 +Requires: php-composer(bartlett/php-reflect) < 5 +Requires: php-composer(bartlett/php-compatinfo-db) >= 1.0 +Requires: php-composer(bartlett/php-compatinfo-db) < 2 Requires: php-composer(symfony/console) >= 2.5 Requires: php-composer(symfony/console) < 3 # From composer.json, "require-dev": { @@ -118,8 +121,7 @@ sed -e 's/@package_version@/%{version}%{?prever}/' \ %build -: Generate the references database -%{_bindir}/php -d date.timezone=Europe/Paris data/handleDB.php db:init +# Nothing %install @@ -129,21 +131,14 @@ cp -pr src/Bartlett %{buildroot}%{_datadir}/php/Bartlett install -D -p -m 755 bin/phpcompatinfo %{buildroot}%{_bindir}/phpcompatinfo install -D -p -m 644 bin/phpcompatinfo.json.dist %{buildroot}%{_sysconfdir}/phpcompatinfo.json install -D -p -m 644 bin/phpcompatinfo.1 %{buildroot}%{_mandir}/man1/phpcompatinfo.1 -install -D -p -m 644 data/compatinfo.sqlite %{buildroot}%{_datadir}/%{name}/compatinfo.sqlite install -D -p -m 755 %{SOURCE1} %{buildroot}%{_datadir}/%{name}/fedora-review-check %if %{with_tests} %check -# drop some test because of RC version -rm tests/Reference/Extension/AmqpExtensionTest.php -rm tests/Reference/Extension/SphinxExtensionTest.php - -%if 0%{?fedora} < 21 && 0%{?rhel} < 7 -rm tests/Reference/Extension/CurlExtensionTest.php -rm tests/Reference/Extension/LibxmlExtensionTest.php -%endif +mkdir vendor +ln -s %{buildroot}%{_datadir}/php/Bartlett/CompatInfo/autoload.php vendor/ %{_bindir}/phpunit \ --include-path %{buildroot}%{_datadir}/php \ @@ -166,12 +161,14 @@ fi %{_bindir}/phpcompatinfo %{_datadir}/php/Bartlett/CompatInfo %{_mandir}/man1/phpcompatinfo.1* -%{_datadir}/%{name} %changelog * Wed Nov 25 2015 Remi Collet - 4.5.2-1 - update to 4.5.2 +- raise dependency on bartlett/php-reflect ~4.0 +- raise minimal php version to 5.4 +- add dependency on bartlett/php-compatinfo-db * Sun Oct 11 2015 Remi Collet - 4.5.1-1 - update to 4.5.1 -- cgit