From 7b598b41aac1786c3704326e4f3490f09493f42df8b0bbe2fb1cb8582ebdaad4 Mon Sep 17 00:00:00 2001 From: Petr Gajdos Date: Thu, 27 Sep 2018 11:14:35 +0000 Subject: [PATCH 1/2] - relink /usr/sbin/httpd after apache2-MPM uninstall [bsc#1107930c#1] - simplify find_mpm function from script-helpers - /usr/sbin/httpd is now created depending on preference hardcoded in find_mpm (script-helpers), not depending on alphabetical order of MPMs - simplify spec file a bit OBS-URL: https://build.opensuse.org/package/show/Apache/apache2?expand=0&rev=569 --- apache2-script-helpers | 34 ++++++------- apache2.changes | 10 ++++ apache2.spec | 105 ++++++++++------------------------------- 3 files changed, 50 insertions(+), 99 deletions(-) diff --git a/apache2-script-helpers b/apache2-script-helpers index 9c06343..3f67881 100644 --- a/apache2-script-helpers +++ b/apache2-script-helpers @@ -25,37 +25,33 @@ function load_sysconfig function find_mpm { - [ -n "$mpm_found" ] && return - - # load sysconfig variables if they weren't yet + # load sysconfig variables if they weren't yet; + # this has no effect when find_mpm is not called + # from start_apache2 load_sysconfig # try to read from sysconfig's APACHE_MPM - HTTPD_MPM=$APACHE_MPM + HTTPD_MPM="$APACHE_MPM" # if empty, then choose one from installed if [ -z "$HTTPD_MPM" ]; then - # guess + installed_mpms="" for i in $HTTPD_SBIN_BASE-*; do test -f $i || continue i=$(basename $i) i=${i#*-} - installed_mpms=(${installed_mpms[*]} $i) + installed_mpms="$installed_mpms $i" + done + # hardcoded preference here: + for mpm in event worker prefork; do + if [[ $installed_mpms =~ "$mpm" ]]; then + HTTPD_MPM=$mpm + break + fi done - if [ -z "${installed_mpms[*]}" ]; then - HTTPD_MPM="" - return - elif [ ${#installed_mpms[*]} = 1 ]; then - HTTPD_MPM=${installed_mpms[*]} - else - case ${installed_mpms[*]} in - *prefork*) HTTPD_MPM=prefork;; - *worker*) HTTPD_MPM=worker;; - *event*) HTTPD_MPM=event;; - esac - fi fi - export HTTPD_MPM mpm_found=true + # in case no + export HTTPD_MPM } # diff --git a/apache2.changes b/apache2.changes index 3a2527f..7da864a 100644 --- a/apache2.changes +++ b/apache2.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Thu Sep 27 10:25:40 UTC 2018 - Petr Gajdos + +- relink /usr/sbin/httpd after apache2-MPM uninstall [bsc#1107930c#1] +- simplify find_mpm function from script-helpers +- /usr/sbin/httpd is now created depending on preference hardcoded + in find_mpm (script-helpers), not depending on alphabetical + order of MPMs +- simplify spec file a bit + ------------------------------------------------------------------- Mon Sep 24 12:53:08 UTC 2018 - Michael Ströder diff --git a/apache2.spec b/apache2.spec index 299de1c..52bd1ec 100644 --- a/apache2.spec +++ b/apache2.spec @@ -25,11 +25,7 @@ %define apache_mmn %(test -s %{SOURCE0} && { echo -n apache_mmn_; bzcat %{SOURCE0} | awk '/^#define MODULE_MAGIC_NUMBER_MAJOR/ {printf "%d", $3}'; } || echo apache_mmn_notfound) %define suse_maintenance_mmn 0 %define default_mpm prefork -%define prefork 1 -%define worker 1 -%define event 1 -%define mpms_to_build %(test %{prefork} = 1 && printf prefork) %(test %{worker} = 1 && printf worker) %(test %{event} = 1 && printf event) -# dir names +%define mpms_to_build prefork worker event %define datadir /srv/www %define htdocsdir %{datadir}/htdocs %define manualdir %{_datadir}/%{name}/manual @@ -228,7 +224,6 @@ Caching API. See %{_docdir}/apache2/, http://httpd.apache.org/, and http://httpd.apache.org/docs-2.4/upgrading.html. -%if %worker %package worker Summary: Apache 2 worker MPM (Multi-Processing Module) Group: Productivity/Networking/Web/Servers @@ -236,9 +231,7 @@ Requires: %{name} = %{version} # the post scriptlet sources /usr/share/apache2/script-helpers Requires(post): %{name} = %{version} Provides: %{name}-MPM -%endif -%if %prefork %package prefork Summary: Apache 2 "prefork" MPM (Multi-Processing Module) Group: Productivity/Networking/Web/Servers @@ -247,9 +240,7 @@ Requires: %{name} = %{version} Requires(post): %{name} = %{version} Provides: %{name}-MPM Provides: apache:%{_sbindir}/httpd -%endif -%if %event %package event Summary: Apache 2 event MPM (Multi-Processing Module) Group: Productivity/Networking/Web/Servers @@ -257,27 +248,21 @@ Requires: %{name} = %{version} # the post scriptlet sources /usr/share/apache2/script-helpers Requires(post): %{name} = %{version} Provides: %{name}-MPM -%endif -%if %worker %description worker The worker MPM (multi-Processing Module) implementing a hybrid multi-threaded multi-process web server. This combination offers a performance boost and retains some of the stability of the multi-process model. -%endif -%if %{prefork} %description prefork "prefork" MPM (Multi-Processing Module) This MPM is basically the one that Apache 1.3.x used. It warrants the maximum stability because each server runs in its own process. If a process dies it will not affect other servers. -%endif -%if %{event} %description event The event MPM (multi-Processing Module) is experimental, so it may or may not work as expected. @@ -289,7 +274,6 @@ again until the Keep Alive timeout was reached. This MPM depends on APR's atomic compare-and-swap operations for thread synchronization. -%endif %package devel Summary: Apache 2 Header and Include Files @@ -894,7 +878,6 @@ rm %{buildroot}/%{sysconfdir}/*.test /usr/share/apache2/load_configuration %endif -%if %{prefork} %files prefork %defattr(-,root,root) %{_sbindir}/httpd-prefork @@ -1021,9 +1004,7 @@ rm %{buildroot}/%{sysconfdir}/*.test %{_libdir}/%{name}-prefork/mod_vhost_alias.so %{_libdir}/%{name}-prefork/mod_watchdog.so %{_libdir}/%{name}-prefork/mod_xml2enc.so -%endif -%if %{worker} %files worker %defattr(-,root,root) %{_sbindir}/httpd-worker @@ -1150,9 +1131,7 @@ rm %{buildroot}/%{sysconfdir}/*.test %{_libdir}/%{name}-worker/mod_vhost_alias.so %{_libdir}/%{name}-worker/mod_watchdog.so %{_libdir}/%{name}-worker/mod_xml2enc.so -%endif -%if %{event} %files event %defattr(-,root,root) %{_sbindir}/httpd-event @@ -1279,7 +1258,6 @@ rm %{buildroot}/%{sysconfdir}/*.test %{_libdir}/%{name}-event/mod_vhost_alias.so %{_libdir}/%{name}-event/mod_watchdog.so %{_libdir}/%{name}-event/mod_xml2enc.so -%endif %files devel -f filelist-devel %defattr(-,root,root) @@ -1347,94 +1325,69 @@ rm %{buildroot}/%{sysconfdir}/*.test %{_sbindir}/rotatelogs %{_sbindir}/rotatelogs2 -%if %{prefork} -# + +%define install_httpd_link() \ +( \ + # it might happen that apache2 including \ + # %{_datadir}/apache2/script-helpers is not installed \ + # yet even if apache2- has Requires(post): apache2 \ + # because of circular dependency between apache2 \ + # and apache2-MPM \ + if [ -f %{_datadir}/apache2/script-helpers ]; then \ + . %{_datadir}/apache2/script-helpers \ + find_mpm \ + # when this is run in %post(apache2), it may happen \ + # no MPM is installed so far \ + if [ -n "$HTTPD_MPM" ]; then \ + ln -sf $HTTPD_SBIN_BASE-$HTTPD_MPM $HTTPD_SBIN_BASE \ + fi \ + fi \ +) %post prefork -# install /usr/sbin/httpd link -if [ -f %{_datadir}/apache2/script-helpers ]; then - # it might happen that apache2 including - # %{_datadir}/apache2/script-helpers is not installed - # yet even if apache2- has Requires(post): apache2 - # because of circular dependency between apache2 - # and apache2-MPM - . %{_datadir}/apache2/script-helpers - find_mpm - ln -sf $HTTPD_SBIN_BASE-$HTTPD_MPM $HTTPD_SBIN_BASE -fi +%install_httpd_link exit 0 -# %postun prefork if [ $1 -eq 1 ]; then %apache_request_restart fi +%install_httpd_link exit 0 -# %posttrans prefork %apache_restart_if_needed exit 0 -# -%endif -%if %{worker} %post worker -# install /usr/sbin/httpd link -if [ -f %{_datadir}/apache2/script-helpers ]; then - # it might happen that apache2 including - # %{_datadir}/apache2/script-helpers is not installed - # yet even if apache2- has Requires(post): apache2 - # because of circular dependency between apache2 - # and apache2-MPM - . %{_datadir}/apache2/script-helpers - find_mpm - ln -sf $HTTPD_SBIN_BASE-$HTTPD_MPM $HTTPD_SBIN_BASE -fi +%install_httpd_link exit 0 -# %postun worker if [ $1 -eq 1 ]; then %apache_request_restart fi +%install_httpd_link exit 0 -# %posttrans worker %apache_restart_if_needed exit 0 -# -%endif -%if %{event} %post event -# install /usr/sbin/httpd link -if [ -f %{_datadir}/apache2/script-helpers ]; then - # it might happen that apache2 including - # %{_datadir}/apache2/script-helpers is not installed - # yet even if apache2- has Requires(post): apache2 - # because of circular dependency between apache2 - # and apache2-MPM - . %{_datadir}/apache2/script-helpers - find_mpm - ln -sf $HTTPD_SBIN_BASE-$HTTPD_MPM $HTTPD_SBIN_BASE -fi +%install_httpd_link exit 0 -# %postun event if [ $1 -eq 1 ]; then %apache_request_restart fi +%install_httpd_link exit 0 -# %posttrans event %apache_restart_if_needed exit 0 -# -%endif %pre %if 0%{?suse_version} >= 1210 @@ -1484,14 +1437,6 @@ fi %else %{fillup_and_insserv apache2} %endif -# install /usr/bin/httpd link (the code here is -# needed when apache2 was installed after apache2-) -. %{_datadir}/apache2/script-helpers -find_mpm -if [ -n "$HTTPD_MPM" ]; then - ln -sf $HTTPD_SBIN_BASE-$HTTPD_MPM $HTTPD_SBIN_BASE -fi -# %if %{use_firewalld} %firewalld_reload %endif From d012117221b4c376bb9d2bb8d1b00c7676ee4fe3e920372d9cba25679e1ef5c3 Mon Sep 17 00:00:00 2001 From: Petr Gajdos Date: Mon, 1 Oct 2018 14:00:18 +0000 Subject: [PATCH 2/2] - allow PS decoder for build [bsc#1109976] - build with -j1, otherwise build fails OBS-URL: https://build.opensuse.org/package/show/Apache/apache2?expand=0&rev=570 --- apache2.changes | 6 ++++++ start_apache2 | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/apache2.changes b/apache2.changes index 7da864a..468be06 100644 --- a/apache2.changes +++ b/apache2.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Oct 1 13:38:05 UTC 2018 - Petr Gajdos + +- consider also patterns in APACHE_CONF_INCLUDE_DIRS as documentation + says (patch Juergen Gleiss) + ------------------------------------------------------------------- Thu Sep 27 10:25:40 UTC 2018 - Petr Gajdos diff --git a/start_apache2 b/start_apache2 index 6907c62..af4dc61 100644 --- a/start_apache2 +++ b/start_apache2 @@ -104,7 +104,7 @@ done # APACHE_CONF_INCLUDE_DIRS -> include.conf for dir in $APACHE_CONF_INCLUDE_DIRS; do test ${dir:0:1} = / || dir=/etc/apache2/$dir - if [ ! -e $dir ]; then + if ! ( [ -e $dir ] || [ -e ${dir%/*} ] ); then continue fi echo "Include $dir" >> ${sysconfd_dir}/include.conf