From 48b4a88ef21c448197de397336eb368b209267a19e880fb3388fdd182e91b65d Mon Sep 17 00:00:00 2001 From: Lars Vogdt Date: Sun, 22 Dec 2019 19:03:52 +0000 Subject: [PATCH] Accepting request 758882 from home:lrupp:branches:server:php:applications Added: recommend php-imagick - remove more cruft from the source (like .tavis or .gitignore) - php documentor is not needed on a productive system -> remove - also fix /usr/bin/env calls for two vendor scripts - skins now have some configurable files in their directories: move those files over to /etc/roundcubemail/skins/ - move other text files (incl. vendor ones) out of the root directory (and handle the LICENSE file a bit different) - enable mod_filter and add AddOutputFilterByType for common media types like html, javascript or xml - enable php7 on newer openSUSE versions - enable deflate, expires, filter, headers and setenvif on a new installation - do not enable any module in case of an update - recommend php-imagick for additional features OBS-URL: https://build.opensuse.org/request/show/758882 OBS-URL: https://build.opensuse.org/package/show/server:php:applications/roundcubemail?expand=0&rev=128 --- roundcubemail-httpd.conf | 19 +++++++++ roundcubemail.changes | 17 ++++++++ roundcubemail.spec | 83 ++++++++++++++++++++++++++++++++-------- 3 files changed, 104 insertions(+), 15 deletions(-) diff --git a/roundcubemail-httpd.conf b/roundcubemail-httpd.conf index db9ad1f..5dd0f13 100644 --- a/roundcubemail-httpd.conf +++ b/roundcubemail-httpd.conf @@ -108,6 +108,25 @@ AddType text/x-component .htc SetOutputFilter DEFLATE + + AddOutputFilterByType DEFLATE application/javascript + AddOutputFilterByType DEFLATE application/x-javascript + AddOutputFilterByType DEFLATE application/xhtml+xml + AddOutputFilterByType DEFLATE application/xml + AddOutputFilterByType DEFLATE application/json + AddOutputFilterByType DEFLATE text/css + AddOutputFilterByType DEFLATE text/html + AddOutputFilterByType DEFLATE text/plain + AddOutputFilterByType DEFLATE text/x-component + AddOutputFilterByType DEFLATE text/xml + + SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary + BrowserMatch ^Mozilla/4 gzip-only-text/html + BrowserMatch ^Mozilla/4.0[678] no-gzip + BrowserMatch bMSIE !no-gzip !gzip-only-text/html + + + # for better privacy/security ask browsers to not set the Referer Header set Content-Security-Policy "referrer no-referrer" diff --git a/roundcubemail.changes b/roundcubemail.changes index e613bda..42e8a0b 100644 --- a/roundcubemail.changes +++ b/roundcubemail.changes @@ -1,3 +1,20 @@ +------------------------------------------------------------------- +Mon Dec 16 09:48:52 UTC 2019 - Lars Vogdt + +- remove more cruft from the source (like .tavis or .gitignore) +- php documentor is not needed on a productive system -> remove +- also fix /usr/bin/env calls for two vendor scripts +- skins now have some configurable files in their directories: + move those files over to /etc/roundcubemail/skins/ +- move other text files (incl. vendor ones) out of the root + directory (and handle the LICENSE file a bit different) +- enable mod_filter and add AddOutputFilterByType for common media + types like html, javascript or xml +- enable php7 on newer openSUSE versions +- enable deflate, expires, filter, headers and setenvif on a new + installation - do not enable any module in case of an update +- recommend php-imagick for additional features + ------------------------------------------------------------------- Fri Dec 6 14:39:12 UTC 2019 - Johannes Weberhofer diff --git a/roundcubemail.spec b/roundcubemail.spec index f8b5401..7676427 100644 --- a/roundcubemail.spec +++ b/roundcubemail.spec @@ -65,6 +65,7 @@ Requires: php_any_db Recommends: logrotate Recommends: php-fileinfo Recommends: php-intl +Recommends: php-imagick Recommends: php-mysql Recommends: php-pear-Crypt_GPG >= 1.6.3 Recommends: php-zip @@ -88,9 +89,19 @@ The user interface is skinnable using XHTML and CSS 2. %setup -q %patch0 -p1 cp %{SOURCE4} . - -# remove cruft from source archive -find . -name ".gitignore" -delete +# remove cruft from source archive: +# .arcconfig => file for phabricator.uri +# .gitignore => git config file +# .php_cs.dist => PhpCsFixer +# .scrutinizer.yml => PHP mess detector +# .travis.yml => Travis CI descriptions +for file in .arcconfig .gitignore .php_cs.dist .scrutinizer.yml .travis.yml ; do + find . -name "$file" -delete +done +# remove php documentor script +rm vendor/pear/net_smtp/phpdoc.sh +# remove 0-byte files +find . -size 0 -delete # no need to check .htaccess each time, the apache config takes care of the restrictions find . -name ".htaccess" -delete # remove travis files @@ -106,10 +117,9 @@ rm -rf \ sed -i '1d' plugins/password/helpers/chpass-wrapper.py # remove INSTALL doc rm INSTALL - # fix interpreter for shell scripts -sed -e 's|%{_bindir}/env php|%{_bindir}/php|' -i bin/*.sh - +sed -e 's|%{_bindir}/env php|%{_bindir}/php|' -i bin/*.sh +sed -e 's|%{_bindir}/env php|%{_bindir}/php|' -i vendor/pear/crypt_gpg/scripts/crypt-gpg-pinentry vendor/roundcube/plugin-installer/src/bin/rcubeinitdb.sh %build @@ -151,17 +161,38 @@ for PLUGIN in acl managesieve password; do fi done +# skins have some configurable files in their directories +mkdir -p %{buildroot}%{roundcubeconfigpath}/skins/elastic/styles +for file in _styles.less _variables.less ; do + mv %{buildroot}%{roundcubepath}/skins/elastic/styles/$file %{buildroot}%{roundcubeconfigpath}/skins/elastic/styles/ + ln -s %{roundcubeconfigpath}/skins/elastic/styles/$file %{buildroot}%{roundcubepath}/skins/elastic/styles/ +done + # install httpd.conf file and adapt the configuration install -d -m 0755 %{buildroot}/%{apache_sysconfdir}/conf.d sed -e "s#__ROUNDCUBEPATH__#%{roundcubepath}#g" %{SOURCE2} > %{buildroot}%{apache_sysconfdir}/conf.d/roundcubemail.conf # install docs install -d -m 0755 %{buildroot}/%{_defaultdocdir}/%{name} -for i in CHANGELOG UPGRADING README.md README.openSUSE SQL; do +%if 0%{?suse_version} >= 1500 +TXT="CHANGELOG UPGRADING README.md README.openSUSE SQL" +rm %{buildroot}%{roundcubepath}/LICENSE +%else +TXT="CHANGELOG UPGRADING README.md README.openSUSE SQL LICENSE" +%endif +for i in $TXT; do mv -v %{buildroot}%{roundcubepath}/$i %{buildroot}%{_defaultdocdir}/%{name}/ done -# move license back into sources -mv %{buildroot}%{roundcubepath}/LICENSE . + +# move Readme files to docdir +for file in LICENSE README README.rst *.md ; do + for i in $(find %{buildroot}%{roundcubepath}/vendor -type f -name "$file"); do + BASEDIR=$(echo "$i" | sed -e "s|%{buildroot}%{roundcubepath}/vendor||g") + BASEDIR=$(dirname "$BASEDIR") + mkdir -p "%{buildroot}%{_defaultdocdir}/%{name}/$BASEDIR" + mv "$i" "%{buildroot}%{_defaultdocdir}/%{name}/$BASEDIR" + done +done # create a link for SQL ln -s %{_defaultdocdir}/%{name}/SQL %{buildroot}/%{roundcubepath}/SQL @@ -173,6 +204,7 @@ mkdir %{buildroot}%{roundcubepath}/migration # fdupes %if 0%{?suse_version} >= 1100 %fdupes %{buildroot}%{roundcubepath} +%fdupes %{buildroot}%{_defaultdocdir}/%{name} %endif %pre @@ -209,11 +241,19 @@ makedesstr() { sed -i "s/rcmail-\!24ByteDESkey\*Str/`makedesstr`/" %{roundcubeconfigpath}/defaults.inc.php || : &> /dev/null -# enable apache required apache modules -if [ -x %{_sbindir}/a2enmod ]; then - a2enmod -q alias || a2enmod alias - a2enmod -q rewrite || a2enmod rewrite - a2enmod -q version || a2enmod version +# Update ? +if [ ${1:-0} -eq 1 ]; then + if [ -x %{_sbindir}/a2enmod ]; then + # enable apache required apache modules + %if 0%{?suse_version} > 01500 + if ! grep -q php %{_sysconfdir}/sysconfig/apache2 1>&2 2>/dev/null; then + %{_sbindir}/a2enmod -q php7 || %{_sbindir}/a2enmod php7 + fi + %endif + for module in alias deflate expires filter headers rewrite setenvif version ; do + %{_sbindir}/a2enmod -q $module || %{_sbindir}/a2enmod $module + done + fi fi # restore backed up logs, temp and config @@ -260,14 +300,22 @@ exit 0 %files %defattr(0644, root, root,0755) -%license LICENSE %doc CHANGELOG +%if 0%{?suse_version} >= 1500 +%license LICENSE +%else +%doc LICENSE +%endif %doc README.md %doc README.openSUSE %doc UPGRADING %doc SQL/ +%doc %{_defaultdocdir}/%{name}/* %dir %{roundcubepath} %dir %{roundcubeconfigpath} +%dir %{roundcubeconfigpath}/skins +%dir %{roundcubeconfigpath}/skins/elastic +%dir %{roundcubeconfigpath}/skins/elastic/styles/ %ghost %config(noreplace) %{roundcubeconfigpath}/config.inc.php %config(noreplace) %{roundcubeconfigpath}/acl.inc.php %config(noreplace) %{roundcubeconfigpath}/managesieve.inc.php @@ -277,6 +325,8 @@ exit 0 %config %{roundcubeconfigpath}/mimetypes.php %config(noreplace) %{apache_sysconfdir}/conf.d/roundcubemail.conf %config(noreplace) %{_sysconfdir}/logrotate.d/%{name} +%config(noreplace) %{roundcubeconfigpath}/skins/elastic/styles/_styles.less +%config(noreplace) %{roundcubeconfigpath}/skins/elastic/styles/_variables.less %{roundcubepath}/composer.json-dist %{roundcubepath}/composer.json %{roundcubepath}/composer.lock @@ -285,6 +335,9 @@ exit 0 %{roundcubepath}/robots.txt %dir %{roundcubepath}/bin %attr(0755,root,root) %{roundcubepath}/bin/*.sh +%attr(0755,root,root) %{roundcubepath}/vendor/roundcube/plugin-installer/src/bin/rcubeinitdb.sh +%attr(0755,root,root) %{roundcubepath}/plugins/password/helpers/change_ldap_pass.pl +%attr(0755,root,root) %{roundcubepath}/vendor/pear/crypt_gpg/scripts/crypt-gpg-pinentry %{roundcubepath}/installer/ %{roundcubepath}/logs %ghost %{roundcubepath}/migrated/