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

Arno Töll debian at toell.net
Thu Feb 16 17:51:22 UTC 2012


The following commit has been merged in the next branch:
commit 87728123883ffc3d00b01b411b249257f7bde29b
Author: Arno Töll <debian at toell.net>
Date:   Mon Feb 13 02:05:34 2012 +0100

    * Fix a bug with the dangling symlink handling in a2enmod. Dangling *.conf links
      were kept intact for modules which were shipping both, a *.load file and a
      *.conf file
    * Provide compatibility links in apache2-dev
    * Remove debian/apache2.maintscript, instead do the joub ourselves. That's
      painful but there is no alternative left, as dpkg-maintainer-script can't cope
      with our craziness not only to shift conffiles from one package to another,
      but also collapsing upgrades from apache2.2-common only and upgrades from a
      full apache2 package into a single package
    * Update maintainer scripts to deal with the situation
    * Update d/changelog
    * Update debian/gbp.conf to work around debuilder insanities

diff --git a/debian/a2enmod b/debian/a2enmod
index da4b843..2073d51 100755
--- a/debian/a2enmod
+++ b/debian/a2enmod
@@ -137,6 +137,15 @@ sub doit {
 		if ( $act eq 'disable' ) {
 			info("removing dangling symlink $link\n");
 			unlink($link);
+
+                        # force a .conf path. It may exist as dangling link, too
+                        $conflink = "$enabldir/$acton.conf";
+
+                        if (-l $conflink && !-e $conflink) {
+                                info("removing dangling symlink $conflink\n");
+                                unlink($conflink)
+                        }
+
 			return 1;
 		}
 		else {
diff --git a/debian/apache2-dev.install b/debian/apache2-dev.install
index a896521..56d9c6a 100644
--- a/debian/apache2-dev.install
+++ b/debian/apache2-dev.install
@@ -1,3 +1,5 @@
 /usr/include/apache2
 /usr/share/apache2/build
-/usr/sbin/apxs
+/usr/sbin/apxs				/usr/bin/
+debian/debhelper/dh_apache2		/usr/bin/
+debian/debhelper/apache2		/usr/share/debhelper/autoscripts/
diff --git a/debian/apache2-dev.links b/debian/apache2-dev.links
new file mode 100644
index 0000000..31d4dd9
--- /dev/null
+++ b/debian/apache2-dev.links
@@ -0,0 +1 @@
+usr/bin/apxs	usr/bin/apxs2
diff --git a/debian/apache2.links b/debian/apache2.links
index 6b69010..26ca9cd 100644
--- a/debian/apache2.links
+++ b/debian/apache2.links
@@ -1,5 +1,5 @@
-usr/share/bug/apache2-common/script	/usr/share/bug/apache2/script
-usr/sbin/a2enmod usr/sbin/a2dismod
-usr/sbin/a2enmod usr/sbin/a2ensite
-usr/sbin/a2enmod usr/sbin/a2dissite
-usr/sbin/apache2ctl usr/sbin/apachectl
+usr/share/bug/apache2-common/script	usr/share/bug/apache2/script
+usr/sbin/a2enmod 			usr/sbin/a2dismod
+usr/sbin/a2enmod 			usr/sbin/a2ensite
+usr/sbin/a2enmod 			usr/sbin/a2dissite
+usr/sbin/apache2ctl 			usr/sbin/apachectl
diff --git a/debian/apache2.maintscript b/debian/apache2.maintscript
deleted file mode 100644
index 27af08b..0000000
--- a/debian/apache2.maintscript
+++ /dev/null
@@ -1,6 +0,0 @@
-# version 2.3 does not exist at all, all 2.2 versions feature those files, but
-# no 2.3 package does
-rm_conffile /etc/apache2/mods-available/authz_default.load 2.3 apache2.2-common
-rm_conffile /etc/apache2/mods-available/authn_default.load 2.3 apache2.2-common
-rm_conffile /etc/apache2/mods-available/mem_cache.load 2.3 apache2.2-common
-rm_conffile /etc/apache2/mods-available/mem_cache.conf 2.3 apache2.2-common
diff --git a/debian/apache2.postinst b/debian/apache2.postinst
index de98cf3..bc4384e 100755
--- a/debian/apache2.postinst
+++ b/debian/apache2.postinst
@@ -18,52 +18,106 @@ set -e
 # the debian-policy package
 #
 
+
+OBSOLETE_CONFFILES="/etc/apache2/mods-available/authz_default.load
+/etc/apache2/mods-available/authn_default.load
+/etc/apache2/mods-available/mem_cache.load
+/etc/apache2/mods-available/mem_cache.conf
+/etc/apache2/mods-available/authn_alias.load
+/etc/apache2/mods-available/cern_meta.load
+/etc/apache2/mods-available/disk_cache.load
+/etc/apache2/mods-available/disk_cache.conf
+/etc/apache2/mods-available/ident.load
+/etc/apache2/mods-available/imagemap.load"
+
+
+# the functions below need to be idempotent, however we guess the upgrade based
+# on obsolete conffiles which might be removed anytime. Thus, remember we were
+# already in there once.
+SQUEEZE_UPGRADE=0
+
 #      n.b you can't rely on $2 (the last installed version)  for upgrades, as
 #      the user might have been using apache2.2-common only. Let's pretend we're
-#      upgrading if there is a /etc/apache2/.apache2_mpm_selected file around
+#      upgrading if there is either a /etc/apache2/.apache2_mpm_selected file
+#      around or an /etc/apache2/.apache2_upgrade file exists.
 we_are_upgrading_from_squeeze()
 {
-	if [ -n $2 ] && dpkg --compare-versions "$2" "le" "2.3" ; then
-		return 0
-	fi
+        if [ -n $2 ] && dpkg --compare-versions "$2" le-nl "2.3"; then
+                return 0
+        fi
+
+        if [ -e /etc/apache2/.apache2_mpm_selected ] ; then
+                return 0
+        fi
 
-	if [ -e /etc/apache2/.apache2_mpm_selected ] ; then
+	if [ $SQUEEZE_UPGRADE -eq 1 ] ; then
 		return 0
 	fi
 
-	return 1
+	for CONFFILE in $OBSOLETE_CONFFILES ; do
+		SQUEEZE_UPGRADE=1
+		if [ -e "$CONFFILE.dpkg-backup" ] || [ -e "$CONFFILE.dpkg-remove" ] ; then
+			return 0
+		fi
+	done
+
+        return 1
 }
 
+
+# The function below is licensed GPL-2+ and was written by dpkg maintainers
+# See the dpkg-maintscript-helper script for details
+
+remove_conffiles()
+{
+        # we can't use dpkg-maintscript-helper as we shifted conffiles from the
+        # apache2.2-common package to apache2, too. The tool can cope with
+        # that, but additionally we didn't require apache2 to be installed. This
+        # yields the wrong result when upgrading such an installation
+        if we_are_upgrading_from_squeeze $@ ; then
+                for CONFFILE in $OBSOLETE_CONFFILES ; do
+                        if [ -e "$CONFFILE.dpkg-backup" ]; then
+                                mv -f "$CONFFILE.dpkg-backup" "$CONFFILE.dpkg-bak"
+                        fi
+                        if [ -e "$CONFFILE.dpkg-remove" ]; then
+                                echo "Removing obsolete conffile $CONFFILE ..."
+                                rm -f "$CONFFILE.dpkg-remove"
+                        fi
+                done
+        fi
+}
+
+
 enable_default_mpm()
 {
-	mpm="mpm_event"
-	if we_are_upgrading_from_squeeze $@ && [ -e /etc/apache2/.apache2_mpm_selected  ]; then
-		tmpmpm=$(grep -v "^#" /etc/apache2/.apache2_mpm_selected | head -n1)
-		case "$tmpmpm" in
-			apache2-mpm-worker)
-				mpm="mpm_worker"
-			;;
-
-			apache2-mpm-event)
-				mpm="mpm_event"
-			;;
-
-			apache2-mpm-prefork)
-				mpm="mpm_prefork"
-			;;
-
-			apache2-mpm-itk)
-				# Houston, we got a problem
-			;;
-
-			*)
-				# default MPM for upgrading in case we got an unrecognized
-				# hint file
-				mpm="mpm_event"
-			;;
-		esac
-	fi
-	a2enmod -q $mpm
+        mpm="mpm_event"
+        if we_are_upgrading_from_squeeze $@ && [ -e /etc/apache2/.apache2_mpm_selected  ]; then
+                tmpmpm=$(grep -v "^#" /etc/apache2/.apache2_mpm_selected | head -n1)
+                case "$tmpmpm" in
+                        apache2-mpm-worker)
+                                mpm="mpm_worker"
+                        ;;
+
+                        apache2-mpm-event)
+                                mpm="mpm_event"
+                        ;;
+
+                        apache2-mpm-prefork)
+                                mpm="mpm_prefork"
+                        ;;
+
+                        apache2-mpm-itk)
+                                # Houston, we got a problem
+                        ;;
+
+                        *)
+                                # default MPM for upgrading in case we got an unrecognized
+                                # hint file
+                                mpm="mpm_event"
+                        ;;
+                esac
+        fi
+        a2enmod -q $mpm
 }
 
 enable_default_modules()
