[packages/php-cs-fixer] up to 1.11.1; package from source
glen
glen at pld-linux.org
Sat Feb 6 14:52:26 CET 2016
commit a0b6e45fa990687a6c11d72c20bc093a361df617
Author: Elan Ruusamäe <glen at delfi.ee>
Date: Sat Feb 6 15:48:29 2016 +0200
up to 1.11.1; package from source
autoload.patch | 17 +++++++++++++++++
autoload.php | 31 +++++++++++++++++++++++++++++++
php-cs-fixer.spec | 51 +++++++++++++++++++++++++++++++--------------------
3 files changed, 79 insertions(+), 20 deletions(-)
---
diff --git a/php-cs-fixer.spec b/php-cs-fixer.spec
index 1d3bedb..340c0b6 100644
--- a/php-cs-fixer.spec
+++ b/php-cs-fixer.spec
@@ -1,27 +1,40 @@
-# TODO
-# - unbundle phar, use system libs, etc
-%define githash 81a46f8
-%define rel 1
+#
+# Conditional build:
+%bcond_with tests # build with tests
+
%define php_min_version 5.3.6
%include /usr/lib/rpm/macros.php
Summary: PHP Coding Standards Fixer
Name: php-cs-fixer
-Version: 1.6
-Release: 0.%{githash}.%{rel}
+Version: 1.11.1
+Release: 1
License: MIT
Group: Development/Languages/PHP
-Source0: http://get.sensiolabs.org/php-cs-fixer.phar?/%{name}-%{version}.phar
-# Source0-md5: e85e483854cd95bf4d36806feaa93758
+Source0: https://github.com/FriendsOfPHP/PHP-CS-Fixer/archive/v%{version}/%{name}-%{version}.tar.gz
+# Source0-md5: 23e5281aa66097427107573b8bc8228c
+Source1: autoload.php
+Patch0: autoload.patch
URL: http://cs.sensiolabs.org/
+BuildRequires: rpm-php-pearprov >= 4.4.2-11
+BuildRequires: rpmbuild(macros) >= 1.461
+%if %{with tests}
BuildRequires: %{php_name}-cli
BuildRequires: %{php_name}-ctype
BuildRequires: %{php_name}-phar
BuildRequires: %{php_name}-tokenizer
+%endif
Requires: /usr/bin/php
Requires: php(core) >= %{php_min_version}
Requires: php(ctype)
Requires: php(phar)
Requires: php(tokenizer)
+Requires: php-sebastian-diff >= 1.1
+Requires: php-symfony2-ClassLoader >= 2.7.7
+Requires: php-symfony2-Console >= 2.3
+Requires: php-symfony2-EventDispatcher >= 2.1
+Requires: php-symfony2-Finder >= 2.1
+Requires: php-symfony2-Process >= 2.3
+Requires: php-symfony2-Stopwatch >= 2.5
BuildArch: noarch
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -35,25 +48,22 @@ problems in your code, you know that fixing them by hand is tedious,
especially on large projects. This tool does the job for you.
%prep
-%setup -qcT
-cp -p %{SOURCE0} php-cs-fixer.phar
+%setup -qn PHP-CS-Fixer-%{version}
+%patch0 -p1
-# breaks signature:
-#%{__sed} -i -e '1 s,#!.*php,#!/usr/bin/php,' php-cs-fixer.phar
+mv Symfony/CS/Resources/phar-stub.php .
+cp -p %{SOURCE1} Symfony/CS/autoload.php
%build
-# PHP CS Fixer version 0.3-DEV by Fabien Potencier (3cef8c3)
-long_version=$(php php-cs-fixer.phar --version)
-ver=$(echo "${long_version}" | awk '$4 == "version" {v=$5; sub(/-DEV/, ".0", v); print v}')
+ver=$(awk -F"'" '/const VERSION/{print $(NF-1)}' Symfony/CS/Fixer.php)
test "$ver" = %{version}
-githash=$(echo "${long_version##* }" | tr -d '()')
-test "$githash" = %{githash}
-
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT%{_bindir}
-install -p php-cs-fixer.phar $RPM_BUILD_ROOT%{_bindir}/%{name}
+install -d $RPM_BUILD_ROOT{%{_bindir},%{php_data_dir}/Symfony/CS}
+cp -a Symfony $RPM_BUILD_ROOT%{php_data_dir}
+rm -r $RPM_BUILD_ROOT%{php_data_dir}/Symfony/CS/Tests
+install -p php-cs-fixer $RPM_BUILD_ROOT%{_bindir}/%{name}
%clean
rm -rf $RPM_BUILD_ROOT
@@ -61,3 +71,4 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
%attr(755,root,root) %{_bindir}/%{name}
+%{php_data_dir}/Symfony/CS
diff --git a/autoload.patch b/autoload.patch
new file mode 100644
index 0000000..75c5f92
--- /dev/null
+++ b/autoload.patch
@@ -0,0 +1,17 @@
+--- PHP-CS-Fixer-1.11.1/php-cs-fixer~ 2016-01-20 21:00:28.000000000 +0200
++++ PHP-CS-Fixer-1.11.1/php-cs-fixer 2016-02-06 15:15:10.656768547 +0200
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env php
++#!/usr/bin/php
+ <?php
+
+ /*
+@@ -35,7 +35,7 @@
+ if (file_exists($a = __DIR__.'/../../autoload.php')) {
+ require_once $a;
+ } else {
+- require_once __DIR__.'/vendor/autoload.php';
++ require '/usr/share/php/Symfony/CS/autoload.php';
+ }
+
+ use Symfony\CS\Console\Application;
diff --git a/autoload.php b/autoload.php
new file mode 100644
index 0000000..0f5f8af
--- /dev/null
+++ b/autoload.php
@@ -0,0 +1,31 @@
+<?php
+$phpDir = defined('PHP_DATADIR') && PHP_DATADIR ? PHP_DATADIR . '/php' : '/usr/share/php';
+$pearDir = defined('PEAR_INSTALL_DIR') && PEAR_INSTALL_DIR ? PEAR_INSTALL_DIR : '/usr/share/pear';
+
+// Use Symfony autoloader
+if (!isset($loader) || !($loader instanceof \Symfony\Component\ClassLoader\ClassLoader)) {
+ if (!class_exists('Symfony\\Component\\ClassLoader\\ClassLoader', false)) {
+ require_once $phpDir . '/Symfony/Component/ClassLoader/ClassLoader.php';
+ }
+
+ $loader = new \Symfony\Component\ClassLoader\ClassLoader();
+ $loader->register();
+}
+
+$baseDir = __DIR__;
+
+$loader->addPrefixes(array(
+ 'Symfony\\CS\\' => array($phpDir),
+
+ // Dependencies
+ 'Symfony\\Component\\Console\\' => array($phpDir),
+ 'Symfony\\Component\\Finder' => array($phpDir),
+ 'Symfony\\Component\\Process\\' => array($phpDir),
+ 'Symfony\\Component\\EventDispatcher\\' => array($phpDir),
+ 'Symfony\\Component\\Stopwatch\\' => array($phpDir),
+));
+
+// Dependencies
+require_once $phpDir . '/SebastianBergmann/Diff/autoload.php';
+
+return $loader;
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/php-cs-fixer.git/commitdiff/a0b6e45fa990687a6c11d72c20bc093a361df617
More information about the pld-cvs-commit
mailing list