Sophie

Sophie

distrib > Fedora > 16 > i386 > by-pkgid > eb49281bdfe43c55227f3977396c71c3 > files > 7

bitten-0.6b3-0.3.fc16.src.rpm

# sitelib for noarch packages, sitearch for others (remove the unneeded one)
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}

%define username        bitten-slave
%define homedir         %_var/lib/%username
%if 0%{?fedora}
%define distro          Fedora
%define distrover       %{fedora}
%else
%define distro          RHEL
# {rhel} not defined!?
%if 0%{?rhel}
%define distrover       %{rhel}
%else
%define distrover       5
%endif
%endif

#define svnrev 777

Name:           bitten
Version:        0.6b3
Release:        0.3%{?dist}
Summary:        A continuous integration plugin for Trac
Group:          Development/Tools
License:        BSD
URL:            http://bitten.edgewall.org
# For SVN revisions:
# Source comes from SVN right now: svn co -r {svnrev} http://svn.edgewall.org/repos/bitten/trunk bitten; \
#                                  cd bitten; \
#                                  python setup.py sdist --formats gztar
# Source is now in the dist subdirectory.
Source0:        http://ftp.edgewall.com/pub/bitten/Bitten-%{version}.tar.gz
Source1:        bitten-slave.conf
Source2:        bitten-slave.init
Source3:        bitten-slave.sysconf
Source4:        bitten-slave.logrotate
Patch0:         Bitten-0.6dev-r777-git.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch:      noarch

Requires:       python-setuptools
BuildRequires:  python-devel
BuildRequires:  python-setuptools


%description
Bitten is a Python-based framework for collecting various software metrics via
continuous integration. It builds on Trac to provide an integrated web-based
user interface.

%if 0%{?fedora} > 0 || 0%{?rhel} > 5
%package master
Summary:        A continuous integration plugin for Trac
Group:          Development/Tools
Requires:       trac >= 0.11
Requires:       bitten-common

%description master
Bitten is a Python-based framework for collecting various software metrics via
continuous integration. It builds on Trac to provide an integrated web-based
user interface.

This package includes the Bitten master. It integrates into Trac and will
supply Bitten slaves with build orders.
%endif

%package common
Summary:        Common files for Bitten master and slave
Group:          Development/Libraries

%description common
This package contains files common to the Bitten build master and slave.


%package slave
Summary:          Bitten build slave
Group:            Development/Tools
Requires:         bitten-common
Requires(pre):    %{_sbindir}/useradd


%description slave
Bitten build slave.


%prep
#  -n Bitten-{version}dev-r{svnrev}
%setup -q -n Bitten-%{version}
%patch0 -p1 -b .git

%build
%{__python} setup.py build


%install
rm -rf $RPM_BUILD_ROOT
# skip-build doesn't work on el4
%{__python} setup.py install -O1 --root $RPM_BUILD_ROOT
# replaced by open alternative via patch 2
rm -rf $RPM_BUILD_ROOT%{python_sitelib}/bitten/htdocs/chart*
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}
mkdir -p $RPM_BUILD_ROOT%{_initrddir}
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
mkdir -p $RPM_BUILD_ROOT%{_var}/lib/bitten-slave
sed -e 's/@DISTRO@/%{distro}/g' -e 's/@DISTRO_VERSION@/%{distrover}/g'  %{SOURCE1} > $RPM_BUILD_ROOT%{_sysconfdir}/bitten-slave.conf
cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_initrddir}/bitten-slave
cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/bitten-slave
cp -p %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/bitten-slave

%if 0%{?fedora} == 0 && 0%{?rhel} <= 5
# Remove master files on RHEL 5 because its Trac version is too old
rm -f $RPM_BUILD_ROOT%{python_sitelib}/bitten/admin.py*
rm -f $RPM_BUILD_ROOT%{python_sitelib}/bitten/api.py*
rm -rf $RPM_BUILD_ROOT%{python_sitelib}/bitten/htdocs/
rm -f $RPM_BUILD_ROOT%{python_sitelib}/bitten/main.py*
rm -f $RPM_BUILD_ROOT%{python_sitelib}/bitten/master.py*
rm -f $RPM_BUILD_ROOT%{python_sitelib}/bitten/model.py*
rm -f $RPM_BUILD_ROOT%{python_sitelib}/bitten/notify.py*
rm -f $RPM_BUILD_ROOT%{python_sitelib}/bitten/queue.py*
rm -rf $RPM_BUILD_ROOT%{python_sitelib}/bitten/report/
rm -rf $RPM_BUILD_ROOT%{python_sitelib}/bitten/templates/
rm -f $RPM_BUILD_ROOT%{python_sitelib}/bitten/upgrades.py*
rm -f $RPM_BUILD_ROOT%{python_sitelib}/bitten/web_ui.py*
%endif

%clean
rm -rf $RPM_BUILD_ROOT

%post slave
if [ "$1" = "1" ]; then
  /sbin/chkconfig --add bitten-slave
