Accepting request 852594 from home:ecsos:server

- Use apache-rpm-macros.

OBS-URL: https://build.opensuse.org/request/show/852594
OBS-URL: https://build.opensuse.org/package/show/network:utilities/matomo?expand=0&rev=84
This commit is contained in:
Eric Schirra 2020-12-02 11:40:50 +00:00 committed by Git OBS Bridge
parent 9dce3b90e2
commit 85014c9d51
4 changed files with 60 additions and 65 deletions

View File

@ -3,7 +3,7 @@
# #
# without CLI # without CLI
#-5 * * * * wwwrun /usr/bin/php @ap_serverroot@/matomo/misc/cron/archive.php --url=http://localhost/matomo/ > /var/log/matomo/matomo-archive.log #-5 * * * * wwwrun /usr/bin/php @apache_serverroot@/matomo/misc/cron/archive.php --url=http://localhost/matomo/ > /var/log/matomo/matomo-archive.log
# with CLI # with CLI
-5 * * * * wwwrun /usr/bin/php @ap_serverroot@/matomo/console core:archive --url=http://localhost/matomo/ > /var/log/matomo/matomo-archive.log -5 * * * * wwwrun /usr/bin/php @apache_serverroot@/matomo/console core:archive --url=http://localhost/matomo/ > /var/log/matomo/matomo-archive.log

View File

@ -5,6 +5,6 @@ Description=Auto-Archiving of matomo Reports
Type=oneshot Type=oneshot
User=wwwrun User=wwwrun
Group=www Group=www
ExecStart=/bin/bash -ce "/usr/bin/php @ap_serverroot@/matomo/console core:archive --url=http://localhost/matomo/ >> /var/log/matomo/matomo-archive.log 2>&1" ExecStart=/bin/bash -ce "/usr/bin/php @apache_serverroot@/matomo/console core:archive --url=http://localhost/matomo/ >> /var/log/matomo/matomo-archive.log 2>&1"
#StandardOutput=file:/var/log/matomo/matomo-archive.log #StandardOutput=file:/var/log/matomo/matomo-archive.log
#StandardError=file:/var/log/matomo/matomo-archive.log #StandardError=file:/var/log/matomo/matomo-archive.log

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Dec 2 10:46:45 UTC 2020 - ecsos <ecsos@opensuse.org>
- Use apache-rpm-macros.
------------------------------------------------------------------- -------------------------------------------------------------------
Sat Nov 28 09:15:51 UTC 2020 - ecsos <ecsos@opensuse.org> Sat Nov 28 09:15:51 UTC 2020 - ecsos <ecsos@opensuse.org>

View File

