Blob Blame History Raw
# $Id$

%global pkgdir        %{_datadir}/%{name}
%global cfgdir        %{_sysconfdir}/%{name}
%global httpconfdir    %{_sysconfdir}/httpd/conf.d

Summary:    Web-based bugtracking system
Name:       mantis
Version:    1.0.8
Release:    1%{?dist}
License:    GPL
Group:      Applications/Internet
URL:        http://www.mantisbt.org/
BuildArch:  noarch
Source0:    http://downloads.sourceforge.net/mantisbt/%{name}-%{version}.tar.gz
Source1:    mantis-README.Fedora

Patch0:     mantis-1.0.0a3-iis.patch
Patch1:     mantis-0.19.2-noexamplecom.patch
Patch2:     mantis-1.0.0rc2-noadmin.patch
BuildRoot:  %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires: diffutils
Requires:   php
Requires:   mantis-config
Requires:   php-adodb

%package config-httpd
Summary:    Mantis configuration for Apache httpd
Group:      Applications/Internet
Source10:   mantis-httpd.conf
Provides:   mantis-config = httpd
Requires:   mantis = %{version}-%{release}
Requires:   %{httpconfdir}
Requires:   mod_ssl
Requires(post): httpd
Requires(postun): httpd


%description
Mantis is a web-based bugtracking system. 
It is written in the PHP scripting language and requires the MySQL
database and a webserver. Mantis has been installed on Windows, MacOS,
OS/2, and a variety of Unix operating systems. Any web browser should
be able to function as a client. It is released under the terms of the
GNU General Public License (GPL).

%description config-httpd
Mantis is a web-based bugtracking system.
This package contains configuration-files for Apache httpd 2.


%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1

cp %{SOURCE1} ./doc/README.Fedora

chmod -x *.php *.sample
rm -rf packages


%build


%install
rm -rf "${RPM_BUILD_ROOT}"

%{__install} -d -m755 ${RPM_BUILD_ROOT}%{pkgdir}
%{__install} -d -m755 ${RPM_BUILD_ROOT}%{cfgdir}

tar cf - . | tar xf - -C ${RPM_BUILD_ROOT}%{pkgdir}

# Remove adodb
rm -rf ${RPM_BUILD_ROOT}%{pkgdir}/core/adodb

find ${RPM_BUILD_ROOT} \( \
    -name '*.orig' -o -name '*.#.*' -o \
    -name '.cvsignore' \
    \) -print0 | xargs -0 rm -f

## Do not rename; the *existence* of this file will be checked to
## determine if mantis is offline
mv ${RPM_BUILD_ROOT}%{pkgdir}/mantis_offline.php.sample ${RPM_BUILD_ROOT}%{cfgdir}/
mv ${RPM_BUILD_ROOT}%{pkgdir}/config_inc.php.sample     ${RPM_BUILD_ROOT}%{cfgdir}/config_inc.php

for i in $(find ${RPM_BUILD_ROOT} -type f -regex '.*\.\(php\|txt\|gif\|png\|css\|htm\|dtd\|xsl\|sql\|js\|bak\|xml\|zip\)$' -perm +0111); do
    case $i in
        (*.php)
            if ! sed '1p;d' "$i" | grep -q '^#!'; then
               chmod a-x "$i"
            elif sed '1p;d' "$i" | grep -q '/usr/local/bin/php'; then
               sed -i -e '1s!/usr/local/bin/php!/usr/bin/php!' "$i"
            fi
            ;;
        (*.bak)        rm -f "$i";;
        (*)        chmod a-x "$i";;
    esac
done

