diff options
-rw-r--r-- | autoload.php.in | 18 | ||||
-rw-r--r-- | php-phpunit-phploc.spec | 35 | ||||
-rw-r--r-- | phploc-rpm.patch | 19 |
3 files changed, 43 insertions, 29 deletions
diff --git a/autoload.php.in b/autoload.php.in index 52a3f0c..22ad17d 100644 --- a/autoload.php.in +++ b/autoload.php.in @@ -1,10 +1,20 @@ <?php /* Inspired from autoload from version 2.0.3 */ -require_once 'SebastianBergmann/FinderFacade/autoload.php'; -require_once 'SebastianBergmann/Git/autoload.php'; -require_once 'SebastianBergmann/Version/autoload.php'; -require_once 'Symfony/Component/Console/autoloader.php'; +$vendorDir = '/usr/share/php'; +require_once $vendorDir . '/SebastianBergmann/FinderFacade/autoload.php'; +require_once $vendorDir . '/SebastianBergmann/Git/autoload.php'; +require_once $vendorDir . '/SebastianBergmann/Version/autoload.php'; + +if (!(isset($sfuloader) && $sfuloader instanceof Symfony\Component\ClassLoader\UniversalClassLoader)) { + require_once $vendorDir . '/Symfony/Component/ClassLoader/UniversalClassLoader.php'; + $sfuloader = new Symfony\Component\ClassLoader\UniversalClassLoader(); + $sfuloader->register(); +} +$sfuloader->registerNamespaces(array( + 'Symfony\\Component\\Console' => $vendorDir, + 'Symfony\\Component\\ClassLoader' => $vendorDir, +)); spl_autoload_register( function($class) { diff --git a/php-phpunit-phploc.spec b/php-phpunit-phploc.spec index 6f7fd2a..0f7eb2f 100644 --- a/php-phpunit-phploc.spec +++ b/php-phpunit-phploc.spec @@ -7,7 +7,7 @@ # # Please, preserve the changelog entries # -%global gh_commit d6b05c9072ed7ec3e365722d129f220c24aa90f1 +%global gh_commit ab893cbe5c4b63760b1560b370fedc001eb5717f %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) %global gh_owner sebastianbergmann %global gh_project phploc @@ -17,14 +17,14 @@ %global with_tests %{?_without_tests:0}%{!?_without_tests:1} Name: php-phpunit-phploc -Version: 2.1.2 +Version: 2.1.3 Release: 1%{?dist} Summary: A tool for quickly measuring the size of a PHP project Group: Development/Libraries License: BSD URL: https://github.com/%{gh_owner}/%{gh_project} -Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}.tar.gz +Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}-%{gh_short}.tar.gz # Autoload template Source1: autoload.php.in @@ -34,7 +34,7 @@ Patch0: %{gh_project}-rpm.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch -BuildRequires: php(language) >= 5.4 +BuildRequires: php(language) >= 5.3.3 BuildRequires: %{_bindir}/phpab %if %{with_tests} BuildRequires: %{_bindir}/phpunit @@ -44,8 +44,9 @@ BuildRequires: php-composer(sebastian/git) >= 2.0 BuildRequires: php-composer(sebastian/git) < 3 BuildRequires: php-composer(sebastian/version) >= 1.0.3 BuildRequires: php-composer(sebastian/version) < 2 -BuildRequires: php-symfony-console >= 2.5 -BuildRequires: php-symfony-console < 3 +BuildRequires: php-composer(symfony/console) >= 2.5 +BuildRequires: php-composer(symfony/console) < 3 +BuildRequires: php-composer(symfony/class-loader) %endif # From composer.json @@ -54,7 +55,7 @@ BuildRequires: php-symfony-console < 3 # "sebastian/git": "~2.0", # "sebastian/version": "~1.0.3", # "symfony/console": "~2.5" -Requires: php(language) >= 5.4 +Requires: php(language) >= 5.3.3 Requires: php-cli Requires: php-composer(sebastian/finder-facade) >= 1.1 Requires: php-composer(sebastian/finder-facade) < 2 @@ -62,15 +63,16 @@ Requires: php-composer(sebastian/git) >= 2.0 Requires: php-composer(sebastian/git) < 3 Requires: php-composer(sebastian/version) >= 1.0.3 Requires: php-composer(sebastian/version) < 2 -Requires: php-symfony-console >= 2.5 -Requires: php-symfony-console < 3 -# From phpcompatinfo report for version 2.0.5 +Requires: php-composer(symfony/console) >= 2.5 +Requires: php-composer(symfony/console) < 3 +# From phpcompatinfo report for version 2.1.3 Requires: php-dom Requires: php-spl Requires: php-tokenizer +# For our autoloader +Requires: php-composer(symfony/class-loader) Provides: php-composer(phploc/phploc) = %{version} - # For compat Provides: php-pear(%{pear_channel}/%{pear_name}) = %{version} Provides: phploc = %{version} @@ -126,12 +128,21 @@ fi %files %defattr(-,root,root,-) -%doc LICENSE README.md composer.json +%{!?_licensedir:%global license %%doc} +%license LICENSE +%doc README.md +%doc composer.json %{php_home}/PHPLOC %{_bindir}/phploc %changelog +* Thu Jun 4 2015 Remi Collet <remi@fedoraproject.org> - 2.1.3-1 +- update to 2.1.3 +- improve autoloader +- lower minimal PHP version to 5.3.3 +- fix license handling + * Tue May 26 2015 Remi Collet <remi@fedoraproject.org> - 2.1.2-1 - update to 2.1.2 - ensure compatibility with SCL diff --git a/phploc-rpm.patch b/phploc-rpm.patch index 414b0f3..671c679 100644 --- a/phploc-rpm.patch +++ b/phploc-rpm.patch @@ -1,7 +1,7 @@ diff -up ./phploc.rpm ./phploc ---- ./phploc.rpm 2015-05-26 16:03:47.000000000 +0200 -+++ ./phploc 2015-05-26 19:14:44.687212792 +0200 -@@ -9,23 +9,16 @@ +--- ./phploc.rpm 2015-06-04 15:18:14.000000000 +0200 ++++ ./phploc 2015-06-04 17:19:24.277906076 +0200 +@@ -9,23 +9,7 @@ * file that was distributed with this source code. */ @@ -13,15 +13,8 @@ diff -up ./phploc.rpm ./phploc - $loaded = true; - break; - } -+// Ensure correct include_path for RHSCL -+$inc = get_include_path(); -+$dirs = explode(':', $inc); -+if (!in_array('/usr/share/php', $dirs)) { -+ $dirs[] = '/usr/share/php'; -+ set_include_path(implode(':', $dirs)); - } -+unset ($inc, $dirs); - +-} +- -if (!$loaded) { - die( - 'You need to set up the project dependencies using the following commands:' . PHP_EOL . @@ -29,7 +22,7 @@ diff -up ./phploc.rpm ./phploc - 'php composer.phar install' . PHP_EOL - ); -} -+require 'SebastianBergmann/PHPLOC/autoload.php'; ++require '/usr/share/php/SebastianBergmann/PHPLOC/autoload.php'; $application = new SebastianBergmann\PHPLOC\CLI\Application; $application->run(); |