diff options
author | Fabio Erculiani <lxnay@gentoo.org> | 2013-05-20 08:58:01 +0000 |
---|---|---|
committer | Fabio Erculiani <lxnay@gentoo.org> | 2013-05-20 08:58:01 +0000 |
commit | cddefed3e5be2f8ae84ad307dbf5851a17cdf1af (patch) | |
tree | 0525d4bef33d4f2db2991d2ccf531d5ad90acf64 /www-servers | |
parent | Stable for amd64 wrt bug #470490 (diff) | |
download | gentoo-2-cddefed3e5be2f8ae84ad307dbf5851a17cdf1af.tar.gz gentoo-2-cddefed3e5be2f8ae84ad307dbf5851a17cdf1af.tar.bz2 gentoo-2-cddefed3e5be2f8ae84ad307dbf5851a17cdf1af.zip |
add systemd support to both 2.2 and 2.4 branches on behalf of the systemd team, fix bug #466096, overriding unresponsive maintainer
(Portage version: 2.2.0_alpha166/cvs/Linux x86_64, signed Manifest commit with key ADC916E5)
Diffstat (limited to 'www-servers')
-rw-r--r-- | www-servers/apache/ChangeLog | 11 | ||||
-rw-r--r-- | www-servers/apache/apache-2.2.24-r1.ebuild | 119 | ||||
-rw-r--r-- | www-servers/apache/apache-2.4.4-r3.ebuild | 13 | ||||
-rw-r--r-- | www-servers/apache/files/00_systemd.conf | 2 | ||||
-rw-r--r-- | www-servers/apache/files/apache.conf | 2 | ||||
-rw-r--r-- | www-servers/apache/files/apache2.2.service | 19 | ||||
-rw-r--r-- | www-servers/apache/files/apache2.4.service | 20 | ||||
-rw-r--r-- | www-servers/apache/files/httpd-2.4.3-mod_systemd.patch | 163 |
8 files changed, 346 insertions, 3 deletions
diff --git a/www-servers/apache/ChangeLog b/www-servers/apache/ChangeLog index 253c2180d23e..983612385103 100644 --- a/www-servers/apache/ChangeLog +++ b/www-servers/apache/ChangeLog @@ -1,6 +1,15 @@ # ChangeLog for www-servers/apache # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/www-servers/apache/ChangeLog,v 1.229 2013/05/03 07:19:50 patrick Exp $ +# $Header: /var/cvsroot/gentoo-x86/www-servers/apache/ChangeLog,v 1.230 2013/05/20 08:58:01 lxnay Exp $ + +*apache-2.2.24-r1 (20 May 2013) + + 20 May 2013; Fabio Erculiani <lxnay@gentoo.org> +apache-2.2.24-r1.ebuild, + apache-2.4.4-r3.ebuild, +files/00_systemd.conf, + +files/httpd-2.4.3-mod_systemd.patch, +files/apache.conf, + +files/apache2.2.service, +files/apache2.4.service: + add systemd support to both 2.2 and 2.4 branches on behalf of the systemd + team, fix bug #466096, overriding unresponsive maintainer 03 May 2013; Patrick Lauer <patrick@gentoo.org> metadata.xml: Remove ghelm from metadata diff --git a/www-servers/apache/apache-2.2.24-r1.ebuild b/www-servers/apache/apache-2.2.24-r1.ebuild new file mode 100644 index 000000000000..600032c9996c --- /dev/null +++ b/www-servers/apache/apache-2.2.24-r1.ebuild @@ -0,0 +1,119 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/www-servers/apache/apache-2.2.24-r1.ebuild,v 1.1 2013/05/20 08:58:01 lxnay Exp $ + +EAPI="2" + +WANT_AUTOMAKE="1.11" + +# latest gentoo apache files +GENTOO_PATCHSTAMP="20121012" +GENTOO_DEVELOPER="patrick" +GENTOO_PATCHNAME="gentoo-apache-2.2.23" + +# IUSE/USE_EXPAND magic +IUSE_MPMS_FORK="itk peruser prefork" +IUSE_MPMS_THREAD="event worker" + +IUSE_MODULES="actions alias asis auth_basic auth_digest authn_alias authn_anon +authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default +authz_groupfile authz_host authz_owner authz_user autoindex cache cern_meta +charset_lite cgi cgid dav dav_fs dav_lock dbd deflate dir disk_cache dumpio +env expires ext_filter file_cache filter headers ident imagemap include info +log_config log_forensic logio mem_cache mime mime_magic negotiation proxy +proxy_ajp proxy_balancer proxy_connect proxy_ftp proxy_http proxy_scgi rewrite +reqtimeout setenvif speling status substitute unique_id userdir usertrack +version vhost_alias" +# The following are also in the source as of this version, but are not available +# for user selection: +# bucketeer case_filter case_filter_in echo http isapi optional_fn_export +# optional_fn_import optional_hook_export optional_hook_import + +# inter-module dependencies +# TODO: this may still be incomplete +MODULE_DEPENDS=" + dav_fs:dav + dav_lock:dav + deflate:filter + disk_cache:cache + ext_filter:filter + file_cache:cache + log_forensic:log_config + logio:log_config + mem_cache:cache + mime_magic:mime + proxy_ajp:proxy + proxy_balancer:proxy + proxy_connect:proxy + proxy_ftp:proxy + proxy_http:proxy + proxy_scgi:proxy + substitute:filter +" + +# module<->define mappings +MODULE_DEFINES=" + auth_digest:AUTH_DIGEST + authnz_ldap:AUTHNZ_LDAP + cache:CACHE + dav:DAV + dav_fs:DAV + dav_lock:DAV + disk_cache:CACHE + file_cache:CACHE + info:INFO + ldap:LDAP + mem_cache:CACHE + proxy:PROXY + proxy_ajp:PROXY + proxy_balancer:PROXY + proxy_connect:PROXY + proxy_ftp:PROXY + proxy_http:PROXY + ssl:SSL + status:STATUS + suexec:SUEXEC + userdir:USERDIR +" + +# critical modules for the default config +MODULE_CRITICAL=" + authz_host + dir + mime +" + +inherit apache-2 systemd + +DESCRIPTION="The Apache Web Server." +HOMEPAGE="http://httpd.apache.org/" + +# some helper scripts are Apache-1.1, thus both are here +LICENSE="Apache-2.0 Apache-1.1" +SLOT="2" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd" +IUSE="" + +DEPEND="${DEPEND} + >=dev-libs/openssl-0.9.8m + apache2_modules_deflate? ( sys-libs/zlib )" + +# dependency on >=dev-libs/apr-1.4.5 for bug #368651 +RDEPEND="${RDEPEND} + >=dev-libs/apr-1.4.5 + >=dev-libs/openssl-0.9.8m + apache2_modules_mime? ( app-misc/mime-types )" + +# init script fixup - should be rolled into next tarball #389965 +src_prepare() { + apache-2_src_prepare + sed -i -e 's/! test -f/test -f/' "${GENTOO_PATCHDIR}"/init/apache2.initd || die "Failed to fix init script" + cp "${FILESDIR}"/2.2.22-envvars-std.in "${S}"/support/envvars-std.in || die "Failed to apply LD_PRELOAD fix" +} + +src_install() { + apache-2_src_install + + systemd_newunit "${FILESDIR}/apache2.2.service" "apache2.service" + systemd_dotmpfilesd "${FILESDIR}/apache.conf" +} diff --git a/www-servers/apache/apache-2.4.4-r3.ebuild b/www-servers/apache/apache-2.4.4-r3.ebuild index 4ffb00b4f2b8..01e99c0e2fc1 100644 --- a/www-servers/apache/apache-2.4.4-r3.ebuild +++ b/www-servers/apache/apache-2.4.4-r3.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/www-servers/apache/apache-2.4.4-r3.ebuild,v 1.2 2013/04/11 09:24:14 polynomial-c Exp $ +# $Header: /var/cvsroot/gentoo-x86/www-servers/apache/apache-2.4.4-r3.ebuild,v 1.3 2013/05/20 08:58:01 lxnay Exp $ EAPI="2" @@ -113,7 +113,7 @@ MODULE_CRITICAL=" use ssl && MODULE_CRITICAL+=" socache_shmcb" use doc && MODULE_CRITICAL+=" alias negotiation setenvif" -inherit eutils apache-2 +inherit eutils apache-2 systemd DESCRIPTION="The Apache Web Server." HOMEPAGE="http://httpd.apache.org/" @@ -146,6 +146,10 @@ src_prepare() { fi apache-2_src_prepare sed -i -e 's/! test -f/test -f/' "${GENTOO_PATCHDIR}"/init/apache2.initd || die "Failed to fix init script" + + # mod_systemd support, merged upstream already: + # http://svn.apache.org/viewvc?view=revision&revision=1393976 + epatch "${FILESDIR}/httpd-2.4.3-mod_systemd.patch" } src_install() { @@ -171,6 +175,11 @@ src_install() { if use ssl; then dodir /var/run/apache_ssl_mutex || die "Failed to mkdir ssl_mutex" fi + + systemd_newunit "${FILESDIR}/apache2.4.service" "apache2.service" + systemd_dotmpfilesd "${FILESDIR}/apache.conf" + insinto /etc/apache2/modules.d + doins "${FILESDIR}/00_systemd.conf" } pkg_postinst() diff --git a/www-servers/apache/files/00_systemd.conf b/www-servers/apache/files/00_systemd.conf new file mode 100644 index 000000000000..b208c972dd50 --- /dev/null +++ b/www-servers/apache/files/00_systemd.conf @@ -0,0 +1,2 @@ +# This file configures systemd module: +LoadModule systemd_module modules/mod_systemd.so diff --git a/www-servers/apache/files/apache.conf b/www-servers/apache/files/apache.conf new file mode 100644 index 000000000000..aa75edaa73b8 --- /dev/null +++ b/www-servers/apache/files/apache.conf @@ -0,0 +1,2 @@ +d /run/apache2 710 root apache + diff --git a/www-servers/apache/files/apache2.2.service b/www-servers/apache/files/apache2.2.service new file mode 100644 index 000000000000..76f783a423b9 --- /dev/null +++ b/www-servers/apache/files/apache2.2.service @@ -0,0 +1,19 @@ +[Unit] +Description=The Apache HTTP Server +After=network.target remote-fs.target nss-lookup.target + +[Service] +EnvironmentFile=/etc/conf.d/apache2 +ExecStart=/usr/sbin/apache2 $APACHE2_OPTS -DFOREGROUND +ExecReload=/usr/sbin/apache2 $APACHE2_OPTS -k graceful +ExecStop=/usr/sbin/apache2 $APACHE2_OPTS -k graceful-stop +# We want systemd to give httpd some time to finish gracefully, but still want +# it to kill httpd after TimeoutStopSec if something went wrong during the +# graceful stop. Normally, Systemd sends SIGTERM signal right after the +# ExecStop, which would kill httpd. We are sending useless SIGCONT here to give +# httpd time to finish. +KillSignal=SIGCONT +PrivateTmp=true + +[Install] +WantedBy=multi-user.target diff --git a/www-servers/apache/files/apache2.4.service b/www-servers/apache/files/apache2.4.service new file mode 100644 index 000000000000..ace453f12e50 --- /dev/null +++ b/www-servers/apache/files/apache2.4.service @@ -0,0 +1,20 @@ +[Unit] +Description=The Apache HTTP Server +After=network.target remote-fs.target nss-lookup.target + +[Service] +Type=notify +EnvironmentFile=/etc/conf.d/apache2 +ExecStart=/usr/sbin/apache2 $APACHE2_OPTS -DFOREGROUND +ExecReload=/usr/sbin/apache2 $APACHE2_OPTS -k graceful +ExecStop=/usr/sbin/apache2 $APACHE2_OPTS -k graceful-stop +# We want systemd to give httpd some time to finish gracefully, but still want +# it to kill httpd after TimeoutStopSec if something went wrong during the +# graceful stop. Normally, Systemd sends SIGTERM signal right after the +# ExecStop, which would kill httpd. We are sending useless SIGCONT here to give +# httpd time to finish. +KillSignal=SIGCONT +PrivateTmp=true + +[Install] +WantedBy=multi-user.target diff --git a/www-servers/apache/files/httpd-2.4.3-mod_systemd.patch b/www-servers/apache/files/httpd-2.4.3-mod_systemd.patch new file mode 100644 index 000000000000..a9b1fd9910a1 --- /dev/null +++ b/www-servers/apache/files/httpd-2.4.3-mod_systemd.patch @@ -0,0 +1,163 @@ +--- httpd-2.4.3/modules/arch/unix/config5.m4.systemd ++++ httpd-2.4.3/modules/arch/unix/config5.m4 +@@ -18,6 +18,19 @@ APACHE_MODULE(privileges, Per-virtualhos + fi + ]) + ++ ++APACHE_MODULE(systemd, Systemd support, , , $unixd_mods_enabled, [ ++ AC_CHECK_LIB(systemd-daemon, sd_notify, SYSTEMD_LIBS="-lsystemd-daemon") ++ AC_CHECK_HEADERS(systemd/sd-daemon.h, [ap_HAVE_SD_DAEMON_H="yes"], [ap_HAVE_SD_DAEMON_H="no"]) ++ if test $ap_HAVE_SD_DAEMON_H = "no" || test -z "${SYSTEMD_LIBS}"; then ++ AC_MSG_WARN([Your system does not support systemd.]) ++ enable_systemd="no" ++ else ++ APR_ADDTO(MOD_SYSTEMD_LDADD, [$SYSTEMD_LIBS]) ++ enable_systemd="yes" ++ fi ++]) ++ + APR_ADDTO(INCLUDES, [-I\$(top_srcdir)/$modpath_current]) + + APACHE_MODPATH_FINISH +--- httpd-2.4.3/modules/arch/unix/mod_systemd.c.systemd ++++ httpd-2.4.3/modules/arch/unix/mod_systemd.c +@@ -0,0 +1,138 @@ ++/* Licensed to the Apache Software Foundation (ASF) under one or more ++ * contributor license agreements. See the NOTICE file distributed with ++ * this work for additional information regarding copyright ownership. ++ * The ASF licenses this file to You under the Apache License, Version 2.0 ++ * (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ * ++ */ ++ ++#include <stdint.h> ++#include <ap_config.h> ++#include "ap_mpm.h" ++#include <http_core.h> ++#include <http_log.h> ++#include <apr_version.h> ++#include <apr_pools.h> ++#include <apr_strings.h> ++#include "unixd.h" ++#include "scoreboard.h" ++#include "mpm_common.h" ++ ++#include "systemd/sd-daemon.h" ++ ++#if APR_HAVE_UNISTD_H ++#include <unistd.h> ++#endif ++ ++#define KBYTE 1024 ++ ++static pid_t pid; /* PID of the main httpd instance */ ++static int server_limit, thread_limit, threads_per_child, max_servers; ++static time_t last_update_time; ++static unsigned long last_update_access; ++static unsigned long last_update_kbytes; ++ ++static int systemd_pre_mpm(apr_pool_t *p, ap_scoreboard_e sb_type) ++{ ++ int rv; ++ last_update_time = time(0); ++ ++ ap_mpm_query(AP_MPMQ_HARD_LIMIT_THREADS, &thread_limit); ++ ap_mpm_query(AP_MPMQ_HARD_LIMIT_DAEMONS, &server_limit); ++ ap_mpm_query(AP_MPMQ_MAX_THREADS, &threads_per_child); ++ /* work around buggy MPMs */ ++ if (threads_per_child == 0) ++ threads_per_child = 1; ++ ap_mpm_query(AP_MPMQ_MAX_DAEMONS, &max_servers); ++ ++ pid = getpid(); ++ ++ rv = sd_notifyf(0, "READY=1\n" ++ "STATUS=Processing requests...\n" ++ "MAINPID=%lu", ++ (unsigned long) pid); ++ if (rv < 0) { ++ ap_log_perror(APLOG_MARK, APLOG_ERR, 0, p, ++ "sd_notifyf returned an error %d", rv); ++ } ++ ++ return OK; ++} ++ ++static int systemd_monitor(apr_pool_t *p, server_rec *s) ++{ ++ int i, j, res, rv; ++ process_score *ps_record; ++ worker_score *ws_record; ++ unsigned long access = 0; ++ unsigned long bytes = 0; ++ unsigned long kbytes = 0; ++ char bps[5]; ++ time_t now = time(0); ++ time_t elapsed = now - last_update_time; ++ ++ for (i = 0; i < server_limit; ++i) { ++ ps_record = ap_get_scoreboard_process(i); ++ for (j = 0; j < thread_limit; ++j) { ++ ws_record = ap_get_scoreboard_worker_from_indexes(i, j); ++ if (ap_extended_status && !ps_record->quiescing && ps_record->pid) { ++ res = ws_record->status; ++ if (ws_record->access_count != 0 || ++ (res != SERVER_READY && res != SERVER_DEAD)) { ++ access += ws_record->access_count; ++ bytes += ws_record->bytes_served; ++ if (bytes >= KBYTE) { ++ kbytes += (bytes >> 10); ++ bytes = bytes & 0x3ff; ++ } ++ } ++ } ++ } ++ } ++ ++ apr_strfsize((unsigned long)(KBYTE *(float) (kbytes - last_update_kbytes) ++ / (float) elapsed), bps); ++ ++ rv = sd_notifyf(0, "READY=1\n" ++ "STATUS=Total requests: %lu; Current requests/sec: %.3g; " ++ "Current traffic: %sB/sec\n", access, ++ ((float)access - last_update_access) / (float) elapsed, bps); ++ if (rv < 0) { ++ ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, APLOGNO(00000) ++ "sd_notifyf returned an error %d", rv); ++ } ++ ++ last_update_access = access; ++ last_update_kbytes = kbytes; ++ last_update_time = now; ++ ++ return DECLINED; ++} ++ ++static void systemd_register_hooks(apr_pool_t *p) ++{ ++ /* We know the PID in this hook ... */ ++ ap_hook_pre_mpm(systemd_pre_mpm, NULL, NULL, APR_HOOK_LAST); ++ /* Used to update httpd's status line using sd_notifyf */ ++ ap_hook_monitor(systemd_monitor, NULL, NULL, APR_HOOK_MIDDLE); ++} ++ ++module AP_MODULE_DECLARE_DATA systemd_module = ++{ ++ STANDARD20_MODULE_STUFF, ++ NULL, ++ NULL, ++ NULL, ++ NULL, ++ NULL, ++ systemd_register_hooks, ++}; |