@@ -76,94 +130,78 @@ enable_default_modules()
 install_default_site()
 {
 
-	if [ ! -L /etc/apache2/sites-enabled/000-default -a \
-		! -f /etc/apache2/sites-enabled/000-default ]; then
-			a2ensite -q default
-	fi
+        if [ ! -L /etc/apache2/sites-enabled/000-default -a \
+                ! -f /etc/apache2/sites-enabled/000-default ]; then
+                        a2ensite -q default
+        fi
 
-	touch /var/log/apache2/error.log /var/log/apache2/access.log
-	chown root:adm /var/log/apache2/error.log /var/log/apache2/access.log
-	chmod 0640 /var/log/apache2/error.log /var/log/apache2/access.log
+        touch /var/log/apache2/error.log /var/log/apache2/access.log
+        chown root:adm /var/log/apache2/error.log /var/log/apache2/access.log
+        chmod 0640 /var/log/apache2/error.log /var/log/apache2/access.log
 }
 
 install_default_files()
 {
 	if [ ! -e /var/www/index.html ] ; then
 		cp /usr/share/apache2/default-site/index.html /var/www/index.html
-        fi
+	fi
 }
 
 # XXX: Find out whether I am on crack removing stale modules that way
 refresh_modules()
 {
-	if we_are_upgrading_from_squeeze $@ && [ -d /etc/apache2/mods-enabled/ ] ; then
-		shopt -s nullglob
-		for link in /etc/apache2/mods-enabled/*.load ; do
-			target=$(readlink "$link") || true
-			if [ -z $target ] ; then
-				continue
-			fi
-			case "$target" in
-			*/disk_cache.load)
-				a2dismod -q disk_cache
-				a2enmod -q cache_disk
-				# XXX: Handle rename of conf file
-				continue
-				;;
-			esac
-
-			module=$(basename "$link" | sed 's/\.load//') || true
-
-			if [ ! -e "/etc/apache2/mods-enabled/$target" ] ; then
-				echo "disable obsolete module $module"
-				a2dismod -q $module
-			fi
-			# the module is already enabled, however
-			# dependencies could have changed hence re-call
-			# a2enmod again.
-			# Example: the deflate module when upgraded from
-			# Squeeze
-			if [ -e "/etc/apache2/mods-enabled/$target" ] ; then
-				a2enmod -q $module
-			fi
-		done
-	fi
+       if we_are_upgrading_from_squeeze $@ && [ -d /etc/apache2/mods-enabled/ ] ; then
+                shopt -s nullglob
+                for link in /etc/apache2/mods-enabled/*.load ; do
+                        target=$(readlink "$link") || true
+                        if [ -z $target ] ; then
+                                continue
+                        fi
+
+                        module=$(basename "$link" | sed 's/\.load//') || true
+
+                        if [ ! -e "/etc/apache2/mods-enabled/$target" ] ; then
+                                echo "disable obsolete module $module"
+                                a2dismod -q $module
+
+				# XXX enable cache_disk if the used had
+				# disk_cache enabled
+                        fi
+                        # the module is already enabled, however
+                        # dependencies could have changed hence re-call
+                        # a2enmod again.
+                        # Example: the deflate module when upgraded from
+                        # Squeeze
+                        if [ -e "/etc/apache2/mods-enabled/$target" ] ; then
+                                a2enmod -q $module
+                        fi
+                done
+        fi
 }
 
 #XXX: Move /var/cache/apache2/mod_disk_cache to /var/cache/apache2/mod_cache_disk?
-#XXX: Handle rename of conf.d/*
 #XXX: Move httpd.conf into conf.d if not empty, add comment what it used to be
 
 
-#DEBHELPER#
-
-# remove dangling symlinks of disabled modules. This needs to be executed after
-# DEBHELPER removing conffiles. dpkg will remove conffiles only if apache2 is
-# installed. If only apache2.2-common was installed instead, the code turns into
-# a no-op. Do we need to take care of that? If yes, we need to write oure own
-# maintainer-scripts-helper
-
 case "$1" in
         configure)
 
-	refresh_modules $@
-
-	enable_default_mpm $@
+                remove_conffiles $@
+                refresh_modules $@
+                enable_default_mpm $@
+                install_default_files $@
+                enable_default_modules $@
 
-	install_default_files $@
+                if [ -z "$2" ]; then
+                        install_default_site
+                fi
 
-        enable_default_modules $@
+                # post installation cleanup
+                if [ -e /etc/apache2/.apache2_mpm_selected ] ; then
+                        rm -f /etc/apache2/.apache2_mpm_selected
+                fi
 
-	if [ -z "$2" ]; then
-		install_default_site
-	fi
-
-	# post installation cleanup
-	if [ -e /etc/apache2/.apache2_mpm_selected ] ; then
-		rm -f /etc/apache2/.apache2_mpm_selected
-	fi
-
-        ;;
+       ;;
 
         abort-upgrade|abort-remove|abort-deconfigure)
 
@@ -175,4 +213,6 @@ case "$1" in
         ;;
 esac
 
+#DEBHELPER#
+
 exit 0
diff --git a/debian/apache2.postrm b/debian/apache2.postrm
new file mode 100644
index 0000000..b5f3f04
--- /dev/null
+++ b/debian/apache2.postrm
@@ -0,0 +1,78 @@
+#!/bin/sh
+# postrm script for apache2
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postrm> `remove'
+#        * <postrm> `purge'
+#        * <old-postrm> `upgrade' <new-version>
+#        * <new-postrm> `failed-upgrade' <old-version>
+#        * <new-postrm> `abort-install'
+#        * <new-postrm> `abort-install' <old-version>
+#        * <new-postrm> `abort-upgrade' <old-version>
+#        * <disappearer's-postrm> `disappear' <overwriter>
+#          <overwriter-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+OBSOLETE_CONFFILES="/etc/apache2/mods-available/authz_default.load
+/etc/apache2/mods-available/authn_default.load
+/etc/apache2/mods-available/mem_cache.load
+/etc/apache2/mods-available/mem_cache.conf
+/etc/apache2/mods-available/authn_alias.load
+/etc/apache2/mods-available/cern_meta.load
+/etc/apache2/mods-available/disk_cache.load
+/etc/apache2/mods-available/disk_cache.conf
+/etc/apache2/mods-available/ident.load
+/etc/apache2/mods-available/imagemap.load"
+
+
+case "$1" in
+    purge)
+
+        for CONFFILE in $OBSOLETE_CONFFILES ; do
+                rm -f "$CONFFILE.dpkg-bak" "$CONFFILE.dpkg-remove" "$CONFFILE.dpkg-backup"
+        done
+    ;;
+
+    abort-install|abort-upgrade)
+
+
+        for CONFFILE in $OBSOLETE_CONFFILES ; do
+
+                if [ -e "$CONFFILE.dpkg-remove" ]; then
+                        echo "Reinstalling $CONFFILE that was moved away"
+                        mv "$CONFFILE.dpkg-remove" "$CONFFILE"
+                fi
+                if [ -e "$CONFFILE.dpkg-backup" ]; then
+                        echo "Reinstalling $CONFFILE that was backupped"
+                        mv "$CONFFILE.dpkg-backup" "$CONFFILE"
+                fi
+        done
+
+        # post installation cleanup
+        if [ -e /etc/apache2/.apache2_mpm_selected ] ; then
+                rm -f /etc/apache2/.apache2_mpm_selected
+        fi
+
+    ;;
+
+    remove|upgrade|failed-upgrade|disappear)
+    ;;
+
+    *)
+        echo "postrm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/apache2.preinst b/debian/apache2.preinst
index 6b6f0e1..ad759b8 100644
--- a/debian/apache2.preinst
+++ b/debian/apache2.preinst
@@ -14,10 +14,59 @@ set -e
 # the debian-policy package
 
 
+OBSOLETE_CONFFILES="/etc/apache2/mods-available/authz_default.load
+/etc/apache2/mods-available/authn_default.load
+/etc/apache2/mods-available/mem_cache.load
+/etc/apache2/mods-available/mem_cache.conf
+/etc/apache2/mods-available/authn_alias.load
+/etc/apache2/mods-available/cern_meta.load
+/etc/apache2/mods-available/disk_cache.load
+/etc/apache2/mods-available/disk_cache.conf
+/etc/apache2/mods-available/ident.load
+/etc/apache2/mods-available/imagemap.load"
+
+
+obsolete_conffile_exists()
+{
+	for CONFFILE in $OBSOLETE_CONFFILES ; do
+		if [ -e "$CONFFILE" ] ; then
+			return 0
+		fi
+	done
+
+	return 1
+}
+
+# The function below is licensed GPL-2+ and was written by dpkg maintainers
+# See the dpkg-maintscript-helper script for details
+prepare_rm_conffile()
+{
+        for CONFFILE in $OBSOLETE_CONFFILES ; do
+                [ -e "$CONFFILE" ] || continue
+
+                local md5sum="$(md5sum $CONFFILE | sed -e 's/ .*//')"
+                local old_md5sum="$(dpkg-query -W -f='${Conffiles}' $PACKAGE | \
+                        sed -n -e "\' $CONFFILE ' { s/ obsolete$//; s/.* //; p }")"
+                if [ "$md5sum" != "$old_md5sum" ]; then
+                        echo "Obsolete conffile $CONFFILE has been modified by you."
+                        echo "Saving as $CONFFILE.dpkg-bak ..."
+                        mv -f "$CONFFILE" "$CONFFILE.dpkg-backup"
+                else
+                        echo "Moving obsolete conffile $CONFFILE out of the way..."
+                        mv -f "$CONFFILE" "$CONFFILE.dpkg-remove"
+                fi
+        done
+}
+
+
+
 case "$1" in
     install|upgrade)
 
