Blob Blame History Raw
%{!?__pear: %{expand: %%global __pear %{_bindir}/pear}}
%global pear_name   Net_URL2
%global with_tests  %{?_with_tests:1}%{!?_with_tests:0}

Name:           php-pear-Net-URL2
Version:        2.0.0
Release:        4%{?dist}
Summary:        Class for parsing and handling URL

Group:          Development/Libraries
License:        BSD
URL:            http://pear.php.net/package/Net_URL2
Source0:        http://pear.php.net/get/%{pear_name}-%{version}.tgz

# http://pear.php.net/bugs/bug.php?id=18921
Patch0:         %{name}.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch:      noarch
BuildRequires:  php-pear >= 1:1.4.9-1.2
%if %{with_tests}
BuildRequires:  php-phpunit-PHPUnit
%endif


Requires(post): %{__pear}
Requires(postun): %{__pear}
Provides:       php-pear(%{pear_name}) = %{version}
Requires:       php-pear(PEAR)


%description
Provides parsing of URLs into their constituent parts (scheme, host, path
etc.), URL generation, and resolving of relative URLs.


%prep
%setup -q -c

%patch0

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
rm -rf %{buildroot}
cd %{pear_name}-%{version}
%{__pear} install --nodeps --packagingroot %{buildroot} %{name}.xml

# Clean up unnecessary files
rm -rf %{buildroot}%{pear_phpdir}/.??*

# Install XML package description
mkdir -p %{buildroot}%{pear_xmldir}
install -pm 644 %{name}.xml %{buildroot}%{pear_xmldir}


%check
%if %{with_tests}
# test suite cannot run in mock (use network)
# Version 2.0.0 : OK (17 tests, 65 assertions)
cd %{buildroot}%{pear_testdir}/%{pear_name}/tests
phpunit \
   -d date.timezone=UTC \
   -d include_path=.:%{buildroot}%{pear_phpdir}:%{pear_phpdir}: \
   AllTests.php
%else
echo 'Test suite disabled (missing "--with tests" 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}/Net
%{pear_testdir}/%{pear_name}


%changelog
* Tue Aug 14 2012 Remi Collet <remi@fedoraproject.org> - 2.0.0-4
- rebuilt for new pear_testdir

* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Sat Oct 22 2011 Remi Collet <remi@fedoraproject.org> - 2.0.0-1
- Version 2.0.0 (stable) - API 2.0.0 (stable)
- add tests option to run tests during rpmbuild

* Mon Apr 18 2011 Remi Collet <Fedora@FamilleCollet.com> 0.3.1-4
- doc in /usr/share/doc/pear
- set date.timezone during build

* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Sat May 22 2010 Remi Collet <Fedora@FamilleCollet.com> 0.3.1-2
- spec cleanup

* Sun Jan 24 2010 Remi Collet <Fedora@FamilleCollet.com> 0.3.1-1
- update to 0.3.1

* Wed Nov 11 2009 Remi Collet <Fedora@FamilleCollet.com> 0.3.0-1
- initial RPM