Sophie

Sophie

distrib > Fedora > 13 > i386 > media > updates-src > by-pkgid > 5a9ffc9bb0cba814afb31cd7706000c7 > files > 3

php-pear-File-Bittorrent2-1.3.1-5.fc13.src.rpm

%{!?__pear: %{expand: %%global __pear %{_bindir}/pear}}
%define pear_name File_Bittorrent2

Name:           php-pear-File-Bittorrent2
Version:        1.3.1
Release:        5%{?dist}
Summary:        Decode and Encode data in Bittorrent format

Group:          Development/Libraries
License:        LGPLv2
URL:            http://pear.php.net/package/File_Bittorrent2
Source0:        http://pear.php.net/get/%{pear_name}-%{version}.tgz
Patch0:         php-pear-File-Bittorrent-dos2unix.patch
# This patch modifies the md5sum in the xml file to match the files
# after they have been dos2unixed
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

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


%description
This package consists of three classes which handles the encoding and
decoding of data in Bittorrent format.  You can also extract useful
informations from .torrent files, create .torrent files and query the
torrent's scrape page to get its statistics.  PHP5 only.


%prep
%setup -q -c
%patch0 -p1 -b .dos2unix
[ -f package2.xml ] || mv package.xml package2.xml
mv package2.xml %{pear_name}-%{version}/%{pear_name}.xml
cd %{pear_name}-%{version}
dos2unix torrentinfo.php scrape.php example.php


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



#%check
#cd %{pear_name}-%{version}
#phpunit  Tests/AllTests.php


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


%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


%files
%defattr(-,root,root,-)
%doc %{pear_name}-%{version}/docdir/%{pear_name}/*

%{pear_xmldir}/%{pear_name}.xml
# TODO upstream: pear_testdir and pear_datadir; they are currently OK though,
#c caught by the below glob since they are withing pear_phpdir
# Expand this as needed to avoid owning dirs owned by our dependencies
#%{pear_phpdir}/*
%{pear_phpdir}/File
%{pear_testdir}/%{pear_name}


%changelog
* Sun Jun 20 2010 David Nalley <david@gnsa.us> - 1.3.1-5
- commenting out unittests to fix ftbfs

* Fri Jul 17 2009 David Nalley <david@gnsa.us> - 1.3.1-4
- fix test line to work regardless of path

* Fri Jul 17 2009 Paul W. Frields <stickster@gmail.com> - 1.3.1-3
- Fix a couple packaging problems

* Fri Jul 17 2009 David Nalley <david@gnsa.us>  1.3.1-2
- Added a checksum patch suggested by Paul Frields

* Thu Jul 16 2009 David Nalley <david@gnsa.us>  1.3.1-1
- Initial packaging