-        if [ ! -z "$2" ] && [ -d "/etc/apache2/" ] ; then
+        # black magic follows below. we're upgrading from Squeeze if
+
+        # 1) an apache2-mpm package exists
+        if [ -n "$2" ] && [ -d "/etc/apache2/" ] ; then
             mpm=$(dpkg-query -f '${Package}\t${Status}\n'  -W 'apache2-mpm-*' 2>/dev/null) || true
             if [ $? -eq 0 ] ; then
                 mpm=$(echo "$mpm" | grep "install ok" | cut -f1)
@@ -28,6 +77,13 @@ case "$1" in
                 fi
             fi
         fi
+
+        # 2) an apache2.2-common conffiles exists or the 2.2 apache2 package is
+	# installed
+	if [ -n "$2" ] || obsolete_conffile_exists ; then
+		prepare_rm_conffile
+       fi
+
     ;;
 
     abort-upgrade)
diff --git a/debian/changelog b/debian/changelog
index 11ffa4d..a7b2299 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -61,6 +61,8 @@ apache2 (2.3.16-beta-1) UNRELEASED; urgency=low
   * Changes in a2enmod:
     + Parse "Conflicts: " header to denote conflicts between modules which
       cannot be loaded into the same Apache server.
+    + Remove dangling "module.conf" files, too. They were forgotten previously
+      if they existed and only the "module.load" file was removed.
   * The following modules and associated configuration files were removed:
     + mod_authz_default and mod_authn_default: Please use a proper
       authentication module instead