chmod -x doc/* 
chmod -x ${RPM_BUILD_ROOT}%{pkgdir}/core/phpmailer/{README,LICENSE}

# Dangling symlink: when /etc/mantis/mantis_offline.php is present mantis is put offline
ln -s %{cfgdir}/mantis_offline.php ${RPM_BUILD_ROOT}%{pkgdir}/mantis_offline.php

%{__install} -d ${RPM_BUILD_ROOT}%{httpconfdir}
%{__install} -p -m644 %{SOURCE10} ${RPM_BUILD_ROOT}%{httpconfdir}/mantis.conf

# Remove doc dir
rm -rf ${RPM_BUILD_ROOT}%{pkgdir}/doc


%clean
rm -rf "${RPM_BUILD_ROOT}"


%post config-httpd
! /sbin/pidof httpd &>/dev/null || /usr/sbin/apachectl graceful || :

%postun config-httpd
! /sbin/pidof httpd &>/dev/null || /usr/sbin/apachectl graceful || :


%files
%defattr(-,root,root,-)
%{pkgdir}
%dir %{cfgdir}
%config(noreplace) %{cfgdir}/*
%doc doc/{LICENSE,ChangeLog,CREDITS,CUSTOMIZATION,README.Fedora}

%files config-httpd
%defattr(-,root,root,-)
%config(noreplace) %{httpconfdir}/*


%changelog
* Tue Jul  9 2007 Gianluca Sforna <giallu gmail com> - 1.0.8-1
- new upstream release
- add Require: php-adodb (and remove embedded one)
- remove duplicate docs

* Thu Apr  5 2007 Gianluca Sforna <giallu gmail com> - 1.0.7-1
- new upstream release
- drop upstreamed patch
- fix (most) rpmlint issues
- tweak Source0 URL
- remove config_inc.php symlink (config is now found via the MANTIS_CONFIG 
  environment variable)

* Tue Jan  9 2007 Gianluca Sforna <giallu gmail com> - 1.0.6-2
- Add some docs
- Add patch for BZ #219937
- Fix rpmlint messages for SRPM

* Thu Nov  2 2006 Gianluca Sforna <giallu gmail com> - 1.0.6-1
- updated to 1.0.6

* Tue Oct 10 2006 Gianluca Sforna <giallu gmail com> - 1.0.5-1
- updated to 1.0.5

* Sat May 20 2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 1.0.3-1
- updated to 1.0.3 (SECURITY)

* Wed Mar  8 2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 1.0.1-1
- updated to 1.0.1

* Sat Feb 18 2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 1.0.0-1
- updated to 1.0.0

* Fri Dec 23 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 1.0.0-0.1.rc4
- SECURITY: release 1.0.0rc4
- removed x-permission from most files
- rediffed

* Sat Jun 25 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 1.0.0
- updated to 1.0.0a3
- removed the part which created the psql-script; upstream has now a
  working PostgreSQL database creation script
- rediffed the -iis patch
- added patch to make upgrade functionionality partially working with
  PostgreSQL; this is not perfect as things like index creation will
  still fail

* Thu May 19 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0.19.2-2
- use %%dist instead of %%disttag

* Mon Mar  7 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0.19.2-1
- updated to 0.19.2
- rediffed patches
- removed dependency on php-mysql as it supports PostgreSQL also
- added inline-hack to generate a PostgreSQL database creation script

* Thu May 27 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.18.3-0.fdr.2
- ship doc/ in the program-directory instead of copying it into %%docdir
- modified shipped httpd configuration to disable admin/ directory
  explicitly and added some documentation there
- added noadmin patch to disable warning about existing admin/ directory;
  since this directory is disabled by httpd configuration
- lower restrictions on the required 'mantis-config' subpackage; use
  descriptive names as version instead of EVR
- restart 'httpd' after the upgrade
- preserve timestamps of the configuration files to avoid creation of
  .rpmnew files on every update

* Tue May 25 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> - 0:0.18.3-0.fdr.0.1
- updated to 0.18.2
- rediffed the patches

* Fri Aug 15 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> 0:0.18.0-0.fdr.0.2.a4
- use generic download-address for Source0

* Thu Jun 19 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> 0:0.18.0-0.fdr.0.1.a4
- applied the Fedora naming standard

* Thu Jun 19 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> 0:0.18.0-0.fdr.0.a4.2
- Initial build.