You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
php-pear-File-CSV/php-pear-File-CSV.spec

133 lines
3.3 KiB
Plaintext

%{!?pear_metadir: %global pear_metadir %{pear_phpdir}}
%{!?__pear: %{expand: %%global __pear %{_bindir}/pear}}
%global pear_name File_CSV
# Tests are only run with rpmbuild --with tests
# Can't be run in mock because of circular dependencies
%global with_tests %{?_with_tests:1}%{!?_with_tests:0}
Name: php-pear-File-CSV
Version: 1.0.0
Release: 6%{?dist}
Summary: Read and write of CSV files
Group: Development/Libraries
License: BSD
URL: http://pear.php.net/package/File_CSV
Source0: http://pear.php.net/get/File_CSV-%{version}.tgz
# https://pear.php.net/bugs/19255 patch fails with php 5.4
Patch0: file-csv-test.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: php-pear(PEAR) >= 1.7.0
%if %{with_tests}
BuildRequires: php-pear(File) >= 1.4.0
%endif
Requires(post): %{__pear}
Requires(postun): %{__pear}
Requires: php-pear(PEAR) >= 1.7.0
Requires: php-pear(File) >= 1.4.0
Provides: php-pear(%{pear_name}) = %{version}
%description
Read and write of CSV files as well as discovering the format the CSV file
is in.
Supports headers and is excel compatible, i.e. ="0004" outputs as 0004
(only read wise)
For more information on CSV: http://rfc.net/rfc4180.html
%prep
%setup -q -c
%patch0 -p0 -b .tests
cd %{pear_name}-%{version}
# Package is V2
mv ../package.xml %{name}.xml
%build
cd %{pear_name}-%{version}
# Empty build section, most likely nothing required.
%install
cd %{pear_name}-%{version}
rm -rf %{buildroot}
%{__pear} install --nodeps --packagingroot %{buildroot} %{name}.xml
# 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}
%check
cd %{pear_name}-%{version}
%if %{with_tests}
%{__pear} \
run-tests \
--recur \
--ini "-d include_path=%{buildroot}%{pear_phpdir}:%{pear_phpdir}" \
tests | tee ../tests.log
grep "FAILED TESTS" ../tests.log && exit 1
%else
echo 'Test suite disabled (missing "--with test" option)'
%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.php.net/%{pear_name} >/dev/null || :
fi
%files
%defattr(-,root,root,-)
%doc %{pear_docdir}/%{pear_name}
%{pear_xmldir}/%{name}.xml
%{pear_phpdir}/File/CSV.php
%{pear_testdir}/%{pear_name}
%changelog
* Tue Feb 19 2013 Remi Collet <remi@fedoraproject.org> - 1.0.0-6
- fix metadata location
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Tue Aug 14 2012 Remi Collet <remi@fedoraproject.org> - 1.0.0-4
- rebuilt for new pear_testdir
* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Mon Mar 05 2012 Remi Collet <remi@fedoraproject.org> - 1.0.0-2
- spec cleanups
- patch for test which fails with php 5.4
https://pear.php.net/bugs/19255
* Sat Mar 19 2011 Remi Collet <Fedora@FamilleCollet.com> - 1.0.0-1
- initial package