%{!?__pear: %{expand: %%global __pear /usr/bin/pear5}}
%global pear_name Log

Summary:	Abstracted logging facility for PHP
Name:		php-pear-Log
Version:	1.12.7
Release:	1%{?_dist_release}
License:	MIT
Group:		Development/Libraries
Source		http://pear.php.net/get/Log-%{version}.tgz
Source2:	xml2changelog

BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
URL:		http://pear.php.net/package/Log

BuildArch:	noarch
## Vine's php5-pear is a subpackage from php5 (internal version 1.9.4)
BuildRequires:	php-pear(PEAR) >= 1.4.9
Requires:	php-pear(PEAR) >= 1.4.9
Requires:	php-pear
Requires:	php-pear(DB) >= 1.3
Requires:	php-pear(MDB2) >= 2.0.0
Requires:	php-pear(Mail)
Requires(post):	%{__pear}
Requires(postun): %{__pear}
Provides:	php-pear(Log) = %{version}


%description
The Log framework provides an abstracted logging system. 
It supports logging to console, file, syslog, SQL, Sqlite, mail, and mcal
targets.  It also provides a subject - observer mechanism.

php-pear-Log can optionally use package "php-pear-DB" (version >= 1.3)
and "php-pear-MDB2" (version >= 2.0.0RC1).


%prep
%setup -c -q
%{_bindir}/php -n %{SOURCE2} package.xml | tee CHANGELOG | head -n 10

cd %{pear_name}-%{version}
# package.xml is V2
mv ../package.xml %{name}.xml


%build
# Empty build section


%install
rm -rf %{buildroot}

pushd Log-%{version}
%{__pear} install --nodeps --packagingroot %{buildroot} %{name}.xml

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

# Install XML package description
install -D -p -m 644 %{name}.xml %{buildroot}%{pear_xmldir}/%{name}.xml

popd


%clean
rm -rf %{buildroot}


%check
lst=$(find %{buildroot}%{pear_phpdir} -exec grep -q %{buildroot} {} \; -print)
[ ! -z "$lst" ] && echo "Reference to BUILDROOT in $lst" && exit 1;

cd %{pear_name}-%{version}
%{__pear} \
   run-tests \
   -i "-d include_path=%{buildroot}%{pear_phpdir}:%{pear_phpdir}" \
   tests | tee ../tests.log
grep "FAILED TESTS" ../tests.log && exit 1


%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


%files
%defattr(-,root,root,-)
%doc CHANGELOG
%doc %{pear_docdir}/%{pear_name}
%{pear_phpdir}/Log
%{pear_phpdir}/Log.php
%{pear_testdir}/Log
%{pear_datadir}/Log
%{pear_xmldir}/%{name}.xml


%changelog
* Tue Mar 13 2012 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 1.12.7-1
- initial build for Vine Linux

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

* Thu Sep 22 2011 Remi Collet <Fedora@FamilleCollet.com> 1.12.7-1
- Version 1.12.7 (stable) - API 1.0.0 (stable)
- minor spec cleanups

* Fri May 27 2011 Remi Collet <Fedora@FamilleCollet.com> 1.12.6-1
- Version 1.12.6 (stable) - API 1.0.0 (stable)

* Sun Apr 17 2011 Remi Collet <Fedora@FamilleCollet.com> 1.12.5-4
- remove temporary link in doc

* Wed Mar 16 2011 Remi Collet <Fedora@FamilleCollet.com> 1.12.5-3
- doc in %%{pear_docdir}

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

* Fri Dec 23 2010 Remi Collet <Fedora@FamilleCollet.com> 1.12.5-1
- Version 1.12.5 (stable) - API 1.0.0 (stable)

* Mon Dec  6 2010 Remi Collet <Fedora@FamilleCollet.com> 1.12.4-1.1
- levels.phpt fails, see http://pear.php.net/bugs/18099

* Mon Dec  6 2010 Remi Collet <Fedora@FamilleCollet.com> 1.12.4-1
- Version 1.12.4 (stable) - API 1.0.0 (stable)

* Tue Sep 28 2010 Remi Collet <Fedora@FamilleCollet.com> 1.12.3-1
- Version 1.12.3 (stable) - API 1.0.0 (stable)
- run tests during %%check

* Sun Aug 29 2010 Remi Collet <Fedora@FamilleCollet.com> 1.12.2-1
- Version 1.12.2 (stable) - API 1.0.0 (stable)

* Sat May 29 2010 Remi Collet <Fedora@FamilleCollet.com> 1.12.1-1
- bump release (missing sources)

* Sat May 29 2010 Remi Collet <Fedora@FamilleCollet.com> 1.12.1-1
- update to Version 1.12.1 (stable) - API 1.0.0 (stable)
- type in french description

* Mon Jan 25 2010 Remi Collet <Fedora@FamilleCollet.com> 1.12.0-1
- update to 1.12.0

* Sat Dec 26 2009 Remi Collet <Fedora@FamilleCollet.com> 1.11.6-1
- update to 1.11.6

