summaryrefslogtreecommitdiffstats
path: root/php-phpunit-PHP-Timer.spec
diff options
context:
space:
mode:
Diffstat (limited to 'php-phpunit-PHP-Timer.spec')
-rw-r--r--php-phpunit-PHP-Timer.spec85
1 files changed, 45 insertions, 40 deletions
diff --git a/php-phpunit-PHP-Timer.spec b/php-phpunit-PHP-Timer.spec
index 2b94b97..274a012 100644
--- a/php-phpunit-PHP-Timer.spec
+++ b/php-phpunit-PHP-Timer.spec
@@ -1,83 +1,88 @@
-%{!?__pear: %{expand: %%global __pear %{_bindir}/pear}}
-%global pear_name PHP_Timer
-%global channel pear.phpunit.de
+%global gh_commit 19689d4354b295ee3d8c54b4f42c3efb69cbc17c
+%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
+%global gh_owner sebastianbergmann
+%global gh_project php-timer
+%global php_home %{_datadir}/php
+%global pear_name PHP_Timer
+%global pear_channel pear.phpunit.de
+# Circular dependency with phpunit
+%global with_tests %{?_with_tests:1}%{!?_with_tests:0}
Name: php-phpunit-PHP-Timer
Version: 1.0.5
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: PHP Utility class for timing
Group: Development/Libraries
License: BSD
-URL: http://github.com/sebastianbergmann/php-timer/
-Source0: http://pear.phpunit.de/get/%{pear_name}-%{version}.tgz
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+URL: https://github.com/%{gh_owner}/%{gh_project}
+Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: php(language) >= 5.3.3
-BuildRequires: php-pear
-BuildRequires: php-channel(%{channel})
+%if %{with_tests}
+BuildRequires: %{_bindir}/phpunit
+%endif
+# From composer.json
Requires: php(language) >= 5.3.3
+# From phpcompatinfo report for version 1.0.5
Requires: php-spl
-Requires: php-channel(%{channel})
-Requires(post): %{__pear}
-Requires(postun): %{__pear}
-Provides: php-pear(%{channel}/%{pear_name}) = %{version}
+# For compatibility with PEAR mode
+Provides: php-pear(%{pear_channel}/%{pear_name}) = %{version}
%description
PHP Utility class for timing
+
%prep
-%setup -q -c
-cd %{pear_name}-%{version}
-mv ../package.xml %{name}.xml
+%setup -q -n %{gh_project}-%{gh_commit}
+
+rm PHP/Timer/Autoload.php.in
%build
-cd %{pear_name}-%{version}
# Empty build section, most likely nothing required.
+# If upstream drop Autoload.php, command to generate it
+# phpab \
+# --output PHP/Timer/Autoload.php \
+# --template PHP/Timer/Autoload.php.in \
+# PHP
+
%install
-rm -rf %{buildroot}
-cd %{pear_name}-%{version}
-%{__pear} install --nodeps --packagingroot %{buildroot} %{name}.xml
+rm -rf %{buildroot}
+mkdir -p %{buildroot}%{php_home}
+cp -pr PHP %{buildroot}%{php_home}
-# 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 PHP/Timer/Autoload.php \
+ -d date.timezone=UTC
+%endif
%clean
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 \
- %{channel}/%{pear_name} >/dev/null || :
-fi
-
-
%files
%defattr(-,root,root,-)
-%doc %{pear_docdir}/%{pear_name}
-%{pear_xmldir}/%{name}.xml
-%{pear_phpdir}/PHP
+%doc LICENSE README.md composer.json
+%{php_home}
%changelog
+* Wed Apr 23 2014 Remi Collet <remi@fedoraproject.org> - 1.0.5-2
+- get sources from github
+- run test suite when build --with tests
+
* Fri Aug 02 2013 Remi Collet <remi@fedoraproject.org> - 1.0.5-1
- Update to 1.0.5