From d3a601cc8f12dce102001068388a51aff9a84751 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sun, 4 May 2014 09:49:16 +0200 Subject: php-phpunit-phpdcd: 1.0.2, sources from github --- Autoload.php.in | 30 +++++++++++++ Makefile | 2 +- php-phpunit-phpdcd.spec | 112 +++++++++++++++++++++++++++++------------------- phpdcd-rpm.patch | 34 +++++++++++++++ 4 files changed, 134 insertions(+), 44 deletions(-) create mode 100644 Autoload.php.in create mode 100644 phpdcd-rpm.patch diff --git a/Autoload.php.in b/Autoload.php.in new file mode 100644 index 0000000..c7f66e0 --- /dev/null +++ b/Autoload.php.in @@ -0,0 +1,30 @@ += 1:1.9.4 -BuildRequires: php-channel(%{channel}) -Requires: php-common >= 5.2.7 -Requires: php-channel(%{channel}) -Requires(post): %{__pear} -Requires(postun): %{__pear} -Requires: php-pear(pear.phpunit.de/File_Iterator) >= 1.3.0 -Requires: php-pear(pear.phpunit.de/PHP_TokenStream) >= 1.1.0 -Requires: php-pear(pear.phpunit.de/PHP_Timer) >= 1.0.1 +# Autoload template +Source1: Autoload.php.in -Requires: php-pear(components.ez.no/ConsoleTools) >= 1.6 +# Fix for RPM, use autoload +Patch0: %{gh_project}-rpm.patch -Provides: php-pear(%{channel}/%{pear_name}) = %{version} +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildArch: noarch +BuildRequires: php(language) >= 5.3.3 +BuildRequires: %{_bindir}/phpab +%if %{with_tests} +BuildRequires: %{_bindir}/phpunit +BuildRequires: php-phpunit-FinderFacade >= 1.1.0 +BuildRequires: php-phpunit-Version >= 1.0.3 +BuildRequires: php-symfony-console >= 2.2.0 +BuildRequires: php-phpunit-PHP-Timer >= 1.0.4 +BuildRequires: php-phpunit-PHP-TokenStream >= 1.1.3 +%endif + +# From composer.json +Requires: php(language) >= 5.3.3 +Requires: php-phpunit-FinderFacade >= 1.1.0 +Requires: php-phpunit-Version >= 1.0.3 +Requires: php-symfony-console >= 2.2.0 +Requires: php-phpunit-PHP-Timer >= 1.0.4 +Requires: php-phpunit-PHP-TokenStream >= 1.1.3 +# From phpcompatinfo report for version 1.0.2 +Requires: php-pcre +Requires: php-spl %description @@ -34,54 +53,61 @@ phpdcd is a Dead Code Detector (DCD) for PHP code. It scans a PHP project for all declared functions and methods and reports those as being "dead code" that are not called at least once. + %prep -%setup -q -c -[ -f package2.xml ] || mv package.xml package2.xml -%{__mv} package2.xml %{pear_name}-%{version}/%{name}.xml +%setup -q -n %{gh_project}-%{gh_commit} + +%patch0 -p1 -b .rpm %build -cd %{pear_name}-%{version} -# Empty build section, most likely nothing required. +phpab \ + --output src/Autoload.php \ + --template %{SOURCE1} \ + src %install -cd %{pear_name}-%{version} -%{__rm} -rf $RPM_BUILD_ROOT docdir -%{__pear} install --nodeps --packagingroot $RPM_BUILD_ROOT %{name}.xml +rm -rf %{buildroot} +mkdir -p %{buildroot}%{php_home} +cp -pr src %{buildroot}%{php_home}/PHPDCD + +install -D -p -m 755 phpdcd %{buildroot}%{_bindir}/phpdcd -# Clean up unnecessary files -%{__rm} -rf $RPM_BUILD_ROOT%{pear_phpdir}/.??* -# Install XML package description -%{__mkdir} -p $RPM_BUILD_ROOT%{pear_xmldir} -%{__install} -pm 644 %{name}.xml $RPM_BUILD_ROOT%{pear_xmldir} +%if %{with_tests} +%check +phpunit \ + --bootstrap src/Autoload.php \ + -d date.timezone=UTC \ + tests +%endif %clean -%{__rm} -rf $RPM_BUILD_ROOT +rm -rf $RPM_BUILD_ROOT %post -%{__pear} install --nodeps --soft --force --register-only \ - %{pear_xmldir}/%{name}.xml >/dev/null || : - - -%postun -if [ $1 -eq 0 ] ; then - %{__pear} uninstall --nodeps --ignore-errors --register-only \ - %{channel}/%{pear_name} >/dev/null || : +if [ -x %{_bindir}/pear ]; then + %{_bindir}/pear uninstall --nodeps --ignore-errors --register-only \ + %{pear_channel}/%{pear_name} >/dev/null || : fi %files %defattr(-,root,root,-) -%{pear_xmldir}/%{name}.xml -%{pear_phpdir}/PHPDCD +%doc LICENSE README.md composer.json +%{php_home}/PHPDCD %{_bindir}/phpdcd %changelog +* Sun May 4 2014 Remi Collet - 1.0.2-1 +- update to 1.0.2 +- sources from github +- run test suite during build + * Sat Mar 31 2012 Remi Collet - 0.9.3-1 - upstream 0.9.3, rebuild for remi repository diff --git a/phpdcd-rpm.patch b/phpdcd-rpm.patch new file mode 100644 index 0000000..96c27ea --- /dev/null +++ b/phpdcd-rpm.patch @@ -0,0 +1,34 @@ +diff -up ./phpdcd.rpm ./phpdcd +--- ./phpdcd.rpm 2014-05-04 09:36:58.000000000 +0200 ++++ ./phpdcd 2014-05-04 09:38:12.000000000 +0200 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env php ++#!/usr/bin/php + run(); -- cgit