summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--php-phpunit-diff.spec76
1 files changed, 34 insertions, 42 deletions
diff --git a/php-phpunit-diff.spec b/php-phpunit-diff.spec
index 831cf6f..66407f3 100644
--- a/php-phpunit-diff.spec
+++ b/php-phpunit-diff.spec
@@ -6,33 +6,35 @@
#
# Please, preserve the changelog entries
#
-%{!?pear_metadir: %global pear_metadir %{pear_phpdir}}
-%{!?__pear: %{expand: %%global __pear %{_bindir}/pear}}
-%global pear_name Diff
+%global gh_commit 1e091702a5a38e6b4c1ba9ca816e3dd343df2e2d
+%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
+%global gh_owner sebastianbergmann
+%global gh_project diff
+%global php_home %{_datadir}/php/SebastianBergmann
+%global pear_name Diff
%global pear_channel pear.phpunit.de
+# Circular dependency with phpunit
+%global with_tests %{?_with_tests:1}%{!?_with_tests:0}
Name: php-phpunit-diff
Version: 1.1.0
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: Diff implementation
Group: Development/Libraries
License: BSD
-URL: https://github.com/sebastianbergmann/diff
-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
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: php(language) >= 5.3.3
-BuildRequires: php-pear(PEAR) >= 1.9.4
-BuildRequires: php-channel(%{pear_channel})
+%if %{with_tests}
+BuildRequires: %{_bindir}/phpunit
+%endif
-Requires(post): %{__pear}
-Requires(postun): %{__pear}
-# from package.xml
+# from composer.json
Requires: php(language) >= 5.3.3
-Requires: php-pear(PEAR) >= 1.9.4
-Requires: php-channel(%{pear_channel})
# from phpcompatinfo report for version 1.1.0
Requires: php-pcre
Requires: php-spl
@@ -40,62 +42,52 @@ Requires: php-spl
Provides: php-pear(%{pear_channel}/%{pear_name}) = %{version}
# Package have be renamed
Obsoletes: php-phpunit-Diff < 1.1.0-2
-Provides: php-phpunit-Diff = %{name}-%{version}
+Provides: php-phpunit-Diff = %{version}-%{release}
%description
Diff implementation.
%prep
-%setup -q -c
-
-cd %{pear_name}-%{version}
-mv ../package.xml %{name}.xml
+%setup -q -n %{gh_project}-%{gh_commit}
%build
-cd %{pear_name}-%{version}
# Empty build section, most likely nothing required.
%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 src %{buildroot}%{php_home}/%{pear_name}
-# 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
+%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 \
- %{pear_channel}/%{pear_name} >/dev/null || :
-fi
-
-
%files
%defattr(-,root,root,-)
-%doc %{pear_docdir}/%{pear_name}
-%{pear_xmldir}/%{name}.xml
-%dir %{pear_phpdir}/SebastianBergmann
-%{pear_phpdir}/SebastianBergmann/%{pear_name}
+%doc LICENSE README.md composer.json
+
+%dir %{php_home}
+%{php_home}/%{pear_name}
%changelog
+* Wed Apr 23 2014 Remi Collet <remi@fedoraproject.org> - 1.1.0-3
+- get sources from github
+- run test suite when build --with tests
+
* Sun Oct 20 2013 Remi Collet <remi@fedoraproject.org> - 1.1.0-2
- rename to lowercase