File mantisbt.spec of Package mantisbt
#
# spec file for package mantisbt
#
# Copyright (c) 2025 SUSE LLC and contributors
#
# 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 https://bugs.opensuse.org/
#
%define mantisbt_serverroot /srv/www/htdocs/%{name}
%define php_libdir %{_datadir}/php%(echo %{php_version}|sed -e 's/[\.].*//')
Name: mantisbt
Version: 2.27.3
Release: 0
Summary: A free popular web-based bugtracking system
License: GPL-2.0-or-later
Group: Productivity/Networking/Web/Servers
URL: https://www.mantisbt.org/
Source0: https://sourceforge.net/projects/%{name}/files/mantis-stable/%{version}/%{name}-%{version}.tar.gz
Source1: https://sourceforge.net/projects/%{name}/files/mantis-stable/%{version}/%{name}-%{version}.tar.gz.asc
Source2: %{name}.keyring
Source3: README.SUSE
BuildRequires: apache-rpm-macros
BuildRequires: fdupes
BuildRequires: php-devel
BuildRequires: php-mbstring
Requires: http_daemon
Requires: mod_php_any >= 7.4.0
Requires: php-ctype
Requires: php-fileinfo
Requires: php-gd
Requires: php-mbstring
Requires: php-mysql
Requires: php-session
Requires: php-soap
Provides: mantis = %{version}
BuildArch: noarch
%description
MantisBT is a free popular web-based bugtracking system. It is written in the
PHP scripting language and works with MySQL, MS SQL, and PostgreSQL databases
and a webserver. MantisBT has been installed on Windows, Linux, Mac OS,
OS/2, and others. Almost any web browser should be able to function as a client.
%prep
%setup -q
cp %{SOURCE3} doc/
# Remove not needed files..
rm -f \
core/adodb/drivers/adodb-sqlite.inc.php.bak \
.gitignore \
.imgbotconfig \
.mailmap \
scripts/travis_*.sh \
vendor/doctrine/instantiator/.scrutinizer.yml \
vendor/nikic/fast-route/.hhconfig \
vendor/sebastian/diff/.php_cs \
vendor/webmozart/assert/.composer-auth.json \
vendor/webmozart/assert/.styleci.yml
rm -rf vendor/pimple/pimple/ext
# unused scripts
rm -f vendor/adodb/adodb-php/scripts/*
rm -f vendor/doctrine/instantiator/.travis.install.sh
# the adodb server is not required but opens issue #CVE-2018-6382
rm -f vendor/adodb/adodb-php/server.php
%build
%install
mkdir -p %{buildroot}%{mantisbt_serverroot}
chmod 755 `find . -type d`
chmod 644 `find . -type f`
cp -pr . %{buildroot}%{mantisbt_serverroot}
# move installation files to shared directories, should not be available in
# running installations but is required for updates
mkdir -p %{buildroot}%{php_libdir}/%{name}
mv %{buildroot}%{mantisbt_serverroot}/admin %{buildroot}%{php_libdir}/%{name}/admin
%fdupes %{buildroot}%{mantisbt_serverroot}
%fdupes %{buildroot}%{php_libdir}%{name}
%post
if [ $1 > 1 ] ; then
if [ ! -e %{mantisbt_serverroot}/config/config_inc.php ] ; then
echo 'No upgradeable intstallation found'
exit 0
fi
echo 'Upgrade mantisbt installation'
if [ -e %{mantisbt_serverroot}/admin ] ; then
rm -rf %{mantisbt_serverroot}/admin
fi
cp -a %{php_libdir}/%{name}/admin %{mantisbt_serverroot}
pushd %{mantisbt_serverroot}/admin > /dev/null
php upgrade_unattended.php
popd > /dev/null
rm -rf %{mantisbt_serverroot}/admin
fi
%check
# can no run tests because tests are not packaged within the distribution
%files
%defattr(-, root, %{apache_group})
%dir /srv/www
%dir /srv/www/htdocs
%license doc/LICENSE
%doc doc/CREDITS
%doc doc/README.SUSE
%doc %{mantisbt_serverroot}/SECURITY.md
%doc %{mantisbt_serverroot}/README.md
%doc %{mantisbt_serverroot}/KEYS.md
%exclude %{mantisbt_serverroot}/phpunit.xml
%exclude %{mantisbt_serverroot}/vendor/nikic/fast-route/test
%exclude %{mantisbt_serverroot}/vendor/pimple/pimple/src/Pimple/Tests
%{mantisbt_serverroot}/*.php
%{mantisbt_serverroot}/*.sample
%{mantisbt_serverroot}/api/*
%{mantisbt_serverroot}/config/*
%{mantisbt_serverroot}/core/*
%{mantisbt_serverroot}/css/*
%{mantisbt_serverroot}/fonts/*
%{mantisbt_serverroot}/doc/*
%{mantisbt_serverroot}/images/*
%{mantisbt_serverroot}/js/*
%{mantisbt_serverroot}/lang/*
%{mantisbt_serverroot}/library/*
%{mantisbt_serverroot}/plugins/*
%{mantisbt_serverroot}/scripts/Web.config
%{mantisbt_serverroot}/scripts/README.md
%{mantisbt_serverroot}/config/.htaccess
%{mantisbt_serverroot}/core/.htaccess
%{mantisbt_serverroot}/fonts/.htaccess
%{mantisbt_serverroot}/lang/.htaccess
%{mantisbt_serverroot}/library/.htaccess
%{mantisbt_serverroot}/plugins/.htaccess
%{mantisbt_serverroot}/scripts/.htaccess
%attr(750, root, %{apache_group}) %{mantisbt_serverroot}/scripts/*.php
%dir %{mantisbt_serverroot}
%dir %{mantisbt_serverroot}/api
%dir %{mantisbt_serverroot}/config
%dir %{mantisbt_serverroot}/core
%dir %{mantisbt_serverroot}/css
%dir %{mantisbt_serverroot}/doc
%dir %{mantisbt_serverroot}/fonts
%dir %{mantisbt_serverroot}/images
%dir %{mantisbt_serverroot}/js
%dir %{mantisbt_serverroot}/lang
%dir %{mantisbt_serverroot}/library
%dir %{mantisbt_serverroot}/plugins
%dir %{mantisbt_serverroot}/scripts
%{mantisbt_serverroot}/vendor
%{php_libdir}/%{name}
%changelog