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

Name:           php-pear-MDB2
Version:        2.3.0
Release:        1%{?dist}
Summary:        Database Abstraction Layer

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

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

%description
PEAR::MDB2 is a merge of the PEAR::DB and Metabase php database abstraction
layers.

It provides a common API for all supported RDBMS. The main difference to most
other DB abstraction packages is that MDB2 goes much further to ensure
portability.


%prep
%setup -q -c
[ -f package2.xml ] || mv package.xml package2.xml
mv package2.xml %{ClassName}-%{version}/%{ClassName}.xml
cd %{ClassName}-%{version}


%build
cd %{ClassName}-%{version}
# Empty build section, most likely nothing required.


%install
cd %{ClassName}-%{version}
rm -rf $RPM_BUILD_ROOT docdir
%{__pear} install --nodeps --packagingroot $RPM_BUILD_ROOT %{ClassName}.xml

# Move documentation
mkdir -p docdir
mv $RPM_BUILD_ROOT%{pear_docdir}/* docdir
mv $RPM_BUILD_ROOT%{pear_datadir}/%{ClassName}/LICENSE docdir/%{ClassName}/docs

# 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 %{ClassName}.xml $RPM_BUILD_ROOT%{pear_xmldir}


%clean
rm -rf $RPM_BUILD_ROOT


%post
%{__pear} install --nodeps --soft --force --register-only \
    %{pear_xmldir}/%{ClassName}.xml >/dev/null ||:

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


%files
%defattr(-,root,root,-)
%doc %{ClassName}-%{version}/docdir/%{ClassName}/docs/*
%{pear_xmldir}/%{ClassName}.xml
%{pear_testdir}/%{ClassName}
%{pear_phpdir}/%{ClassName}
%{pear_phpdir}/MDB2.php


%changelog
* Tue Nov 21 2006 Christopher Stone <chris.stone@gmail.com> 2.3.0-1
- Upstream sync
- Move LICENSE file from %%{pear_datadir} to %%doc

* Thu Sep 07 2006 Christopher Stone <chris.stone@gmail.com> 2.2.2-2
- Sync up with latest pear template

* Wed Sep 06 2006 Christopher Stone <chris.stone@gmail.com> 2.2.2-1
- Upstream sync
- Update spec to latest template

* Sun Sep 03 2006 Christopher Stone <chris.stone@gmail.com> 2.1.0-4
- Update to latest template

* Thu Jun 29 2006 Christopher Stone <chris.stone@gmail.com> 2.1.0-3
- Remove some hacks, clean up spec file

* Wed Jun 28 2006 Christopher Stone <chris.stone@gmail.com> 2.1.0-2
- Remove %%build section since it is not used

* Mon Jun 26 2006 Christopher Stone <chris.stone@gmail.com> 2.1.0-1
- Initial Release