Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > media > contrib-release-src > by-pkgid > cca252d7f92ce1ef70ebf26b2d024c7b > files > 2

rt-3.6.6-1mdv2008.1.src.rpm

#
# Copyright (c) 2005 Ralf Corsepius, Ulm, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#

Name:		rt
Version:	3.6.6
Release:	%mkrel 1
Summary:	A enterprise-grade ticketing system
Group:		Networking/WWW
License:	GPL
URL:		http://www.bestpractical.com/rt
Source0:	http://download.bestpractical.com/pub/rt/release/%{name}-%{version}.tar.gz
BuildArch:	noarch
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root

BuildRequires:	perl
BuildRequires:	apache

Requires(pre):    rpm-helper
Requires(postun): rpm-helper

# rpm doesn't catch these, because they are in template
Requires: perl-Apache-Session
Requires: perl-URI
Requires: perl-Regexp-Common
Requires: perl-libwww-perl
Requires: perl-Module-Versions-Report
Requires: perl-Locale-Maketext-Fuzzy
Requires: perl-HTML-Mason

%define _provides_exceptions   perl(HTML::Mason\\|perl(Log::Dispatch\\|perl(Session
# Encode::compat is needed for perl < 5.8
%define _requires_exceptions   perl(RT::Tickets_Overlay_SQL)\\|perl(Encode::compat)

%description
RT is an enterprise-grade ticketing system which enables a group of people
to intelligently and efficiently manage tasks, issues, and requests submitted
by a community of users.


%package client
Summary: Request Tracker command line interface
Group:		Networking/WWW

%description client
rt is a tool to create, modify and query a Request Tracker system using the 
commannd line. It can be used trough http on another server.

%package mail-gateway
Summary: Request Tracker mail gateway 
Group:		Networking/WWW

%description mail-gateway
rt-mailgate is a command that should be added in mail server alias, to create,
modify a Request Tracker system by sending mail.
 

%prep
%setup -q -n rt-%{version}

# Fixup the tarball shipping with broken permissions
find . \( -name '*.pm' -o -name '*.pm.in' -o -name '*.po' -o -name '*.pod' \) \
  -exec chmod a-x {} \;
chmod -x UPGRADING README C* aclocal.* config.* *.ac *.in

perl -pi -e 's/Set\(\$WebPath//' etc/RT_Config.pm.in
 
echo "Set($WebPath , "/rt3");" >> etc/RT_Config.pm.in

# Patch backups added by rpm disturb
#find -name '*.orig' -exec rm -f {} \;

# Propagate rpm's directories to config.layout
cat << \EOF >> config.layout

<Layout Mandriva>
  prefix:		%{_prefix}
  exec_prefix:		%{_exec_prefix}
  bindir:		%{_bindir}
  sbindir:		%{_sbindir}
  sysconfdir:		%{_sysconfdir}/%{name}
  datadir:		%{_datadir}
  mandir:		%{_mandir}
  libdir:		%{perl_vendorlib}
  manualdir:		${datadir}/doc
  localstatedir:	%{_localstatedir}
  htmldir:		    %{_localstatedir}/%{name}/html
  logfiledir:		${localstatedir}/log/%{name}
  masonstatedir:	${localstatedir}/lib/%{name}/mason_data
  sessionstatedir:	${localstatedir}/lib/%{name}/session_data
  customdir:		%{_localstatedir}/%{name}/custom/
  custometcdir:		%{_localstatedir}/%{name}/custom/etc/%{name}
  customhtmldir:	${customdir}/html
  customlexdir:		${customdir}/po
  customlibdir:		${customdir}/lib
</Layout>
EOF

# Comment out the Makefile trying to change groups/owners
# Fix DESTDIR support
sed -i \
	-e 's,	chgrp,	: chrgp,g' \
	-e 's,	chown,	: chown,g' \
	-e 's,$(DESTDIR)/,$(DESTDIR),g' \
Makefile.in

%build
./configure \
--with-apachectl=/usr/sbin/apachectl \
--without-speedycgi \
--with-rt-user=rt --with-rt-group=rt \
--with-web-user=apache --with-web-group=apache \
--enable-layout=Mandriva --with-modperl2

# Generate man-pages
/usr/bin/pod2man bin/rt-mailgate > bin/rt-mailgate.1
/usr/bin/pod2man bin/mason_handler.fcgi > bin/mason_handler.fcgi.1

%install
rm -rf ${RPM_BUILD_ROOT}
make install DESTDIR=${RPM_BUILD_ROOT}

# Cleanup the mess rt's configuration leaves behind
rm -f ${RPM_BUILD_ROOT}%{_docdir}/README

# Win32 stuff
rm -f ${RPM_BUILD_ROOT}%{_bindir}/mason_handler.svc

# We don't want CPAN
rm -f ${RPM_BUILD_ROOT}%{_sbindir}/rt-test-dependencies

# An installed testsuite without infrastructure
rm -rf ${RPM_BUILD_ROOT}%{perl_vendorlib}/t

# Bogus
rm -f ${RPM_BUILD_ROOT}%{perl_vendorlib}/RT.pm.in

# Unsupported
rm -f ${RPM_BUILD_ROOT}%{%_bindir}/*.scgi

# Install apache configuration
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/httpd/conf/webapps.d/
cat > $RPM_BUILD_ROOT/%{_sysconfdir}/httpd/conf/webapps.d/%{name}.conf <<EOF
# if you change it here, do not forget to change it
# in /etc/rt/RT_Config.pm too ( $WebPath )
Alias /rt3 "%{_localstatedir}/%{name}/html"

PerlRequire %{_bindir}/webmux.pl

<Directory "%{_localstatedir}/%{name}/html">
  AllowOverride All
  Options ExecCGI FollowSymLinks
  Order allow,deny
  Allow from all
  RewriteEngine On
  AddDefaultCharset UTF-8
  SetHandler perl-script
  PerlHandler RT::Mason
</Directory>
EOF

mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man1
install -m 0644 bin/rt-mailgate.1 bin/mason_handler.fcgi.1 \
  ${RPM_BUILD_ROOT}%{_mandir}/man1

install -d -m755 ${RPM_BUILD_ROOT}%_localstatedir/%{name}/custom/etc/%{name}
install -d -m755 ${RPM_BUILD_ROOT}%_localstatedir/%{name}/custom/html
install -d -m755 ${RPM_BUILD_ROOT}%_localstatedir/%{name}/custom/po
install -d -m755 ${RPM_BUILD_ROOT}%_localstatedir/%{name}/custom/lib

# Fix permissions
find ${RPM_BUILD_ROOT}%_localstatedir/%{name}/html/ \
  -type f -exec chmod a-x {} \;

cat >README.Mandriva <<EOF
In order to finish the setup of rt, you need to : 
 - complete the configuration file ( /etc/rt/RT_Config.pm )
 - run as root :  rt-setup-database  --action init --dba root --prompt-for-dba-password
 - rt is now accessible from http://localhost/rt3/. You can change this in 
   %{_sysconfdir}/httpd/conf/webapps.d/%{name}.conf

You can use %_localstatedir/%{name}/custom/ to customise it.
EOF

%check
# The tests don't work:
# - Require to be run as root
# - Require an operational rt3 system
#make test

%clean
rm -rf ${RPM_BUILD_ROOT}

%pre
%_pre_useradd %{name} %{_localstatedir}/lib/rt /sbin/nologin

%postun
%_postun_userdel %{name}

%files
%defattr(-,root,root,-)
%doc COPYING README UPGRADING 
%doc README.Mandriva
%{_bindir}/*
%exclude %{_bindir}/rt
%exclude %{_bindir}/rt-mailgate
%{_sbindir}/*
%{_mandir}/man1/*
%exclude %{_mandir}/man1/rt-mailgate*
%{perl_vendorlib}/*

%dir %{_sysconfdir}/%{name}
%attr(0644,root,root) %{_sysconfdir}/%{name}/acl*
%attr(0644,root,root) %{_sysconfdir}/%{name}/schema*
%attr(0644,root,root) %{_sysconfdir}/%{name}/init*
%config(noreplace) %attr(0640,root,root) %{_sysconfdir}/%{name}/RT_*

%config(noreplace) %{_sysconfdir}/httpd/conf/webapps.d/%{name}.conf

%{_localstatedir}/%{name}/
%attr(0770,apache,apache) %{_localstatedir}/lib/%{name}/mason_data
%attr(0770,apache,apache) %{_localstatedir}/lib/%{name}/session_data

%files  client
%{_bindir}/rt

%files mail-gateway
%{_bindir}/rt-mailgate
%{_mandir}/man1/rt-mailgate*




%changelog
* Sun Mar 02 2008 Michael Scherer <misc@mandriva.org> 3.6.6-1mdv2008.1
+ Revision: 177648
- new version
- switch to gz
- requires apache, instead of apache2, as we did the switch

  + Olivier Blin <oblin@mandriva.com>
    - restore BuildRoot

  + Thierry Vignaud <tvignaud@mandriva.com>
    - kill re-definition of %%buildroot on Pixel's request


* Fri Feb 09 2007 Michael Scherer <misc@mandriva.org> 3.6.3-1mdv2007.0
+ Revision: 118341
- update to 3.6.3
- Import rt

* Fri Jul 21 2006 Michael Scherer <misc@mandriva.org> 3.4.5-1mdv2007.0
- New version 3.4.5

* Fri Jan 06 2006 Michael Scherer <misc@mandriva.org> 3.4.4-2mdk
- remove the ifModule line from apache config file, as reported by Anne Nicolas
- complete the Readme.Mandriva file
- remove dependencie that are now detected by the script
- correct rpmlint error

* Sat Oct 15 2005 Michael Scherer <misc@mandriva.org> 3.4.4-1mdk
- first package, based on fedora package from Ralf Corsépius <rc040203@freenet.de> 
- Birthday build for rgs \o/