@ -18,17 +18,6 @@
# See also http://en.opensuse.org/openSUSE:Specfile_guidelines # See also http://en.opensuse.org/openSUSE:Specfile_guidelines
%define apxs %{_sbindir}/apxs2
%define ap_sysconfdir %(%{apxs} -q SYSCONFDIR)
%define ap_serverroot %(%{apxs} -q PREFIX)
%if 0%{?suse_version}
%define ap_usr wwwrun
%define ap_grp www
%else
%define ap_usr nobody
%define ap_grp nogroup
%endif
%{!?_tmpfilesdir:%global _tmpfilesdir %{_prefix}/lib/tmpfiles.d} %{!?_tmpfilesdir:%global _tmpfilesdir %{_prefix}/lib/tmpfiles.d}
Name: matomo Name: matomo
@ -48,16 +37,17 @@ Source12: %{name}-archive.timer
Source13: %{name}.my.cnf Source13: %{name}.my.cnf
Source14: %{name}-tmpfile.conf Source14: %{name}-tmpfile.conf
Source99: %{name}.rpmlintrc Source99: %{name}.rpmlintrc
# PATCH-FIX-OPENSUSE: Don't show wrong message with wrong owner of %%{ap_serverroot}/%%{name} when disable enable_auto_update through package installation. # PATCH-FIX-OPENSUSE: Don't show wrong message with wrong owner of %%{apache_serverroot}/%%{name} when disable enable_auto_update through package installation.
Patch1: %{name}-package_update.patch Patch1: %{name}-package_update.patch
BuildArch: noarch BuildArch: noarch
%if 0%{?suse_version} >= 1500 %if 0%{?suse_version} >= 1500
Requires(pre): user(%ap_usr) Requires(pre): user(wwwrun)
Requires(pre): group(%ap_grp) Requires(pre): group(www)
%else %else
Requires(pre): aaa_base Requires(pre): aaa_base
%endif %endif
BuildRequires: apache2-devel BuildRequires: apache2-devel
BuildRequires: apache-rpm-macros
BuildRequires: cron BuildRequires: cron
BuildRequires: fdupes BuildRequires: fdupes
BuildRequires: logrotate BuildRequires: logrotate
@ -137,8 +127,8 @@ done
%install %install
# make directories # make directories
install -d -m0755 %{buildroot}/%{ap_serverroot}/%{name} install -d -m0755 %{buildroot}/%{apache_serverroot}/%{name}
install -d -m0755 %{buildroot}/%{ap_serverroot}/%{name}/tmp install -d -m0755 %{buildroot}/%{apache_serverroot}/%{name}/tmp
install -d -m0755 %{buildroot}/%{_sysconfdir}/%{name} install -d -m0755 %{buildroot}/%{_sysconfdir}/%{name}
install -d -m0755 %{buildroot}/%{_defaultdocdir}/%{name} install -d -m0755 %{buildroot}/%{_defaultdocdir}/%{name}
# copy src from build to buildroot # copy src from build to buildroot
@ -147,20 +137,20 @@ mv LEGALNOTICE %{buildroot}/%{_defaultdocdir}/%{name}
mv LICENSE %{buildroot}/%{_defaultdocdir}/%{name} mv LICENSE %{buildroot}/%{_defaultdocdir}/%{name}
mv "misc/How to install Matomo.html" %{buildroot}/%{_defaultdocdir}/%{name} mv "misc/How to install Matomo.html" %{buildroot}/%{_defaultdocdir}/%{name}
mv *md %{buildroot}/%{_defaultdocdir}/%{name} mv *md %{buildroot}/%{_defaultdocdir}/%{name}
cp -dR * %{buildroot}/%{ap_serverroot}/%{name} cp -dR * %{buildroot}/%{apache_serverroot}/%{name}
# install matomo.conf to apache conf.d # install matomo.conf to apache conf.d
mkdir -p %{buildroot}/%{ap_sysconfdir}/conf.d mkdir -p %{buildroot}/%{apache_sysconfdir}/conf.d
sed -e 's|__matomo_web__|%{ap_serverroot}/%{name}|g' \ sed -e 's|__matomo_web__|%{apache_serverroot}/%{name}|g' \
-e 's|__matomo_conf__|%{_sysconfdir}/%{name}|g' \ -e 's|__matomo_conf__|%{_sysconfdir}/%{name}|g' \
-e 's|__matomo_log__|/var/log/%{name}|g' \ -e 's|__matomo_log__|/var/log/%{name}|g' \
%{SOURCE2} > %{buildroot}/%{ap_sysconfdir}/conf.d/%{name}.conf %{SOURCE2} > %{buildroot}/%{apache_sysconfdir}/conf.d/%{name}.conf
# install logrotate # install logrotate
install -D -m0644 %{SOURCE3} %{buildroot}/%{_sysconfdir}/logrotate.d/%{name} install -D -m0644 %{SOURCE3} %{buildroot}/%{_sysconfdir}/logrotate.d/%{name}
# move config to etc/matomo and make symlink # move config to etc/matomo and make symlink
mv %{buildroot}/%{ap_serverroot}/%{name}/config/* \ mv %{buildroot}/%{apache_serverroot}/%{name}/config/* \
%{buildroot}/%{_sysconfdir}/%{name} %{buildroot}/%{_sysconfdir}/%{name}
rm -d %{buildroot}/%{ap_serverroot}/%{name}/config rm -d %{buildroot}/%{apache_serverroot}/%{name}/config
ln -s %{_sysconfdir}/%{name} %{buildroot}/%{ap_serverroot}/%{name}/config ln -s %{_sysconfdir}/%{name} %{buildroot}/%{apache_serverroot}/%{name}/config
# install cronscript and systemd-timer # install cronscript and systemd-timer
install -d -m 0755 %{buildroot}/%{_sysconfdir}/cron.d install -d -m 0755 %{buildroot}/%{_sysconfdir}/cron.d
install -d -m 0755 %{buildroot}/var/log/%{name} install -d -m 0755 %{buildroot}/var/log/%{name}
@ -168,8 +158,8 @@ install -D -m 0644 %{SOURCE10} %{buildroot}/%{_sysconfdir}/cron.d/%{name}-archiv
install -D -m 0644 %{SOURCE11} %{buildroot}%{_unitdir}/%{name}-archive.service install -D -m 0644 %{SOURCE11} %{buildroot}%{_unitdir}/%{name}-archive.service
install -D -m 0644 %{SOURCE12} %{buildroot}%{_unitdir}/%{name}-archive.timer install -D -m 0644 %{SOURCE12} %{buildroot}%{_unitdir}/%{name}-archive.timer
install -D -m 0644 %{SOURCE14} %{buildroot}%{_tmpfilesdir}/%{name}.conf install -D -m 0644 %{SOURCE14} %{buildroot}%{_tmpfilesdir}/%{name}.conf
sed -i -e 's|@ap_serverroot@|%{ap_serverroot}|g' %{buildroot}%{_sysconfdir}/cron.d/%{name}-archive sed -i -e 's|@apache_serverroot@|%{apache_serverroot}|g' %{buildroot}%{_sysconfdir}/cron.d/%{name}-archive
sed -i -e 's|@ap_serverroot@|%{ap_serverroot}|g' %{buildroot}%{_unitdir}/%{name}-archive.service sed -i -e 's|@apache_serverroot@|%{apache_serverroot}|g' %{buildroot}%{_unitdir}/%{name}-archive.service
# install changes for mariadb # install changes for mariadb
install -D -m0644 %{SOURCE13} %{buildroot}/%{_sysconfdir}/my.cnf.d/%{name}.my.cnf install -D -m0644 %{SOURCE13} %{buildroot}/%{_sysconfdir}/my.cnf.d/%{name}.my.cnf
@ -181,17 +171,17 @@ install -D -m0644 %{SOURCE13} %{buildroot}/%{_sysconfdir}/my.cnf.d/%{name}.my.cn
%post %post
# BSC#1154324 # BSC#1154324
# # # chown -R %{ap_usr}:%{ap_grp} %{ap_serverroot}/%{name} # # # chown -R %{apache_user}:%{apache_group} %{apache_serverroot}/%{name}
%service_add_post matomo-archive.timer matomo-archive.service apache2.service %service_add_post matomo-archive.timer matomo-archive.service apache2.service
%tmpfiles_create %{_tmpfilesdir}/%{name}.conf %tmpfiles_create %{_tmpfilesdir}/%{name}.conf
if [ $1 -gt 1 ]; then if [ $1 -gt 1 ]; then
# Update matomo if this is an upgrade $1 == 2 # Update matomo if this is an upgrade $1 == 2
echo "matomo: Update matomo:core..." echo "matomo: Update matomo:core..."
su wwwrun -s /bin/sh -c "%{_bindir}/php %{ap_serverroot}/%{name}/console config:set 'Tracker.record_statistics="0"'" || : su wwwrun -s /bin/sh -c "%{_bindir}/php %{apache_serverroot}/%{name}/console config:set 'Tracker.record_statistics="0"'" || :
su wwwrun -s /bin/sh -c "%{_bindir}/php %{ap_serverroot}/%{name}/console config:set 'General.maintenance_mode="1"'" || : su wwwrun -s /bin/sh -c "%{_bindir}/php %{apache_serverroot}/%{name}/console config:set 'General.maintenance_mode="1"'" || :
su wwwrun -s /bin/sh -c "%{_bindir}/php %{ap_serverroot}/%{name}/console core:update --yes" || : su wwwrun -s /bin/sh -c "%{_bindir}/php %{apache_serverroot}/%{name}/console core:update --yes" || :
su wwwrun -s /bin/sh -c "%{_bindir}/php %{ap_serverroot}/%{name}/console config:set 'General.maintenance_mode="0"'" || : su wwwrun -s /bin/sh -c "%{_bindir}/php %{apache_serverroot}/%{name}/console config:set 'General.maintenance_mode="0"'" || :
su wwwrun -s /bin/sh -c "%{_bindir}/php %{ap_serverroot}/%{name}/console config:set 'Tracker.record_statistics="1"'" || : su wwwrun -s /bin/sh -c "%{_bindir}/php %{apache_serverroot}/%{name}/console config:set 'Tracker.record_statistics="1"'" || :
: :
fi fi
@ -205,44 +195,44 @@ fi
%defattr(-,root,root,-) %defattr(-,root,root,-)
%dir %{_defaultdocdir}/%{name} %dir %{_defaultdocdir}/%{name}
%{_defaultdocdir}/%{name}/* %{_defaultdocdir}/%{name}/*
%config(noreplace) %{ap_sysconfdir}/conf.d/%{name}.conf %config(noreplace) %{apache_sysconfdir}/conf.d/%{name}.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name} %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%config(noreplace) %{_sysconfdir}/cron.d/%{name}-archive %config(noreplace) %{_sysconfdir}/cron.d/%{name}-archive
%config(noreplace) %{_sysconfdir}/my.cnf.d/%{name}.my.cnf %config(noreplace) %{_sysconfdir}/my.cnf.d/%{name}.my.cnf
%{_unitdir}/%{name}-archive.service %{_unitdir}/%{name}-archive.service
%{_unitdir}/%{name}-archive.timer %{_unitdir}/%{name}-archive.timer
%{_tmpfilesdir}/%{name}.conf %{_tmpfilesdir}/%{name}.conf
%dir %attr(0750,%{ap_usr},%{ap_grp}) %{_sysconfdir}/%{name} %dir %attr(0750,%{apache_user},%{apache_group}) %{_sysconfdir}/%{name}
%dir %attr(0750,%{ap_usr},%{ap_grp}) %{_sysconfdir}/%{name}/environment %dir %attr(0750,%{apache_user},%{apache_group}) %{_sysconfdir}/%{name}/environment
%attr(0640,%{ap_usr},%{ap_grp}) %{_sysconfdir}/%{name}/*.php %attr(0640,%{apache_user},%{apache_group}) %{_sysconfdir}/%{name}/*.php
%attr(0640,%{ap_usr},%{ap_grp}) %{_sysconfdir}/%{name}/environment/*.php %attr(0640,%{apache_user},%{apache_group}) %{_sysconfdir}/%{name}/environment/*.php
%ghost %attr(0750,%{ap_usr},%{ap_grp}) /run/%{name}_sessions %ghost %attr(0750,%{apache_user},%{apache_group}) /run/%{name}_sessions
%defattr(644,root,root,755) %defattr(644,root,root,755)
%dir %{ap_serverroot}/%{name} %dir %{apache_serverroot}/%{name}
%dir %attr(0750,%{ap_usr},%{ap_grp}) %{ap_serverroot}/%{name}/js %dir %attr(0750,%{apache_user},%{apache_group}) %{apache_serverroot}/%{name}/js
%dir %attr(0750,%{ap_usr},%{ap_grp}) %{ap_serverroot}/%{name}/misc %dir %attr(0750,%{apache_user},%{apache_group}) %{apache_serverroot}/%{name}/misc
%dir %attr(0750,%{ap_usr},%{ap_grp}) %{ap_serverroot}/%{name}/plugins %dir %attr(0750,%{apache_user},%{apache_group}) %{apache_serverroot}/%{name}/plugins
%dir %attr(0750,%{ap_usr},%{ap_grp}) %{ap_serverroot}/%{name}/tmp %dir %attr(0750,%{apache_user},%{apache_group}) %{apache_serverroot}/%{name}/tmp
%dir %attr(0750,%{ap_usr},%{ap_grp}) /var/log/%{name} %dir %attr(0750,%{apache_user},%{apache_group}) /var/log/%{name}
%config(noreplace) %attr(600,%{ap_usr},%{ap_grp}) %{_sysconfdir}/%{name}/*php %config(noreplace) %attr(600,%{apache_user},%{apache_group}) %{_sysconfdir}/%{name}/*php
%{_sysconfdir}/%{name}/environment/*php %{_sysconfdir}/%{name}/environment/*php
%attr(0644,%{ap_usr},%{ap_grp}) %{ap_serverroot}/%{name}/matomo.js %attr(0644,%{apache_user},%{apache_group}) %{apache_serverroot}/%{name}/matomo.js
%attr(0644,%{ap_usr},%{ap_grp}) %{ap_serverroot}/%{name}/piwik.js %attr(0644,%{apache_user},%{apache_group}) %{apache_serverroot}/%{name}/piwik.js
%attr(0644,%{ap_usr},%{ap_grp}) %{ap_serverroot}/%{name}/js/piwik.min.js %attr(0644,%{apache_user},%{apache_group}) %{apache_serverroot}/%{name}/js/piwik.min.js
%attr(0770,%{ap_usr},%{ap_grp}) %{ap_serverroot}/%{name}/console %attr(0770,%{apache_user},%{apache_group}) %{apache_serverroot}/%{name}/console
%attr(0770,%{ap_usr},%{ap_grp}) %{ap_serverroot}/%{name}/misc/cron/archive.sh %attr(0770,%{apache_user},%{apache_group}) %{apache_serverroot}/%{name}/misc/cron/archive.sh
%attr(0770,%{ap_usr},%{ap_grp}) %{ap_serverroot}/%{name}/misc/log-analytics/import_logs.py %attr(0770,%{apache_user},%{apache_group}) %{apache_serverroot}/%{name}/misc/log-analytics/import_logs.py
%attr(0770,%{ap_usr},%{ap_grp}) %{ap_serverroot}/%{name}/misc/composer/clean-xhprof.sh %attr(0770,%{apache_user},%{apache_group}) %{apache_serverroot}/%{name}/misc/composer/clean-xhprof.sh
%attr(0770,%{ap_usr},%{ap_grp}) %{ap_serverroot}/%{name}/misc/composer/build-xhprof.sh %attr(0770,%{apache_user},%{apache_group}) %{apache_serverroot}/%{name}/misc/composer/build-xhprof.sh
#%%attr(0770,%%{ap_usr},%%{ap_grp}) %%{ap_serverroot}/%%{name}/plugins/TestRunner/scripts/on_instance_launch.sh #%%attr(0770,%%{apache_user},%%{apache_group}) %%{apache_serverroot}/%%{name}/plugins/TestRunner/scripts/on_instance_launch.sh
%attr(0770,%{ap_usr},%{ap_grp}) %{ap_serverroot}/%{name}/vendor/leafo/lessphp/package.sh %attr(0770,%{apache_user},%{apache_group}) %{apache_serverroot}/%{name}/vendor/leafo/lessphp/package.sh
%attr(0770,%{ap_usr},%{ap_grp}) %{ap_serverroot}/%{name}/vendor/leafo/lessphp/lessify %attr(0770,%{apache_user},%{apache_group}) %{apache_serverroot}/%{name}/vendor/leafo/lessphp/lessify
%attr(0770,%{ap_usr},%{ap_grp}) %{ap_serverroot}/%{name}/vendor/leafo/lessphp/plessc %attr(0770,%{apache_user},%{apache_group}) %{apache_serverroot}/%{name}/vendor/leafo/lessphp/plessc
%attr(0770,%{ap_usr},%{ap_grp}) %{ap_serverroot}/%{name}/vendor/pear/archive_tar/sync-php4 %attr(0770,%{apache_user},%{apache_group}) %{apache_serverroot}/%{name}/vendor/pear/archive_tar/sync-php4
%attr(0770,%{ap_usr},%{ap_grp}) %{ap_serverroot}/%{name}/vendor/szymach/c-pchart/coverage.sh %attr(0770,%{apache_user},%{apache_group}) %{apache_serverroot}/%{name}/vendor/szymach/c-pchart/coverage.sh
%attr(0770,%{ap_usr},%{ap_grp}) %{ap_serverroot}/%{name}/vendor/tecnickcom/tcpdf/tools/tcpdf_addfont.php %attr(0770,%{apache_user},%{apache_group}) %{apache_serverroot}/%{name}/vendor/tecnickcom/tcpdf/tools/tcpdf_addfont.php
%attr(0770,%{ap_usr},%{ap_grp}) %{ap_serverroot}/%{name}/vendor/twig/twig/drupal_test.sh %attr(0770,%{apache_user},%{apache_group}) %{apache_serverroot}/%{name}/vendor/twig/twig/drupal_test.sh
%attr(0770,%{ap_usr},%{ap_grp}) %{ap_serverroot}/%{name}/vendor/matomo/matomo-php-tracker/run_tests.sh %attr(0770,%{apache_user},%{apache_group}) %{apache_serverroot}/%{name}/vendor/matomo/matomo-php-tracker/run_tests.sh
%{ap_serverroot}/%{name}/* %{apache_serverroot}/%{name}/*
%changelog %changelog