* Sat Aug 08 2009 Remi Collet <Fedora@FamilleCollet.com> 1.11.5-1
- update to 1.11.5
- rename Log.xml to php-pear-Log.xml

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

* Mon Mar 30 2009 Remi Collet <Fedora@FamilleCollet.com> 1.11.4-1
- update to 1.11.4

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

* Sat Nov 22 2008 Remi Collet <Fedora@FamilleCollet.com> 1.11.3-1
- update to 1.11.3

* Fri Sep 05 2008 Remi Collet <Fedora@FamilleCollet.com> 1.11.2-1
- update to 1.11.2

* Wed Aug 06 2008 Remi Collet <Fedora@FamilleCollet.com> 1.11.1-1
- update to 1.11.1

* Sat Jun 28 2008 Remi Collet <Fedora@FamilleCollet.com> 1.11.0-1
- update to 1.11.0 : switch from PHP to MIT license

* Thu May 08 2008 Remi Collet <Fedora@FamilleCollet.com> 1.10.1-1
- update to 1.10.1

* Sat Jan 26 2008 Remi Collet <Fedora@FamilleCollet.com> 1.10.0-1
- update to 1.10.0
- add Requires php-pear(Mail) (new handler)
- remove levels.patch (merged upstream)

* Sat Jan 26 2008 Remi Collet <Fedora@FamilleCollet.com> 1.9.16-1
- update to 1.9.16
- add examples in documentation
- add levels.patch http://pear.php.net/bugs/bug.php?id=12933

* Wed Jan 02 2008 Remi Collet <Fedora@FamilleCollet.com> 1.9.14-1
- update to 1.9.14

* Thu Dec 13 2007 Remi Collet <Fedora@FamilleCollet.com> 1.9.13-1
- update to 1.9.13
- add documentation in %%check (post install only)

* Wed Dec 12 2007 Remi Collet <Fedora@FamilleCollet.com> 1.9.12-1
- update to 1.9.12

* Fri Aug 24 2007 Remi Collet <Fedora@FamilleCollet.com> 1.9.11-2
- Fix License

* Sat May 02 2007 Remi Collet <Fedora@FamilleCollet.com> 1.9.11-1
- update to 1.9.11

* Mon Feb 12 2007 Remi Collet <Fedora@FamilleCollet.com> 1.9.10-1
- update to 1.9.10
- All tests succeed with php-5.2.x : http://pear.php.net/bugs/bug.php?id=9023

* Sat Oct 28 2006 Remi Collet <Fedora@FamilleCollet.com> 1.9.9-1
- update to 1.9.9

* Sat Sep 16 2006 Remi Collet <Fedora@FamilleCollet.com> 1.9.8-6
- add CHANGELOG to %%doc

* Fri Sep 07 2006 Remi Collet <Fedora@FamilleCollet.com> 1.9.8-5.fc5.1
- rebuild for FC5

* Thu Sep 07 2006 Remi Collet <Fedora@FamilleCollet.com> 1.9.8-5
- BR php-pear >= 1:1.4.9-1.2

* Thu Sep 07 2006 Remi Collet <Fedora@FamilleCollet.com> 1.9.8-4
- last template.spec

* Mon Sep 04 2006 Remi Collet <Fedora@FamilleCollet.com> 1.9.8-3
- new and simpler %%prep and %%install

* Sat Sep 02 2006 Remi Collet <Fedora@FamilleCollet.com> 1.9.8-2
- failsafe scriplet

* Tue Aug 01 2006 Remi Collet <Fedora@FamilleCollet.com> 1.9.8-1
- update to 1.9.8

* Tue Jul 11 2006 Remi Collet <Fedora@FamilleCollet.com> 1.9.7-1
- update to 1.9.7
- use new macros from /etc/rpm/macros.pear

* Tue May 30 2006 Remi Collet <Fedora@FamilleCollet.com> 1.9.6-1
- install Licence in prep
- update to 1.9.6

* Mon May 15 2006 Remi Collet <Fedora@FamilleCollet.com> 1.9.5-3
- Require pear >= 1.4.9
- Requires(hint): (only comment actually) + description
- bundle the v3.01 PHP LICENSE file (as in php-pear)
- use --packagingroot (instead of -R)
- check from install to check (as in php-pear)

* Sat May 06 2006 Remi Collet <Fedora@FamilleCollet.com> 1.9.5-2
- cleanning (description-line-too-long)

* Sat May 06 2006 Remi Collet <Fedora@FamilleCollet.com> 1.9.5-1
- use %%{_datadir}/pear/.pkgxml for XML (Bug #190252)
- update to 1.9.5
- workaround for buggy pear 1.4.6 installer

* Thu Apr 27 2006 Remi Collet <Fedora@FamilleCollet.com> 1.9.4-1
- spec for extras
- add french summary & description

* Wed Apr 26 2006 Remi Collet <rpms@FamilleCollet.com> 1.9.4-1.fc{3,4,5}.remi
- update to 1.9.4

* Thu Apr 06 2006 Remi Collet <rpms@FamilleCollet.com> 1.9.3-1.fc{3,4,5}.remi
- initial RPM