fi

%pre slave
id '%username' >/dev/null 2>&1 || %{_sbindir}/useradd -r -d %homedir -m -s /sbin/nologin -c 'Bitten Slave' %username || :

%preun slave
if [ "$1" = "0" ]; then
  /sbin/chkconfig --del bitten-slave
fi

%postun slave
if [ "$1" = "0" ]; then
  # {_sbindir}/userdel -r username
  echo "Please remember to remove the user %{username} if no longer required."
fi

%files common
%defattr(-,root,root,-)
%dir %{python_sitelib}/bitten/
%doc COPYING README.txt ChangeLog doc/*.txt
# For noarch packages: sitelib
%{python_sitelib}/bitten/__init__.py*
%{python_sitelib}/bitten/build/api.py*
%{python_sitelib}/bitten/build/config.py*
%{python_sitelib}/bitten/build/__init__.py*
%{python_sitelib}/bitten/recipe.py*
%{python_sitelib}/bitten/util/
%{python_sitelib}/Bitten*/


%if 0%{?fedora} > 0 || 0%{?rhel} > 5

%files master
%defattr(-,root,root,-)
# For noarch packages: sitelib
%{python_sitelib}/bitten/admin.py*
%{python_sitelib}/bitten/api.py*
%{python_sitelib}/bitten/htdocs/
%{python_sitelib}/bitten/main.py*
%{python_sitelib}/bitten/master.py*
%{python_sitelib}/bitten/model.py*
%{python_sitelib}/bitten/notify.py*
%{python_sitelib}/bitten/queue.py*
%{python_sitelib}/bitten/report/
%{python_sitelib}/bitten/templates/
%{python_sitelib}/bitten/upgrades.py*
%{python_sitelib}/bitten/web_ui.py*

%endif

%files slave
%defattr(-,root,root,-)
# For noarch packages: sitelib
%config(noreplace) %attr(640,%username,%username) %{_sysconfdir}/bitten-slave.conf
%config(noreplace) %{_sysconfdir}/sysconfig/bitten-slave
%config(noreplace) %{_sysconfdir}/logrotate.d/bitten-slave
%{_bindir}/bitten-slave
%{python_sitelib}/bitten/slave.py*
%{python_sitelib}/bitten/build/*tools.py*
%attr(0755,root,root) %{_initrddir}/bitten-slave
%dir %attr(-,%username,%username) %{_var}/lib/bitten-slave

%changelog
* Mon Feb 21 2011 Tim Niemueller <timn@fedoraproject.org> 0.6b3-0.3
- Do not build master package on el5 (requires Trac 0.11+)

* Sat Feb 19 2011 Tim Niemueller <timn@fedoraproject.org> 0.6b3-0.2
- Instead of removing the user on deinstall, simply print reminder

* Sun Jan 23 2011 Tim Niemueller <timn@fedoraproject.org> 0.6b3-0.1
- Update to 0.6b3
- Drop typo and charts patches (applied)

* Tue Oct 27 2009 Tim Niemueller <timn@fedoraproject.org> 0.6-0.3.svn777
- Replace closed source charting library with open alternative

* Sat Oct 24 2009 Tim Niemueller <timn@fedoraproject.org> 0.6-0.2.svn777
- Added new git patch (rewritten and tested)
- Added patch for small but annoying typo

* Wed Oct 14 2009 Tim Niemueller <timn@fedoraproject.org> 0.6-0.1.svn777
- Upgrade to latest 0.6 version from svn
- Added patch for git support

* Mon Jul 13 2009 Tim Niemueller <timn@fedoraproject.org> 0.6svn519-0.6
- Rebuild for F-11
- Add patch for Python 2.6

* Tue Jan 29 2008 Tim Niemueller <timn@fedoraprojdect.org> 0.6svn519-0.5
- Release is now 0.5 to allow seemless upgrade for final 0.6
- Updated config file to not have the homedir as builddir, in some situations
  the homedir should survive, for example to be able to have a .subversion
  dir for auth credentials or a .ccache

* Sat Jan 26 2008 Tim Niemueller <timn@fedoraprojdect.org> 0.6svn519-4
- Added ignore-rmtree-error patch
- Rename master package to bitten-master
- Added init script
- Added config files
- Create custom user for bitten-slave
- Added bitten-slave builddir
- Added logrotate config

* Mon Jan 14 2008 Tim Niemueller <timn@fedoraprojdect.org> 0.6svn519-3
- Added config generalization patch
- Fixes to form-login patch to make it work, support for storing
  credentials in config file
- Provide example config file

* Tue Jan 08 2008 Tim Niemueller <timn@fedoraprojdect.org> 0.6svn519-2
- Moved some files from slave to common
- Added form-login patch from #219

* Mon Jan 07 2008 Tim Niemueller <timn@fedoraprojdect.org> 0.6svn519-1
- Initial revision based on trac-git-plugin spec file