[Pkg-apache-commits] [SCM] Debian packaging for apache2 (Apache HTTPD 2.x) branch, next, updated. 6460db08f5ce7947fe6021534a434bcd82e8cf7a

Arno Töll debian at toell.net
Sun Mar 25 11:50:16 UTC 2012


The following commit has been merged in the next branch:
commit 6460db08f5ce7947fe6021534a434bcd82e8cf7a
Author: Arno Töll <debian at toell.net>
Date:   Sun Mar 25 13:49:31 2012 +0200

    * Enable mod_version statically
    * Incorporate some packaging hints from our discussion yesterday to PACKAGING
    * Document TODOs in apache2-maintscript-helper

diff --git a/debian/PACKAGING b/debian/PACKAGING
index bf25746..081667e 100644
--- a/debian/PACKAGING
+++ b/debian/PACKAGING
@@ -7,6 +7,10 @@ Contents
 
 	Packaging Sites and Configurations for Web Applications
 
+	Maintainer Scripts
+		Enabling Configurations
+		Switching MPMs
+
 	Tools
 		a2query
 		apache2-maintscript-helper
@@ -197,6 +201,81 @@ apache2-maintscript-helper. Do not enable or disable modules in web
 application maintainer scripts, instead protect your configuration by <IfModule>
 clauses if you require non-standard modules.
 
