From e168930ed90c92aead83ff2f5ced9733980892d3 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 20 Jan 2015 10:43:42 +0100 Subject: php-bartlett-PHP-CompatInfo: add patch for DB path --- php-bartlett-PHP-CompatInfo-4.0.0-pr163.patch | 25 +++++++++++++++++++++++++ php-bartlett-PHP-CompatInfo-4.0.0-rpm.patch | 9 ++++----- php-bartlett-PHP-CompatInfo-dev.spec | 20 +++++++++++++++----- 3 files changed, 44 insertions(+), 10 deletions(-) create mode 100644 php-bartlett-PHP-CompatInfo-4.0.0-pr163.patch diff --git a/php-bartlett-PHP-CompatInfo-4.0.0-pr163.patch b/php-bartlett-PHP-CompatInfo-4.0.0-pr163.patch new file mode 100644 index 0000000..710947a --- /dev/null +++ b/php-bartlett-PHP-CompatInfo-4.0.0-pr163.patch @@ -0,0 +1,25 @@ +From 2154b3581ec69bd38bfbc68fe355e6383756ec8f Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Tue, 20 Jan 2015 10:28:07 +0100 +Subject: [PATCH] allow to set compatinfo.sqlite path using + BARTLETT_COMPATINFO_DB + +--- + src/Bartlett/CompatInfo/Environment.php | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/Bartlett/CompatInfo/Environment.php b/src/Bartlett/CompatInfo/Environment.php +index e50eec5..c10ef97 100644 +--- a/src/Bartlett/CompatInfo/Environment.php ++++ b/src/Bartlett/CompatInfo/Environment.php +@@ -22,6 +22,10 @@ class Environment + */ + public static function initRefDb() + { ++ if ($database = getenv('BARTLETT_COMPATINFO_DB')) { ++ return new \PDO('sqlite:' . $database); ++ } ++ + $database = 'compatinfo.sqlite'; + $tempDir = sys_get_temp_dir() . '/bartlett'; + diff --git a/php-bartlett-PHP-CompatInfo-4.0.0-rpm.patch b/php-bartlett-PHP-CompatInfo-4.0.0-rpm.patch index 572f5b1..9e1f22b 100644 --- a/php-bartlett-PHP-CompatInfo-4.0.0-rpm.patch +++ b/php-bartlett-PHP-CompatInfo-4.0.0-rpm.patch @@ -8,13 +8,15 @@ diff -up ./bin/phpcompatinfo.rpm ./bin/phpcompatinfo setUseIncludePath(true); + ++putenv('BARTLETT_COMPATINFO_DB=/usr/share/php-bartlett-PHP-CompatInfo/compatinfo.sqlite'); ++ +$vendorDir = '/usr/share/php'; +require_once $vendorDir . '/PhpParser/Autoloader.php'; +PhpParser\Autoloader::register(); @@ -76,7 +78,7 @@ diff -up ./tests/bootstrap.php.rpm ./tests/bootstrap.php diff -up ./data/handleDB.php.rpm ./data/handleDB.php --- ./data/handleDB.php.rpm 2015-01-19 14:17:57.871354474 +0100 +++ ./data/handleDB.php 2015-01-19 14:20:42.213040384 +0100 -@@ -11,7 +11,21 @@ +@@ -11,7 +11,18 @@ * @since Release 4.0.0alpha3 */ @@ -88,10 +90,7 @@ diff -up ./data/handleDB.php.rpm ./data/handleDB.php + +$loader = new UniversalClassLoader(); +$loader->registerNamespaces(array( -+ 'Doctrine\\Common' => $vendorDir, + 'Symfony\\Component' => $vendorDir, -+ 'Bartlett\\Reflect' => $vendorDir, -+ 'Bartlett' => $baseDir . '/src', + )); + +$loader->register(); diff --git a/php-bartlett-PHP-CompatInfo-dev.spec b/php-bartlett-PHP-CompatInfo-dev.spec index 1c0a397..29f56b5 100644 --- a/php-bartlett-PHP-CompatInfo-dev.spec +++ b/php-bartlett-PHP-CompatInfo-dev.spec @@ -14,7 +14,7 @@ Name: php-bartlett-PHP-CompatInfo Version: 4.0.0 -%global specrel 1 +%global specrel 2 Release: %{?gh_short:0.%{specrel}.%{?gh_date}git%{gh_short}}%{!?gh_short:%{specrel}}%{?dist} Summary: Find out version and the extensions required for a piece of code to run @@ -26,6 +26,9 @@ Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit # Autoloader for RPM - die composer ! Patch0: %{name}-4.0.0-rpm.patch +# https://github.com/llaville/php-compat-info/pull/163 +Patch1: %{name}-4.0.0-pr163.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch BuildRequires: php(language) >= 5.3.0 @@ -86,16 +89,17 @@ Documentation: http://php5.laurent-laville.org/compatinfo/manual/current/en/ #setup -q -n %{gh_project}-%{version} %patch0 -p1 -b .rpm +%patch1 -p1 sed -e 's/@package_version@/%{version}/' \ -i $(find src -name \*.php) -#rm data/compatinfo.sqlite +mv data/compatinfo.sqlite data/compatinfo.sqlite.upstream %build : Generate the references database -#{_bindir}/php data/handleDB.php db:init +%{_bindir}/php data/handleDB.php db:init %install @@ -106,12 +110,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 %check %{_bindir}/phpunit \ + --include-path src \ -d memory_limit=-1 \ -%if 0%{?rhel} < 6 && 0%{?fedora} < 8 +%if 0%{?fedora} < 21 || exit 0 %endif @@ -131,11 +137,15 @@ fi %config(noreplace) %{_sysconfdir}/phpcompatinfo.json %{_bindir}/phpcompatinfo %{_datadir}/php/Bartlett/CompatInfo -%{_datadir}/php/Bartlett/CompatInfo.php %{_mandir}/man1/phpcompatinfo.1* +%{_datadir}/%{name}/compatinfo.sqlite %changelog +* Tue Jan 20 2015 Remi Collet - 4.0.0-0.2.20150116gitd900ea4 +- add patch for DB path (pr #163) +- take care of test suite results only in f21 for now + * Mon Jan 19 2015 Remi Collet - 4.0.0-0.1.20150116gitd900ea4 - 4.0.0 snapshot -- cgit