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

Name:           php-pear-Event-Dispatcher
Version:        1.1.0
Release:        4%{?dist}
Summary:        Dispatch notifications using PHP callbacks

Group:          Development/Libraries
License:        BSD
URL:            http://pear.php.net/package/Event_Dispatcher
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
Requires:       php-pear(PEAR)
Requires(post): %{__pear}
Requires(postun): %{__pear}
Provides:       php-pear(%{pear_name}) = %{version}


%description
The Event_Dispatcher acts as a notification dispatch table.
It is used to notify other objects of interesting things. This 
information is encapsulated in Event_Notification objects. Client 
objects register themselves with the Event_Dispatcher as observers of
specific notifications posted by other objects. When an event occurs, 
an object posts an appropriate notification to the Event_Dispatcher.
The Event_Dispatcher dispatches a message to each registered 
observer, passing the notification as the sole argument.
 


%prep
%setup -q -c
# package.xml is V2
%{_bindir}/php -n %{SOURCE2} package.xml >CHANGELOG
mv package.xml %{pear_name}-%{version}/%{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 %{name}.xml

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


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


%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
# For documentation purpose, tested with PHPUnit 3.3.16
# After install :
# cd /usr/share/pear/test/Event_Dispatcher/tests
# php AllTests.php
# Should retourn : OK (2 tests, 21 assertions)


%files
%defattr(-,root,root,-)
%doc CHANGELOG %{pear_name}-%{version}/docdir/%{pear_name}/*
%{pear_xmldir}/%{name}.xml
%{pear_phpdir}/Event
%{pear_testdir}/%{pear_name}


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

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

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

* Wed Jul 29 2009 Remi Collet <Fedora@FamilleCollet.com> 1.1.0-1
- update to 1.1.0

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

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

* Thu Aug 21 2008 Remi Collet <Fedora@FamilleCollet.com> 1.0.0-2
- Add missing Requires: php-pear(PEAR)

* Tue Jul 08 2008 Remi Collet <Fedora@FamilleCollet.com> 1.0.0-1
- initial RPM