@ -1,73 +1,99 @@
%{!?__pear: %{expand: %%global __pear %{_bindir}/pear}}
# spec file for php-pear-PHP-CodeSniffer
#
# Copyright (c) 2013-2014 Remi Collet
# Copyright (c) 2009-2013 Christof Damian
# Copyright (c) 2006-2009 Konstantin Ryabitsev
#
# License: MIT
# http://opensource.org/licenses/MIT
#
# Please, preserve the changelog entries
#
%{!?__pear: %global __pear %{_bindir}/pear}
%{!?pear_metadir: %global pear_metadir %{pear_phpdir}}
%global pear_name PHP_CodeSniffer
%global pear_version 1.4.5
Name: php-pear-PHP-CodeSniffer
Version: %{pear_version}
Release: 3%{?dist}
Version: 1.5.5
Release: 1 %{?dist}
Summary: PHP coding standards enforcement tool
Group: Development/Tools
License: BSD
URL: http://pear.php.net/package/PHP_CodeSniffer
Source0: http://pear.php.net/get/%{pear_name}-%{pear_version}.tgz
Source0: http://pear.php.net/get/%{pear_name}-%{version}.tgz
# https://github.com/squizlabs/PHP_CodeSniffer/issues/273
Source1: PHP_CodeSniffer-licence.txt
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: php-pear >= 1:1.4.9-1.2
Requires: php-pear(PEAR)
Requires: php-common >= 5.1.2
BuildRequires: php-pear
# to run test suite
BuildRequires: php-phpunit-PHPUnit >= 3.5.0
Requires(post): %{__pear}
Requires(postun): %{__pear}
# From package.xml
Requires: php-pear(PEAR)
# From package.xml - optional
Requires: php-pear(pear.phpunit.de/PHP_Timer) >= 1.0.0
# From phpcompatinfo report for version 1.5.5
Requires: php-ctype
Requires: php-date
Requires: php-dom
Requires: php-iconv
Requires: php-pcre
Requires: php-reflection
Requires: php-simplexml
Requires: php-spl
Requires: php-tokenizer
Requires: php-xmlwriter
Provides: php-pear(%{pear_name}) = %{version}
Provides: php-composer(squizlabs/php_codesniffer) = %{version}
Provides: phpcs = %{version}
Obsoletes: phpcs < %{version}
%description
PHP_CodeSniffer provides functionality to verify that code conforms to
certain standards, such as PEAR, or user-defined.
%prep
%setup -q -c
[ -f package2.xml ] || mv package.xml package2.xml
mv package2.xml %{pear_name}-%{pear_version}/%{pear_name}.xml
cd %{pear_name}-%{pear_version}
sed -e '/phpcs-svn-pre-commit/s/role="script"/role="doc"/' \
package.xml >%{pear_name}-%{version}/%{pear_name}.xml
# Create a "localized" php.ini to avoid build warning
cp /etc/php.ini .
echo "date.timezone=UTC" >>php.ini
%build
# Empty build section,
%install
cd %{pear_name}-%{pear_version}
rm -rf $RPM_BUILD_ROOT
PHPRC=./php.ini %{__pear} install --nodeps --packagingroot $RPM_BUILD_ROOT %{pear_name}.xml
cd %{pear_name}-%{version}
# Remove phpcs-svn-pre-commit: we'll add it to docs
mv -f $RPM_BUILD_ROOT%{_bindir}/scripts/phpcs-svn-pre-commit .
chmod 0644 phpcs-svn-pre-commit
rm -rf $RPM_BUILD_ROOT%{_bindir}/scripts
cp %{SOURCE1} .
%{__pear} install --nodeps --packagingroot %{buildroot} %{pear_name}.xml
# Clean up unnecessary files
rm -rf %{buildroot}/ %{pear_metadir}/.??*
rm -rf %{buildroot}%{pear_metadir}/.??*
# Install XML package description
mkdir -p $RPM_BUILD_ROOT%{pear_xmldir}
install -pm 644 %{pear_name}.xml $RPM_BUILD_ROOT%{pear_xmldir}
mkdir -p %{buildroot}%{pear_xmldir}
install -pm 644 %{pear_name}.xml %{buildroot}%{pear_xmldir}
install -pm 644 %{SOURCE1} %{buildroot}%{pear_docdir}/%{pear_name}/LICENSE
%check
cd %{pear_name}-%{version}/tests
# Version 1.5.5 : 216, Assertions: 57, Skipped: 4.
%{_bindir}/phpunit \
-d date.timezone=UTC \
--verbose \
AllTests.php
%clean
rm -rf $RPM_BUILD_ROOT
%post
%{__pear} install --nodeps --soft --force --register-only \
@ -81,16 +107,25 @@ fi
%files
%defattr(-,root,root,-)
%doc %{pear_name}-%{pear_version}/PHP_CodeSniffer-licence.txt
%doc %{pear_name}-%{pear_version}/phpcs-svn-pre-commit
%doc %{pear_docdir}/%{pear_name}
%{pear_xmldir}/%{pear_name}.xml
%{pear_testdir}/%{pear_name}
%{pear_datadir}/%{pear_name}
%{pear_phpdir}/PHP
%{pear_datadir}/%{pear_name}/CodeSniffer.conf.dist
%{_bindir}/phpcs
%changelog
* Thu Oct 9 2014 Remi Collet <remi@fedoraproject.org> - 1.5.5
- Update to 1.5.5
- cleanup + changes from remi repo
- add explicit dependencies on need extensions
- run test suite during build
- provide php-composer(squizlabs/php_codesniffer)
- request LICENSE to be part of upstream tarball
https://github.com/squizlabs/PHP_CodeSniffer/issues/273
- add spec License header
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild