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

Name:           php-pear-Net-URL-Mapper
Version:        0.9.1
Release:        2%{?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
Source2:        xml2changelog

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch:      noarch
BuildRequires:  php-pear >= 1:1.4.9-1.2
# for tests
BuildRequires:  php-pear(pear.phpunit.de/PHPUnit)
BuildRequires:  php-pear(Net_URL) >= 1.0.14

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
%{_bindir}/php -n %{SOURCE2} package.xml | tee CHANGELOG | head -n 10

# Create a "localized" php.ini to avoid build warning
cp /etc/php.ini .
echo "date.timezone=UTC" >>php.ini

cd %{pear_name}-%{version}
# Package.xml 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 $RPM_BUILD_ROOT docdir
PHPRC=../php.ini %{__pear} install --nodeps --packagingroot $RPM_BUILD_ROOT %{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 %{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}/%{name}.xml >/dev/null || :

%postun
if [ $1 -eq 0 ] ; then
    %{__pear} uninstall --nodeps --ignore-errors --register-only \
        %{pear_name} >/dev/null || :
fi


%check
cd %{pear_name}-%{version}
phpunit \
   -d date.timezone=UTC \
   -d include_path=%{pear_phpdir}:$RPM_BUILD_ROOT%{pear_phpdir} \
   tests


%files
%defattr(-,root,root,-)
%doc CHANGELOG
%{pear_xmldir}/%{name}.xml
%{pear_testdir}/%{pear_name}
%{pear_datadir}/%{pear_name}
# Net_URL own Net but not Net/URL
%{pear_phpdir}/Net/URL
# Packaging stuff
%exclude %{_bindir}/*php


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

* Wed Oct 27 2010 Remi Collet <Fedora@FamilleCollet.com> - 0.9.1-1
- Version 0.9.1 (beta) - API 1.0.0 (stable)
- add generated Changelog
- run tests in %%check

* Wed Aug 18 2010 Remi Collet <Fedora@FamilleCollet.com> - 0.9.0-5
- rename Net_URL_Mapper.xml to php-pear-Net-URL-Mapper.xml
- set date.timezone during build
- clean define

* 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