%{!?__pear: %{expand: %%global __pear %{_bindir}/pear}}
%define pear_name Net_FTP
Name: php-pear-Net-FTP
Version: 1.3.4
Release: 1%{?dist}
Summary: Provides an OO interface to the PHP FTP functions plus some additions
Group: Development/Libraries
License: PHP
URL: http://pear.php.net/package/Net_FTP
Source0: http://pear.php.net/get/%{pear_name}-%{version}.tgz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: php-pear >= 1:1.4.9-1.2 dos2unix
Requires: php-pear(PEAR) >= 1.3.0
Requires(post): %{__pear}
Requires(postun): %{__pear}
Provides: php-pear(%{pear_name}) = %{version}
%description
Net_FTP allows you to communicate with FTP servers in a more comfortable
way than the native FTP functions of PHP do. The class implements everything
nativly supported by PHP and additionally features like recursive up- and
downloading, dircreation and chmodding. It although implements an observer
pattern to allow for example the view of a progress bar.
%prep
%setup -q -c
[ -f package2.xml ] || mv package.xml package2.xml
mv package2.xml %{pear_name}-%{version}/%{pear_name}.xml
cd %{pear_name}-%{version}
%build
cd %{pear_name}-%{version}
# Empty build section, most likely nothing required.
%install
rm -rf $RPM_BUILD_ROOT docdir
cd %{pear_name}-%{version}
%{__pear} install --nodeps --packagingroot $RPM_BUILD_ROOT %{pear_name}.xml
# Move documentation
mv $RPM_BUILD_ROOT%{pear_docdir}/%{pear_name} ../docdir
# Fix rpmlint warnings
dos2unix ../docdir/example/observer.php
# Clean up unnecessary files
rm -rf $RPM_BUILD_ROOT%{pear_phpdir}/.??*
# Install XML package description
mkdir -p $RPM_BUILD_ROOT%{pear_xmldir}
install -pm 644 %{pear_name}.xml $RPM_BUILD_ROOT%{pear_xmldir}
%clean
rm -rf $RPM_BUILD_ROOT
%post
%{__pear} install --nodeps --soft --force --register-only \
%{pear_xmldir}/%{pear_name}.xml >/dev/null || :
%postun
if [ $1 -eq 0 ] ; then
%{__pear} uninstall --nodeps --ignore-errors --register-only \
%{pear_name} >/dev/null || :
fi
%files
%defattr(-,root,root,-)
%doc docdir/example %{pear_name}-%{version}/CHANGELOG
%{pear_xmldir}/%{pear_name}.xml
%{pear_phpdir}/Net
%{pear_testdir}/Net_FTP
%{pear_datadir}/Net_FTP
%check
# yum install php-pear-Net-FTP
# yum install php-pear-PHPUnit # (tested with 3.1.8)
# cd /usr/share/pear/test/Net_FTP
# cp config.php.dist config.php
# vi config.php
# php AllTests.php
# should display : OK (8 tests)
%changelog
* Tue Dec 11 2007 Remi Collet <Fedora@FamilleCollet.com> 1.3.4-1
- new version
* Thu Dec 6 2007 Remi Collet <Fedora@FamilleCollet.com> 1.3.3-1
- new version
- fix license
- add %%check (for documentation only)
* Sun Nov 5 2006 Remi Collet <Fedora@FamilleCollet.com> 1.3.2-1
- initial RPM (generated specfile + cleanup)
- add CHANGELOG and LICENSE