# Conditional build:
%bcond_without order # with experimental order patch
-#define snap 20060921
-%define rev r3966
-%define rel 2.39
-#define _rc RC3
-
+%define php_min_version 5.1.2
+%define subver 4434
+%define rel 2.3
%include /usr/lib/rpm/macros.php
Summary: Eventum Issue / Bug tracking system
Summary(pl.UTF-8): Eventum - system śledzenia spraw/błędów
Name: eventum
-Version: 2.2
-Release: %{?_rc:%{_rc}.}%{rel}%{?snap:.%{snap}}%{?rev:.%{rev}}
+Version: 2.3.1
+#Release: %{rel}
+Release: %{rel}.bzr%{subver}
License: GPL
Group: Applications/WWW
-#Source0: http://downloads.mysql.com/snapshots/eventum/%{name}-nightly-%{snap}.tar.gz
-#Source0: http://eventum.mysql.org/downloads/eventum-2.0.RC3.tar.gz
-#Source0: http://mysql.easynet.be/Downloads/eventum/%{name}-%{version}.tar.gz
-# bzr branch lp:eventum eventum && tar -cjf eventum.tar.bz2 --exclude=.bzr --exclude=.bzrignore eventum
-Source0: %{name}-%{version}-dev-%{rev}.tar.gz
-# Source0-md5: 4ce83d59543ee2e3bfe530e5b4e7d29b
+#Source0: http://launchpad.net/eventum/trunk/%{version}/+download/%{name}-%{version}.tar.gz
+Source0: %{name}-%{version}-dev-r%{subver}.tar.gz
+# Source0-md5: 356e710384618aea1e6f3426a41dbc23
Source1: %{name}-apache.conf
Source2: %{name}-mail-queue.cron
Source3: %{name}-mail-download.cron
Source7: %{name}-irc.php
Source8: %{name}-irc.init
Source9: %{name}-irc.sysconfig
+Source10: sphinx.crontab
Source13: %{name}-router-postfix.sh
Source14: %{name}.logrotate
Source15: %{name}-lighttpd.conf
Source16: http://www.isocra.com/images/updown2.gif
# Source16-md5: deb6eeb2552ba757d3a949ed10c4107d
+Source17: %{name}.tmpfiles
Patch0: %{name}-lf.patch
Patch2: %{name}-order.patch
+Patch3: group-users.patch
# packaging patches that probably never go upstream
Patch100: %{name}-paths.patch
Patch101: %{name}-cvs-config.patch
BuildRequires: rpm-php-pearprov >= 4.0.2-98
BuildRequires: rpmbuild(macros) >= 1.461
BuildRequires: sed >= 4.0
-Requires(triggerpostun): /usr/bin/php
-Requires(triggerpostun): sed >= 4.0
Requires: %{name}-base = %{version}-%{release}
Requires: Smarty >= 2.6.10-4
-Requires: php-common >= 4:5.0
+Requires: php-common >= 4:%{php_min_version}
+Requires: php-filter
Requires: php-gd
Requires: php-iconv
Requires: php-imap
+Requires: php-json
Requires: php-mbstring
Requires: php-mysql
Requires: php-pcre
Requires: php-pear-DB
Requires: php-pear-Date
-Requires: php-pear-HTTP_Request
Requires: php-pear-Mail
Requires: php-pear-Mail_Mime
Requires: php-pear-Mail_mimeDecode
BuildArch: noarch
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
-%define _noautoreq 'pear(init.php)' 'pear(/etc/webapps/.*)' 'pear(%{_appdir}/.*)' 'pear(jpgraph_dir.php)' 'pear(.*Smarty.class.php)' 'pear(Services/JSON.php)'
+%define _noautopear pear(../init.php) pear(init.php) pear(/usr/share/eventum/init.php) pear(/etc/webapps/.*) pear(%{_appdir}/.*) pear(jpgraph_dir.php) pear(.*Smarty.class.php) pear(Services/JSON.php) pear(class.date_helper.php) pear(sphinxapi.php)
+
+# exclude optional php dependencies
+%define _noautophp php-gnupg php-hash php-pecl-http php-tk
+
+%define _noautoreq %{_noautophp} %{_noautopear}
%define _libdir %{_prefix}/lib/%{name}
%define _appdir %{_datadir}/%{name}
Group: Applications/WWW
Requires: %{name} = %{version}-%{release}
Requires: crondaemon
-Requires: php(posix)
+Requires: php-posix
%description monitor
The heartbeat monitor is a feature designed for the administrator that
Summary(pl.UTF-8): IRC-owy bot powiadamiający dla Eventum
Group: Applications/WWW
Requires(post,preun): /sbin/chkconfig
-Requires(triggerpostun): sed >= 4.0
Requires: %{name} = %{version}-%{release}
-Requires: php(sockets)
+Requires: php-sockets
Requires: php-pear-Net_SmartIRC
Requires: rc-scripts >= 0.4.0.18
Group: Applications/WWW
Requires: %{name}-base = %{version}-%{release}
Requires: php-cli
-Requires: php-common >= 4:5.0
+Requires: php-common >= 4:%{php_min_version}
Requires: php-pear-XML_RPC
%description cli
Group: Applications/WWW
Requires: %{name}-base = %{version}-%{release}
Requires: php-cli
-Requires: php-common >= 4:5.0
+Requires: php-common >= 4:%{php_min_version}
Requires: php-pcre
%description scm
Szczegóły na temat instalacji można przeczytać pod
</eventum/help.php?topic=scm_integration_installation>.
+%package sphinx
+Summary: Eventum Sphinx Search
+Group: Applications/WWW
+Requires: %{name} = %{version}-%{release}
+Requires: crondaemon
+Requires: sphinx
+
+%description sphinx
+Sphinx search integration for Eventum.
+
+This package contains the cron job.
+
%prep
%setup -q
+# GPL v2
+rm docs/COPYING
+
rm -r upgrade/*v1.[123]* # too old to support in PLD Linux
rm -r upgrade/v{1.,2.0,2.1_}* # no longer supported in PLD Linux
rm upgrade/flush_compiled_templates.php
# bug fixes / features
%patch0 -p1
%{?with_order:%patch2 -p1}
+%patch3 -p0
-cp -a %{SOURCE16} htdocs/images
+cp -p %{SOURCE16} htdocs/images
#%patch200 -p1
+# produce default sphinx config
+# must be run before paths.patch
+cat <<'EOF' > config/config.php
+<?php
+define('APP_SQL_DBTYPE', 'mysql');
+define('APP_SQL_DBHOST', 'localhost:/var/lib/mysql/mysql.sock');
+define('APP_SQL_DBPORT', 3306);
+define('APP_SQL_DBNAME', 'eventum');
+define('APP_SQL_DBUSER', 'mysql');
+define('APP_SQL_DBPASS', '');
+define('APP_TABLE_PREFIX', 'eventum_');
+EOF
+php config/sphinx.conf.php > config/sphinx.conf
+rm -f config/config.php
+
# packaging
%patch100 -p1
%patch101 -p1
%patch105 -p1
%patch107 -p1
-cat <<'EOF'> mysql-permissions.sql
-# use this schema if you want to grant permissions manually instead of using setup
-# this schema is extracted from setup/index.php.
-GRANT SELECT, UPDATE, DELETE, INSERT, ALTER, DROP, CREATE, INDEX ON eventum.* TO 'eventum'@'localhost' IDENTIFIED BY 'password';
-EOF
-
%{__sed} -i -e "
s;define('CONFIG_PATH'.*');define('CONFIG_PATH', '%{_webappdir}');
" upgrade/{*/,}*.php
-
-install -d examples
-for a in lib/eventum/*/*example*.php; do
- d=${a%/*} d=${d##lib/eventum/}
- f=${a##*/}
- install -d examples/$d
- mv $a examples/$d/$f
-done
-
# remove backups from patching as we use globs to package files to buildroot
find '(' -name '*~' -o -name '*.orig' ')' | xargs -r rm -v
rm -rf $RPM_BUILD_ROOT
install -d \
$RPM_BUILD_ROOT{%{_webappdir},%{_sysconfdir},%{_bindir},%{_sbindir},%{_libdir}} \
- $RPM_BUILD_ROOT/etc/{rc.d/init.d,cron.d,sysconfig} \
+ $RPM_BUILD_ROOT/etc/{rc.d/init.d,cron.d,logrotate.d,sysconfig} \
$RPM_BUILD_ROOT/var/{run,cache,lib}/%{name} \
$RPM_BUILD_ROOT/var/log/{archive/,}%{name} \
$RPM_BUILD_ROOT/var/lib/%{name}/routed_{emails,drafts,notes} \
$RPM_BUILD_ROOT%{_appdir}/{include,htdocs/misc,upgrade} \
+ $RPM_BUILD_ROOT/usr/lib/tmpfiles.d
%{__make} install-eventum install-cli install-irc install-scm install-jpgraph install-localization \
sysconfdir=%{_webappdir} \
%{?with_order:cp -a htdocs/ajax $RPM_BUILD_ROOT%{_appdir}/htdocs}
touch $RPM_BUILD_ROOT%{_webappdir}/htpasswd
-cp -a %{SOURCE1} $RPM_BUILD_ROOT%{_webappdir}/apache.conf
-cp -a %{SOURCE1} $RPM_BUILD_ROOT%{_webappdir}/httpd.conf
-cp -a %{SOURCE15} $RPM_BUILD_ROOT%{_webappdir}/lighttpd.conf
+cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_webappdir}/apache.conf
+cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_webappdir}/httpd.conf
+cp -p %{SOURCE15} $RPM_BUILD_ROOT%{_webappdir}/lighttpd.conf
-cp -a %{SOURCE2} $RPM_BUILD_ROOT/etc/cron.d/%{name}-mail-queue
-cp -a %{SOURCE3} $RPM_BUILD_ROOT/etc/cron.d/%{name}-mail-download
-cp -a %{SOURCE4} $RPM_BUILD_ROOT/etc/cron.d/%{name}-reminder
-cp -a %{SOURCE5} $RPM_BUILD_ROOT/etc/cron.d/%{name}-monitor
+install -d $RPM_BUILD_ROOT/etc/sphinx
+cp -p config/sphinx.conf $RPM_BUILD_ROOT/etc/sphinx/%{name}.conf
+cp -p config/sphinx.conf.php $RPM_BUILD_ROOT%{_webappdir}
-cp -a %{SOURCE7} $RPM_BUILD_ROOT%{_webappdir}/irc_config.php
+cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/cron.d/%{name}-mail-queue
+cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/cron.d/%{name}-mail-download
+cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/cron.d/%{name}-reminder
+cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/cron.d/%{name}-monitor
+cp -p %{SOURCE10} $RPM_BUILD_ROOT/etc/cron.d/%{name}-sphinx
-cp -a %{SOURCE8} $RPM_BUILD_ROOT/etc/rc.d/init.d/eventum-irc
-cp -a %{SOURCE9} $RPM_BUILD_ROOT/etc/sysconfig/eventum-irc
+cp -p %{SOURCE7} $RPM_BUILD_ROOT%{_webappdir}/irc_config.php
+
+install -p %{SOURCE8} $RPM_BUILD_ROOT/etc/rc.d/init.d/eventum-irc
+cp -p %{SOURCE9} $RPM_BUILD_ROOT/etc/sysconfig/eventum-irc
+
+cp -p %{SOURCE14} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
# postfix router
-install %{SOURCE13} $RPM_BUILD_ROOT%{_libdir}/router-postfix
+install -p %{SOURCE13} $RPM_BUILD_ROOT%{_libdir}/router-postfix
+
+install %{SOURCE17} $RPM_BUILD_ROOT/usr/lib/tmpfiles.d/%{name}.conf
-install -D %{SOURCE14} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
+%{__rm} -r $RPM_BUILD_ROOT%{_datadir}/locale/ht
%find_lang %{name}
# scm
-install %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/scm.php
+install -p %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/scm.php
# old compat
ln -s %{_sbindir}/eventum-cvs-hook $RPM_BUILD_ROOT%{_libdir}/process_cvs_commits
%addusertogroup http %{name}
%post
-# check if the package is configured.
-if grep -q "Header('Location: setup/')" %{_webappdir}/config.php; then
-if [ -f %{_appdir}/htdocs/setup/index.php ]; then
-%banner %{name} -e <<EOF
-
-You haven't yet configured Eventum!
-Please open in browser <http://localhost/eventum/>
-If you need access from elsewhere, you need to edit
-%{_webappdir}/apache.conf and restart apache.
-
-IMPORTANT: When You have configured Eventum, please uninstall the
-setup package, so that %{name}-setup is able to secure your Eventum
-installation.
-
-EOF
-#' vim syntax hack
-else
-%banner %{name} -e <<EOF
-
-You haven't yet configured Eventum!
-
-To setup eventum, please install %{name}-setup and open in browser
-<http://localhost/eventum/>.
-If you need access from elsewhere, you need to edit
-%{_webappdir}/*.conf depending on webserver and restart the webserver.
-
-IMPORTANT: When You have configured Eventum, please uninstall the
-setup package, so that %{name}-setup is able to secure your Eventum
-installation.
-
-EOF
-#' vim syntax hack
-fi
-
-elif grep -q 'DEFAULTPRIVATEKEY' %{_webappdir}/private_key.php; then
-%banner %{name} -e <<EOF
-
-You have default private key installed!
-
-Install %{name}-setup and open up http://yourserver/eventum/setup/
--- that will help you setup initial config.
-
-when have configured Eventum, please uninstall the setup package,
-so that %{name}-setup is able to secure your Eventum installation.
-
-EOF
- elif [ -d %{_appdir}/setup ]; then
-%banner %{name} -e <<EOF
-
-If you have have configured Eventum, please uninstall the setup package,
-so that %{name}-setup is able to secure your Eventum installation.
-
-EOF
-fi
-
# greate empty ghost files
for a in cli.log errors.log irc_bot.log login_attempts.log; do
if [ ! -f /var/log/%{name}/$a ]; then
- install -m620 -oroot -geventum /dev/null /var/log/%{name}/$a
+ install -m 0620 -o root -g eventum /dev/null /var/log/%{name}/$a
fi
done
# nuke Smarty templates cache after upgrade
rm -f /var/cache/eventum/*.php
+# Restart webserver on upgrade to get .mo translations reloaded.
+# actually php engines "php-fcgi" and "php-fpm" needed only, apache is restarted anyway via webapp trigger.
+%php_webserver_restart
+
%preun
if [ "$1" = "0" ]; then
# nuke cache
%post setup
chmod 660 %{_webappdir}/{config,private_key}.php
-chown root:eventum %{_webappdir}/{config,private_key}.php
+chown root:http %{_webappdir}/{config,private_key}.php
%postun setup
if [ "$1" = "0" ]; then
chmod 640 %{_webappdir}/{config,private_key}.php
- chown root:eventum %{_webappdir}/{config,private_key}.php
+ chown root:http %{_webappdir}/{config,private_key}.php
fi
%post irc
%triggerun -- lighttpd
%webapp_unregister lighttpd %{_webapp}
+%triggerpostun -- %{name} < 2.2-2.57
+# switching eventum->http user
+chgrp http %{_webappdir}/config.php
+chgrp http %{_webappdir}/private_key.php
+chgrp http %{_webappdir}/setup.php
+chgrp http /var/log/%{name}/*
+# update crontab user
+for a in /etc/cron.d/eventum-*; do
+ [ -f "$a" ] || continue
+ awk '!/#/ && NR > 6 && $6 =="eventum" {sub("eventum", "http", $6)}{print}' $a > $a.rpmtmp && cat $a.rpmtmp > $a
+ rm -f $a.rpmtmp
+
+ # crontabs moved to crons subdir
+ %{__sed} -i -e '
+ s,/usr/share/eventum/process_mail_queue.php,/usr/share/eventum/crons/process_mail_queue.php,
+ s,/usr/share/eventum/download_emails.php,/usr/share/eventum/crons/download_emails.php,
+ s,/usr/share/eventum/check_reminders.php,/usr/share/eventum/crons/check_reminders.php,
+ s,/usr/share/eventum/monitor.php,/usr/share/eventum/crons/monitor.php,
+ ' $a
+done
+
%files -f %{name}.lang
%defattr(644,root,root,755)
-%doc ChangeLog FAQ INSTALL README UPGRADE CONTRIB
-%doc docs/* examples htdocs/setup/schema.sql mysql-permissions.sql
+%doc docs/* htdocs/setup/schema.sql
%attr(751,root,root) %dir %{_webappdir}
%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webappdir}/apache.conf
%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webappdir}/httpd.conf
%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webappdir}/lighttpd.conf
-%attr(640,root,eventum) %config(noreplace) %verify(not md5 mtime size) %{_webappdir}/config.php
-%attr(640,root,eventum) %config(noreplace) %verify(not md5 mtime size) %{_webappdir}/private_key.php
-%attr(660,root,eventum) %config(noreplace) %verify(not md5 mtime size) %{_webappdir}/setup.php
+%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webappdir}/config.php
+%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webappdir}/private_key.php
+%attr(660,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webappdir}/setup.php
%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webappdir}/htpasswd
-%dir %attr(731,root,eventum) /var/log/%{name}
-%attr(620,root,eventum) %ghost /var/log/%{name}/*
+%dir %attr(731,root,http) /var/log/%{name}
+%attr(620,root,http) %ghost /var/log/%{name}/*
%dir %attr(750,root,root) /var/log/archive/%{name}
%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name}
+%dir %{_appdir}/crons
%{_appdir}/init.php
%dir %{_appdir}/htdocs
%{_appdir}/htdocs/*.php
%{_appdir}/lib/eventum
%{_appdir}/lib/jpgraph
%exclude %{_appdir}/lib/eventum/class.monitor.php
-
-%dir %attr(730,root,eventum) /var/run/%{name}
-%dir %attr(730,root,eventum) /var/cache/%{name}
+/usr/lib/tmpfiles.d/%{name}.conf
+%dir %attr(730,root,http) /var/run/%{name}
+%dir %attr(730,root,http) /var/cache/%{name}
%files base
%defattr(644,root,root,755)
%dir %{_appdir}
%dir /var/lib/%{name}
# saved mail copies
-%attr(770,root,eventum) %dir /var/lib/%{name}/routed_emails
-%attr(770,root,eventum) %dir /var/lib/%{name}/routed_drafts
-%attr(770,root,eventum) %dir /var/lib/%{name}/routed_notes
+%attr(770,root,http) %dir /var/lib/%{name}/routed_emails
+%attr(770,root,http) %dir /var/lib/%{name}/routed_drafts
+%attr(770,root,http) %dir /var/lib/%{name}/routed_notes
%files setup
%defattr(644,root,root,755)
%files mail-queue
%defattr(644,root,root,755)
-%attr(755,root,root) %{_appdir}/process_mail_queue.php
+%attr(755,root,root) %{_appdir}/crons/process_mail_queue.php
%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name}-mail-queue
%files mail-download
%defattr(644,root,root,755)
-%attr(755,root,root) %{_appdir}/download_emails.php
+%attr(755,root,root) %{_appdir}/crons/download_emails.php
%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name}-mail-download
%files reminder
%defattr(644,root,root,755)
-%attr(755,root,root) %{_appdir}/check_reminders.php
+%attr(755,root,root) %{_appdir}/crons/check_reminders.php
%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name}-reminder
%files monitor
%defattr(644,root,root,755)
%{_appdir}/lib/eventum/class.monitor.php
-%attr(755,root,root) %{_appdir}/monitor.php
+%attr(755,root,root) %{_appdir}/crons/monitor.php
%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name}-monitor
%files route-drafts
%attr(755,root,root) %{_libdir}/process_svn_commits
%attr(755,root,root) %{_sbindir}/eventum-cvs-hook
%attr(755,root,root) %{_sbindir}/eventum-svn-hook
+
+%files sphinx
+%defattr(644,root,root,755)
+%{_webappdir}/sphinx.conf.php
+%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) /etc/sphinx/%{name}.conf
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name}-sphinx