Blob Blame History Raw
%{!?__pear: %{expand: %%global __pear %{_bindir}/pear}}
%define pear_name Net_URL_Mapper

Name:           php-pear-Net-URL-Mapper
Version:        0.9.0
Release:        4%{?dist}
Summary:        Simple and flexible way to build nice URLs for web applications

Group:          Development/Languages
License:        BSD
URL:            http://pear.php.net/package/Net_URL_Mapper
Source0:        http://pear.php.net/get/%{pear_name}-%{version}.tgz
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

Patch0:         Net_URL_Mapper-tests.patch

BuildArch:      noarch
BuildRequires:  php-pear >= 1:1.4.9-1.2
BuildRequires:  php-pear-PHPUnit
Requires:       php-pear(PEAR)
Requires:       php-pear(Net_URL) >= 1.0.14
Requires(post): %{__pear}
Requires(postun): %{__pear}
Provides:       php-pear(%{pear_name}) = %{version}

%description
Net_URL_Mapper provides a simple and flexible way to build nice URLs for your
web applications.

The URL syntax is similar to what can be found in Ruby on Rails or Python
Routes module and as such, this package can be compared to what they call a
router. Still, Net_URL_Mapper does not perform the dispatching like these
frameworks and therefore can be used with your own router.


%prep
%setup -qc
%patch0 -p1

[ -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
cd %{pear_name}-%{version}
rm -rf $RPM_BUILD_ROOT docdir
%{__pear} install --nodeps --packagingroot $RPM_BUILD_ROOT %{pear_name}.xml

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

# Install XML package description
install -d $RPM_BUILD_ROOT%{pear_xmldir}
install -pm 644 %{pear_name}.xml $RPM_BUILD_ROOT%{pear_xmldir}

cd $RPM_BUILD_ROOT%{pear_testdir}/%{pear_name}

%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


%check
# check does not work under mock
#cd $RPM_BUILD_ROOT%{pear_testdir}/%{pear_name}/tests
#sh run


%files
%defattr(-,root,root,-)
%{pear_xmldir}/%{pear_name}.xml
%{pear_testdir}/%{pear_name}
%dir %{pear_phpdir}/Net/URL
%{pear_phpdir}/Net/URL/Mapper*


%changelog
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Sat Feb  9 2008 Christopher Stone <chris.stone@gmail.com> 0.9.0-2
- Add test file patch (bz #431955)

* Thu Feb  7 2008 Christopher Stone <chris.stone@gmail.com> 0.9.0-1
- Initial Fedora release