File trac.spec of Package trac

#
# spec file for package trac
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2007-2010 Herbert Graeber
# Copyright (c) 2009-2010 Pascal Bleser
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           trac
Version:        1.0.8
Release:        0
Summary:        Integrated SCM, Wiki, Issue Tracker and Project Environment
License:        BSD-3-Clause
Group:          Development/Tools/Other
Url:            http://trac.edgewall.com
Source0:        http://download.edgewall.org/trac/Trac-%{version}.tar.gz
Source1:        tracd.init
Source2:        tracd.sysconfig
Source3:        trac.conf
Source4:        README.SUSE.html
Source5:        trac24.conf
Source99:       trac-rpmlintrc
BuildRequires:  python-babel >= 0.9.5
BuildRequires:  python-devel >= 2.3
BuildRequires:  python-genshi >= 0.6
BuildRequires:  python-setuptools >= 0.6
Requires:       python-babel >= 0.9.5
Requires:       python-configobj
Requires:       python-genshi >= 0.6
Requires:       python-pygments
Requires:       python-setuptools >= 0.6
Requires:       python-tz
Provides:       trac-webadmin = 0.1.2-7
Obsoletes:      trac-webadmin < 0.1.2-7
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%py_requires
%if 0%{?suse_version} > 1110
BuildArch:      noarch
%endif
%if 0%{?suse_version} > 1020
BuildRequires:  fdupes
%endif

%description
Trac is a minimalistic web-based software project management and bug/issue
tracking system. It provides an interface to the Subversion revision control
systems, an integrated wiki, flexible issue tracking and convenient report
facilities.

%package server
Summary:        Trac standalone Server
Group:          Development/Tools/Other
Requires:       %{name} = %{version}
# FIXME: use proper Requires(pre/post/preun/...)
PreReq:         %insserv_prereq %fillup_prereq

%description server
The Trac standalone server. Do not use this for production.

%prep
%setup -q -n "Trac-%{version}"
cp %{SOURCE4} .
sed -i 's/\r//' contrib/trac-svn-post-commit-hook.cmd

%build
CFLAGS="%{optflags}" python setup.py build
CFLAGS="%{optflags}" python setup.py compile_catalog

%install
python setup.py install --root=%{buildroot} --prefix=%{_prefix} --record-rpm=INSTALLED_FILES
install -Dm 0755 contrib/cgi-bin/trac.cgi %{buildroot}%{_datadir}/%{name}/cgi-bin/trac.cgi
install -Dm 0755 contrib/cgi-bin/trac.fcgi %{buildroot}%{_datadir}/%{name}/cgi-bin/trac.fcgi
mkdir -p "%{buildroot}/%{_sysconfdir}/apache2/conf.d"
%if 0%{?suse_version} >= 1320
cp -a "%{SOURCE5}" "%{buildroot}/%{_sysconfdir}/apache2/conf.d/trac.conf"
%else
cp -a "%{SOURCE3}" "%{buildroot}/%{_sysconfdir}/apache2/conf.d/trac.conf"
%endif
install -dm 0750 %{buildroot}/srv/trac
install -Dm 0755 %{SOURCE1} %{buildroot}%{_sysconfdir}/init.d/tracd
install -dm 0755 %{buildroot}%{_sbindir}
ln -s %{_sysconfdir}/init.d/tracd %{buildroot}%{_sbindir}/rctracd
install -Dm 0600 %{SOURCE2} %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.tracd

%if 0%{?suse_version} > 1020
%fdupes %{buildroot}/%{_prefix}
%endif

%pre
# save the trac.ini from /usr/share/trac/conf if it exists...
if [ "$1" -ge 2 ]; then
  if [ \! -e %{_sysconfdir}/trac/trac.ini -a -r %{_datadir}/trac/conf/trac.ini ]; then
    if [ \! -e %{_sysconfdir}/trac ]; then mkdir %{_sysconfdir}/trac; fi
    mv %{_datadir}/trac/conf/trac.ini %{_sysconfdir}/trac/trac.ini.backup
  fi
fi

%preun server
%stop_on_removal tracd

%postun server
%restart_on_update tracd
%insserv_cleanup

%post
# ... and save it as new try.ini in /etc/trac.ini if this doesn't exist
if [ "$1" -ge 2 ]; then
  if [ -r %{_sysconfdir}/trac/trac.ini.backup ]; then
    mv %{_sysconfdir}/trac/trac.ini %{_sysconfdir}/trac/trac.ini.rpmnew
    mv %{_sysconfdir}/trac/trac.ini.backup %{_sysconfdir}/trac/trac.ini
  fi
fi

%post server
%fillup_and_insserv -n tracd tracd

%files -f INSTALLED_FILES
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING README README.SUSE.html RELEASE THANKS UPGRADE contrib
%exclude %{_bindir}/tracd
%dir %{_sysconfdir}/apache2
%dir %{_sysconfdir}/apache2/conf.d
%config(noreplace) %{_sysconfdir}/apache2/conf.d/trac.conf
%{_datadir}/%{name}
%attr(0750,root,www) /srv/trac

%files server
%defattr(-,root,root)
%{_sysconfdir}/init.d/tracd
%{_bindir}/tracd
%{_sbindir}/rctracd
%{_var}/adm/fillup-templates/sysconfig.tracd

%changelog

openSUSE Build Service is sponsored by