@@ -76,7 +78,7 @@ apache2 (2.3.16-beta-1) UNRELEASED; urgency=low
   * Only include conf.d/*.conf, not conf.d/*.
   * Don't create httpd.conf anymore.
 
- -- Arno Töll <debian at toell.net>  Sat, 11 Feb 2012 03:30:10 +0100
+ -- Arno Töll <debian at toell.net>  Mon, 13 Feb 2012 02:00:02 +0100
 
 apache2 (2.2.22-1) unstable; urgency=low
 
diff --git a/debian/config-dir/mods-available/authz_dbd.load b/debian/config-dir/mods-available/authz_dbd.load
index 097eccd..cf82cae 100644
--- a/debian/config-dir/mods-available/authz_dbd.load
+++ b/debian/config-dir/mods-available/authz_dbd.load
@@ -1,2 +1,2 @@
-# Depends: dbd, authz_core
+# Depends: dbd authz_core
 LoadModule authz_dbd_module /usr/lib/apache2/modules/mod_authz_dbd.so
diff --git a/debian/config-dir/mods-available/proxy_balancer.load b/debian/config-dir/mods-available/proxy_balancer.load
index 209bd0e..2baa546 100644
--- a/debian/config-dir/mods-available/proxy_balancer.load
+++ b/debian/config-dir/mods-available/proxy_balancer.load
@@ -1,2 +1,2 @@
-# Depends: proxy, alias, slotmem_shm
+# Depends: proxy alias slotmem_shm
 LoadModule proxy_balancer_module /usr/lib/apache2/modules/mod_proxy_balancer.so
diff --git a/debian/gbp.conf b/debian/gbp.conf
index 3dbd4af..844f3d9 100644
--- a/debian/gbp.conf
+++ b/debian/gbp.conf
@@ -1,5 +1,7 @@
 [DEFAULT]
 pristine-tar = True
+builder=dpkg-buildpackage -i\.git -I.git
+cleaner=true
 
 [git-buildpackage]
-git-debian-branch=next
+debian-branch=next

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



More information about the Pkg-apache-commits mailing list