+Maintainer Scripts
+==================
+
+While it was already discussed briefly in previous sections, here follow some
+clarifications regarding the invokation of wrapper scripts in maintainer scripts
+of modules and web applications.
+
+Enabling Configurations
+-----------------------
+
+Both, modules and web applications should use the apache2-maintscript-helper in
+general. The helper will obey local policies to decide when to enable a piece of
+configuration, to reload the web server and such. Moreover, it will remember
+whether a module was activated by the site administrator or a maintainer script.
+Thus, it is particularly important you do not use "a2enmod" and such directly
+(a2query is acceptable though).
+
+This is a summary how the apache2-maintscript-helper shall be invoked in
+maintainer scripts:
+
+Modules:
+	Modules should unconditionally call apache2_invoke (unless a maintainer
+	or debconf script verified not to install any configuration at all, e.g.
+	for scripts supporting several web servers) in their "postinst configure"
+	sections. It will obey site local policies in future. the maintainer helper
+	will make sure that during upgrade of a module package, disabled modules
+	are not enabled again.
+	Modules need to be disabled on removal (and purge anyway), otherwise
+	their configuration will be broken (as LoadModule would fail because of
+	the missing shared object file). Thus, modules need to call
+	apache2_invoke dismod on both, removal and purge. It's apache2_invoke's
+	job to deal with upgrades and it will remember modules it removed during
+	removal and will reenable it during reinstall.
+
+Web Applications:
+	Web Application derive the same behavior as modules if the web
+	application can be run with a feasible out-of-box configuration, don't
+	enable it otherwise. Likewise, web application should also be disabled
+	on removal (and on purge anyway), because important files may be missing
+	(and that's the point of package removal, anyway).
+
+Switching MPMs
+--------------
+
+Only modules are allowed to switch the enabled MPM. Web applications must not
+switch the enabled MPM in their maintainer scripts. To actually switch the MPM,
+packagers can use a2query to find out whether it is necessary and eventually
+switch it by using the corresponding helper function provided in
+apache2-maintscript-helper. Do not try to switch the MPM yourself - the helper
+function takes special care not to leave the site back in a state without enabled
+MPM which is a fatal error.
+
+
+The helper call may fail. Your maintainer script must cope with this
+possibility. It is not recommended to make your maintainer script fail if the
+MPM could not be changed. Instead emit a warning - if you are using debconf
+anyway you may want to consider using that - but continue operation. However,
+make sure you only invoke the module in question if the MPM could be changed.
+Below you find an example snippet:
+
+
+	if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
+		. /usr/share/apache2/apache2-maintscript-helper
+
+		# mod_foo requires the prefork MPM
+		if [ $(a2query -M) != 'prefork' ] ; then
+			apache2_switch_mpm prefork || echo "Switching MPMs failed"
+			apache2_invoke enmod foo
+		else
+			apache2_invoke enmod foo
+		fi
+
+	fi
+
+
 Tools
 =====
 
diff --git a/debian/changelog b/debian/changelog
index 7745f6d..93b2884 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,12 +5,16 @@ apache2 (2.4.1-3) experimental; urgency=low
     alternatives, do not remove alternatives on upgrades. Thanks Andreas
     Beckmann for spotting the issue (Closes: #665002)
   * Install suexec(8) link to /usr/share/man/man8/...
+  * Enable mod_version statically, drop associated module load file.
+  * Update PACKAGING hints and cope several questions raised among the
+    discussions with packagers. Thus, invokation of apache2-maintscript-helper
+    in maintainer scripts are covered now.
 
   [ Stefan Fritsch ]
   * Move /usr/share/doc alias to separate config file and don't enable it
     by default.
 
- -- Stefan Fritsch <sf at debian.org>  Sat, 24 Mar 2012 17:55:03 +0100
+ -- Arno Töll <debian at toell.net>  Sun, 25 Mar 2012 13:42:49 +0200
 
 apache2 (2.4.1-2) experimental; urgency=low
 
diff --git a/debian/config-dir/mods-available/version.load b/debian/config-dir/mods-available/version.load
deleted file mode 100644
index 3eada46..0000000
--- a/debian/config-dir/mods-available/version.load
+++ /dev/null
@@ -1 +0,0 @@
-LoadModule version_module /usr/lib/apache2/modules/mod_version.so
diff --git a/debian/debhelper/apache2-maintscript-helper b/debian/debhelper/apache2-maintscript-helper
index 9da558b..6be9b9d 100644
--- a/debian/debhelper/apache2-maintscript-helper
+++ b/debian/debhelper/apache2-maintscript-helper
@@ -23,6 +23,41 @@ if [ -n "${EXPORT_APACHE2_MAINTSCRIPT_HELPER:-}" ] ; then
 fi
 EXPORT_APACHE2_MAINTSCRIPT_HELPER=1
 
+
+
+
+#### XXX: TODOS:
+# To cope with updates / fresh installations maintscript helper needs to parse
+# $@. From our discussion:
+# For that, the maint-script-helper needs to store $@ somewhere when it is first
+# sourced. Document somewhere that $@ must be intact at that time. Complain if $1
+# is empty (that's meant as sanity check because $1 contains the maintainer script
+# argument and is guaranteed to be set by dpkg).
+#
+#
+# Moreover it needs to remember if a module/web app was disabled (or enabled) by
+# a maintainer script or by the user. Again, from our discussion:
+# The rembering could be done like:
+# touch /var/lib/apache2/modules_disabled_by_maintscript/$module
+# purge should then do
+# rm -f /var/lib/apache2/modules_disabled_by_maintscript/$module
+# in addition.
+#
+# And even more work:
+# - change the API of apache2_invoke to be more easily extensible (maybe only one
+#   module/conf per invocation, this would allow adding optional parameters later)
+# - change dh_apache2 accordingly (which is not that trivial as there is no easy
+#   way to source script fragments in autoscripts)
+# - If the complexity overboards, the maint-helper can be changed to a shell
+# - the maint helper should log problems into some dedicated log file in
+#    /var/log/apache2
+#    (in addition to printing them to the screen unless the maintainer set
+#     APACHE2_MAINTSCRIPT_HELPER_QUIET=1)
+
+
+
+
+
 #
 # Function apache2_has_module
 # 	checks whether a supplied module is enabled in the current Apache server
diff --git a/debian/rules b/debian/rules
index b1fe409..af7692e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -64,7 +64,7 @@ override_dh_auto_configure: prepare-custom-suexec generate-maintainer-scripts
 		--enable-pie \
 		--enable-mpms-shared=all \
 		--enable-mods-shared="all cgi" \
-		--enable-mods-static="unixd logio watchdog" \
+		--enable-mods-static="unixd logio watchdog version" \
 		CFLAGS="$(AP2_CFLAGS)" CPPFLAGS="$(AP2_CPPFLAGS)" LDFLAGS="$(AP2_LDFLAGS)" \
 		$(AP2_EXTRAFLAGS)
 

-- 
Debian packaging for apache2 (Apache HTTPD 2.x)



More information about the Pkg-apache-commits mailing list