[php-phpunit-PHP-Timer] - get sources from github - run test suite when build --with tests

Remi Collet remi at fedoraproject.org
Wed Apr 23 11:18:11 UTC 2014


commit c2b65bf5605b64b3511abf6fe15faf0f2a51fb60
Author: Remi Collet <remi at fedoraproject.org>
Date:   Wed Apr 23 13:18:03 2014 +0200

    - get sources from github
    - run test suite when build --with tests

 .gitignore                 |    2 +
 php-phpunit-PHP-Timer.spec |   95 +++++++++++++++++++++----------------------
 sources                    |    2 +-
 3 files changed, 49 insertions(+), 50 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index a9e5dbc..4088f7f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,6 @@
+clog
 /PHP_Timer-1.0.0.tgz
 /PHP_Timer-1.0.2.tgz
 /PHP_Timer-1.0.4.tgz
 /PHP_Timer-1.0.5.tgz
+/php-timer-1.0.5.tar.gz
diff --git a/php-phpunit-PHP-Timer.spec b/php-phpunit-PHP-Timer.spec
index 5aab65e..7689b5b 100644
--- a/php-phpunit-PHP-Timer.spec
+++ b/php-phpunit-PHP-Timer.spec
@@ -1,84 +1,81 @@
-%{!?pear_metadir: %global pear_metadir %{pear_phpdir}}
-%{!?__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
 
 BuildArch:      noarch
-BuildRequires:  php-pear >= 1:1.9.2
-BuildRequires:  php-channel(%{channel})
-Requires:       php-channel(%{channel})
-Requires:       php-common >= 5.3.3
-Requires(post): %{__pear}
-Requires(postun): %{__pear}
+BuildRequires:  php(language) >= 5.3.3
+%if %{with_tests}
+BuildRequires:  %{_bindir}/phpunit
+%endif
 
-Provides:       php-pear(%{channel}/%{pear_name}) = %{version}
+# From composer.json
+Requires:       php(language) >= 5.3.3
+# From phpcompatinfo report for version 1.0.5
+Requires:       php-spl
+
+# For compatibility with PEAR mode
+Provides:       php-pear(%{pear_channel}/%{pear_name}) = %{version}
 
 
 %description
 PHP Utility class for timing
 
+
 %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}
 
-cd %{pear_name}-%{version}
+rm PHP/Timer/Autoload.php.in
 
 
 %build
-cd %{pear_name}-%{version}
 # Empty build section, most likely nothing required.
 
-
-%install
-cd %{pear_name}-%{version}
-%{__rm} -rf $RPM_BUILD_ROOT
-%{__pear} install --nodeps --packagingroot $RPM_BUILD_ROOT %{name}.xml
-
-# Clean up unnecessary files
-%{__rm} -rf $RPM_BUILD_ROOT%{pear_metadir}/.??*
-
-# Install XML package description
-%{__mkdir} -p $RPM_BUILD_ROOT%{pear_xmldir}
-%{__install} -pm 644 %{name}.xml $RPM_BUILD_ROOT%{pear_xmldir}
+# If upstream drop Autoload.php, command to generate it
+# phpab \
+#   --output PHP/Timer/Autoload.php \
+#   --template PHP/Timer/Autoload.php.in \
+#   PHP
 
 
-%clean
-
-%{__rm} -rf $RPM_BUILD_ROOT
-
-
-%post
-%{__pear} install --nodeps --soft --force --register-only \
-  %{pear_xmldir}/%{name}.xml >/dev/null || :
+%install
+mkdir -p   %{buildroot}%{php_home}
+cp -pr PHP %{buildroot}%{php_home}
 
 
-%postun
-if [ $1 -eq 0 ] ; then
-  %{__pear} uninstall --nodeps --ignore-errors --register-only \
-    %{channel}/%{pear_name} >/dev/null || :
-fi
+%if %{with_tests}
+%check
+phpunit \
+  --bootstrap PHP/Timer/Autoload.php \
+  -d date.timezone=UTC
+%endif
 
 
 %files
-%defattr(-,root,root,-)
-%{pear_xmldir}/%{name}.xml
-%{pear_phpdir}/PHP
+%doc LICENSE README.md composer.json
+%{php_home}
 
-%doc %{pear_docdir}/%{pear_name}
 
 %changelog
+* Wed Apr 23 2014 Remi Collet <remi at fedoraproject.org> - 1.0.5-2
+- get sources from github
+- run test suite when build --with tests
+
 * Sun Aug  4 2013 Christof Damian <christof at damian.net> - 1.0.5-1
 - upstream 1.0.5
 
diff --git a/sources b/sources
index 758f7cf..a68641b 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-d1dfcbb93695219785ce3f0b77e8210a  PHP_Timer-1.0.5.tgz
+714f9a194bcfbb407fb1ce16e4ff553f  php-timer-1.0.5.tar.gz


More information about the scm-commits mailing list