summaryrefslogtreecommitdiffstats
path: root/php-phpunit-phploc.spec
diff options
context:
space:
mode:
Diffstat (limited to 'php-phpunit-phploc.spec')
-rw-r--r--php-phpunit-phploc.spec111
1 files changed, 65 insertions, 46 deletions
diff --git a/php-phpunit-phploc.spec b/php-phpunit-phploc.spec
index b874639..5376a5a 100644
--- a/php-phpunit-phploc.spec
+++ b/php-phpunit-phploc.spec
@@ -1,39 +1,53 @@
-%{!?pear_metadir: %global pear_metadir %{pear_phpdir}}
-%{!?__pear: %{expand: %%global __pear %{_bindir}/pear}}
-%global pear_name phploc
+%global gh_commit d177c22e2a08e448f7bdfa762045f7bd086834d7
+%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
+%global gh_owner sebastianbergmann
+%global gh_project phploc
+%global php_home %{_datadir}/php/SebastianBergmann
%global pear_channel pear.phpunit.de
+%global with_tests %{?_without_tests:0}%{!?_without_tests:1}
Name: php-phpunit-phploc
-Version: 2.0.4
+Version: 2.0.5
Release: 1%{?dist}
Summary: A tool for quickly measuring the size of a PHP project
Group: Development/Libraries
License: BSD
-URL: http://sebastianbergmann.github.com/phploc/
-Source0: http://%{pear_channel}/get/%{pear_name}-%{version}.tgz
+URL: https://github.com/%{gh_owner}/%{gh_project}
+Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}.tar.gz
+
+# Autoload template
+Source1: autoload.php.in
+
+# Fix for RPM, use autoload
+Patch0: %{gh_project}-rpm.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
-BuildRequires: php-pear(PEAR) >= 1.9.4
-BuildRequires: php-channel(%{pear_channel})
-
-Requires(post): %{__pear}
-Requires(postun): %{__pear}
-# From package.xml
+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-git >= 1.0.0
+BuildRequires: php-phpunit-Version >= 1.0.3
+BuildRequires: php-symfony-console >= 2.2.0
+%endif
+
+# From composer.json
Requires: php(language) >= 5.3.3
-Requires: php-tokenizer
-Requires: php-pear(PEAR) >= 1.9.4
-Requires: php-channel(%{pear_channel})
-Requires: php-pear(pear.symfony.com/Console) >= 2.2.0
-Requires: php-pear(%{pear_channel}/FinderFacade) >= 1.1.0
-Requires: php-pear(%{pear_channel}/Git) >= 1.0.0
-Requires: php-pear(%{pear_channel}/Version) >= 1.0.0
-# From phpcompatinfo report for version 2.0.3
+Requires: php-phpunit-FinderFacade >= 1.1.0
+Requires: php-phpunit-git >= 1.0.0
+Requires: php-phpunit-Version >= 1.0.3
+Requires: php-symfony-console >= 2.2.0
+# From phpcompatinfo report for version 2.0.5
Requires: php-dom
Requires: php-spl
+Requires: php-tokenizer
+# For compat
Provides: php-pear(%{pear_channel}/%{pear_name}) = %{version}
+Provides: phploc = %{version}
%description
@@ -45,54 +59,59 @@ need to get a quick understanding of a project's size.
%prep
-%setup -q -c
-[ -f package2.xml ] || mv package.xml package2.xml
-%{__mv} package2.xml %{pear_name}-%{version}/%{name}.xml
-cd %{pear_name}-%{version}
+%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 %{buildroot} docdir
-%{__pear} install --nodeps --packagingroot %{buildroot} %{name}.xml
+rm -rf %{buildroot}
+mkdir -p %{buildroot}%{php_home}
+cp -pr src %{buildroot}%{php_home}/PHPLOC
+
+install -D -p -m 755 phploc %{buildroot}%{_bindir}/phploc
-# Clean up unnecessary files
-%{__rm} -rf %{buildroot}%{pear_metadir}/.??*
-# Install XML package description
-%{__mkdir} -p %{buildroot}%{pear_xmldir}
-%{__install} -pm 644 %{name}.xml %{buildroot}%{pear_xmldir}
+%if %{with_tests}
+%check
+phpunit \
+ --bootstrap src/autoload.php \
+ -d date.timezone=UTC \
+ tests
+%endif
%clean
-%{__rm} -rf %{buildroot}
+rm -rf %{buildroot}
%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 \
- %{pear_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,-)
-%doc %{pear_docdir}/%{pear_name}
-%{pear_xmldir}/%{name}.xml
-%{pear_phpdir}/SebastianBergmann/PHPLOC
+%doc LICENSE README.md composer.json
+%{php_home}/PHPLOC
%{_bindir}/phploc
%changelog
+* Sat May 3 2014 Remi Collet <remi@fedoraproject.org> - 2.0.5-1
+- update to 2.0.5
+- sources from github
+- run test suite during build
+
* Wed Dec 18 2013 Remi Collet <remi@fedoraproject.org> - 2.0.4-1
- Update to 2.0.4