forked from pool/apache2
Accepting request 1311136 from home:mschreiner:branches:Apache
- Migrate from update-alternatives (bsc#1245830). - The APACHE_MPM environment variable now controls which MPM will be used. If an empty string is provided, the script-helpers file implements its own logic to pick an MPM from the currently installed ones. As at least one MPM is always required, this will work just fine. OBS-URL: https://build.opensuse.org/request/show/1311136 OBS-URL: https://build.opensuse.org/package/show/Apache/apache2?expand=0&rev=725
This commit is contained in:
@@ -1,3 +1,12 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Oct 13 13:22:43 UTC 2025 - Martin Schreiner <martin.schreiner@suse.com>
|
||||
|
||||
- Migrate from update-alternatives (bsc#1245830).
|
||||
- The APACHE_MPM environment variable now controls which MPM will be used.
|
||||
If an empty string is provided, the script-helpers file implements its own logic
|
||||
to pick an MPM from the currently installed ones.
|
||||
As at least one MPM is always required, this will work just fine.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Sep 23 13:37:34 UTC 2025 - pgajdos@suse.com
|
||||
|
||||
|
||||
+15
-43
@@ -16,6 +16,8 @@
|
||||
#
|
||||
|
||||
|
||||
%global apache2_evr %{?epoch:%{epoch}:}%{version}-%{release}
|
||||
|
||||
%global upstream_name httpd
|
||||
%global testsuite_name %{upstream_name}-framework
|
||||
%global tversion svn1928711
|
||||
@@ -38,15 +40,6 @@
|
||||
%define unittest 1
|
||||
%endif
|
||||
%endif
|
||||
%if "%{mpm}" == "prefork"
|
||||
%define mpm_alt_prio 10
|
||||
%endif
|
||||
%if "%{mpm}" == "worker"
|
||||
%define mpm_alt_prio 20
|
||||
%endif
|
||||
%if "%{mpm}" == "event"
|
||||
%define mpm_alt_prio 30
|
||||
%endif
|
||||
%define default_mpm prefork
|
||||
%define suse_maintenance_mmn 0
|
||||
%define apache_mmn %(test -s %{SOURCE0} && \
|
||||
@@ -262,12 +255,15 @@ BuildRequires: netcfg
|
||||
# /SECTION
|
||||
%if "%{mpm}" != ""
|
||||
Provides: apache2-MPM
|
||||
Requires: apache2
|
||||
Requires: apache2 = %{apache2_evr}
|
||||
%endif
|
||||
%if "%{flavor}" == ""
|
||||
Requires: %{_sysconfdir}/mime.types
|
||||
Requires: apache2-MPM
|
||||
Suggests: apache2-%{default_mpm}
|
||||
Requires: (apache2-event = %{apache2_evr} if apache2-event)
|
||||
Requires: (apache2-prefork = %{apache2_evr} if apache2-prefork)
|
||||
Requires: (apache2-worker = %{apache2_evr} if apache2-worker)
|
||||
Suggests: apache2-%{default_mpm} = %{apache2_evr}
|
||||
Recommends: apache2-utils
|
||||
Requires: logrotate
|
||||
Provides: %{apache_mmn}
|
||||
@@ -298,7 +294,6 @@ Obsoletes: apache2-doc <= %{version}
|
||||
Requires(pre): permissions
|
||||
Requires(post): %fillup_prereq
|
||||
Requires(post): grep
|
||||
Requires(post): update-alternatives
|
||||
Requires(postun): update-alternatives
|
||||
%endif
|
||||
%if %{test} || "%{flavor}" == "manual"
|
||||
@@ -484,18 +479,9 @@ make DESTDIR=%{buildroot} program-install
|
||||
pushd modules
|
||||
make DESTDIR=%{buildroot} install -j1
|
||||
popd
|
||||
# install alternative links (httpd binary, modules)
|
||||
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
|
||||
ln -sf %{_sysconfdir}/alternatives/httpd %{buildroot}%{_sbindir}/httpd
|
||||
mkdir -p %{buildroot}%{_libdir}/apache2/
|
||||
for module in %{dynamic_modules}; do
|
||||
if [ -e %{buildroot}%{libexecdir}/mod_$module.so ]; then
|
||||
ln -sf %{_sysconfdir}/alternatives/mod_$module.so %{buildroot}%{_libdir}/apache2/mod_$module.so
|
||||
fi
|
||||
done
|
||||
%endif
|
||||
|
||||
# main packge install
|
||||
# main package install
|
||||
%if "%{flavor}" == ""
|
||||
mkdir -p %{buildroot}%{logfiledir} \
|
||||
%{buildroot}%{proxycachedir} \
|
||||
@@ -822,14 +808,8 @@ exit 0
|
||||
# MPMs files
|
||||
%if ! %{test} && "%{mpm}" != ""
|
||||
%files
|
||||
%{_sbindir}/httpd
|
||||
%{_sbindir}/httpd-%{mpm}
|
||||
%ghost %{_sysconfdir}/alternatives/httpd
|
||||
# %%ghost %%{_sysconfdir}/alternatives/mod_*.so does not work
|
||||
%(for module in %{dynamic_modules}; do echo "%ghost %{_sysconfdir}/alternatives/mod_$module.so"; done)
|
||||
%dir %{_libdir}/apache2-%{mpm}
|
||||
%dir %{_libdir}/apache2
|
||||
%{_libdir}/apache2/*.so
|
||||
%{libexecdir}/mod_*.so
|
||||
%endif
|
||||
|
||||
@@ -927,21 +907,7 @@ exit 0
|
||||
|
||||
# MPMs scriptlets
|
||||
%if ! %{test} && "%{mpm}" != ""
|
||||
%post
|
||||
%{_sbindir}/update-alternatives --quiet --force \
|
||||
--install %{_sbindir}/httpd httpd %{_sbindir}/httpd-%{mpm} %{mpm_alt_prio}
|
||||
for module in %{dynamic_modules}; do
|
||||
if [ -e %{libexecdir}/mod_$module.so ]; then
|
||||
%{_sbindir}/update-alternatives --quiet --force \
|
||||
--install %{_libdir}/apache2/mod_$module.so mod_$module.so %{libexecdir}/mod_$module.so %{mpm_alt_prio}
|
||||
fi
|
||||
done
|
||||
exit 0
|
||||
|
||||
%postun
|
||||
if [ "$1" = 1 ]; then
|
||||
%apache_request_restart
|
||||
fi
|
||||
%pre
|
||||
if [ "$1" = 0 ]; then
|
||||
%{_sbindir}/update-alternatives --quiet --force --remove httpd %{_sbindir}/httpd
|
||||
for module in %{dynamic_modules}; do
|
||||
@@ -950,6 +916,12 @@ if [ "$1" = 0 ]; then
|
||||
fi
|
||||
exit 0
|
||||
|
||||
%postun
|
||||
if [ "$1" = 1 ]; then
|
||||
%apache_request_restart
|
||||
fi
|
||||
exit 0
|
||||
|
||||
%posttrans
|
||||
%apache_restart_if_needed
|
||||
exit 0
|
||||
|
||||
+14
-4
@@ -32,13 +32,23 @@ function find_mpm
|
||||
|
||||
# try to read from sysconfig's APACHE_MPM
|
||||
HTTPD_MPM="$APACHE_MPM"
|
||||
# if empty, then choose the one chosen by
|
||||
# update alternatives
|
||||
|
||||
# if the value is empty, we try to determine the MPM based on what's
|
||||
# installed, with the priority that is encoded below
|
||||
if [ -z "$HTTPD_MPM" ]; then
|
||||
HTTPD_MPM=$(readlink $(readlink /usr/sbin/httpd) | sed "s:/usr/sbin/httpd-::")
|
||||
if [ -x "$HTTPD_SBIN_BASE-prefork" ]; then
|
||||
HTTPD_MPM="prefork"
|
||||
elif [ -x "$HTTPD_SBIN_BASE-worker" ]; then
|
||||
HTTPD_MPM="worker"
|
||||
elif [ -x "$HTTPD_SBIN_BASE-event" ]; then
|
||||
HTTPD_MPM="event"
|
||||
else
|
||||
echo >&2 "No usable APACHE_MPM was found."
|
||||
echo >&2 "Check your APACHE_MPM setting in /etc/sysconfig/apache2."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# in case no
|
||||
export HTTPD_MPM
|
||||
}
|
||||
|
||||
|
||||
@@ -49,17 +49,11 @@ fi
|
||||
# /usr/sbin/httpd-worker, etc.) and serverflags
|
||||
#
|
||||
find_mpm
|
||||
if [ -n "$HTTPD_MPM" ]; then
|
||||
apache_bin="$HTTPD_SBIN_BASE-$HTTPD_MPM"
|
||||
if ! [ -x $apache_bin ]; then
|
||||
echo >&2 "$apache_bin-$APACHE_MPM is not a valid httpd binary."
|
||||
apache_bin="$HTTPD_SBIN_BASE-$HTTPD_MPM"
|
||||
if ! [ -x $apache_bin ]; then
|
||||
echo >&2 "$apache_bin is not a valid httpd binary."
|
||||
echo >&2 "Check your APACHE_MPM setting in /etc/sysconfig/apache2."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# take /usr/sbin/httpd, which will
|
||||
# exist thanks to update alternatives
|
||||
apache_bin="$HTTPD_SBIN_BASE"
|
||||
fi
|
||||
|
||||
# server flags from APACHE_SERVER_FLAGS
|
||||
|
||||
Reference in New Issue
Block a user