[Pkg-apache-commits] [SCM] Debian packaging for apache2 (Apache HTTPD 2.x) branch, next, updated. 9ec48db0b5d22d0a589e3b13eb011d1ecc1a1d56
Arno Töll
arno at debian.org
Thu Apr 26 23:01:13 UTC 2012
The following commit has been merged in the next branch:
commit 99736d603d0a02a5c51783e4ae617699b7552440
Author: Arno Töll <arno at debian.org>
Date: Thu Apr 26 22:15:29 2012 +0200
* Add a -p|--purge option to a2enmod which purges the internal state data base
* Make use of --purge in apache2-maintscript-helper
* Guess upgrades from a pre-maintscript version in apache2-maintscript-helper
* Document -p switch in man pages
diff --git a/debian/a2enmod b/debian/a2enmod
old mode 100644
new mode 100755
index 764eaf9..1600790
--- a/debian/a2enmod
+++ b/debian/a2enmod
@@ -15,12 +15,14 @@ use Getopt::Long;
my $quiet;
my $force;
my $maintmode;
+my $purge;
Getopt::Long::Configure('bundling');
GetOptions(
'quiet|q' => \$quiet,
'force|f' => \$force,
- 'maintmode|m' => \$maintmode
+ 'maintmode|m' => \$maintmode,
+ 'purge|p' => \$purge
) or exit 2;
my $basename = basename($0);
@@ -507,11 +509,13 @@ sub switch_marker {
error("Failed to remove old marker '$_'!\n") && return 0;
}
}
- qx{touch "$state_marker"};
- if ( $? != 0 ) {
- error("Failed to create marker '$state_marker'!\n") && return 0;
+ unless ($purge) {
+ qx{touch "$state_marker"};
+ if ( $? != 0 ) {
+ error("Failed to create marker '$state_marker'!\n") && return 0;
+ }
+ return 1;
}
- return 1;
}
# vim: syntax=perl sw=4 sts=4 sr et
diff --git a/debian/a2query.in b/debian/a2query.in
index bf40d9c..38f43e1 100755
--- a/debian/a2query.in
+++ b/debian/a2query.in
@@ -62,10 +62,10 @@ our $CONFIG_DIR = "/etc/apache2";
# time to introduce more _exit_ values
our $E_OK = '0';
our $E_FOUND = '0';
-our $E_ONBYMAINT = '1';
-our $E_NOTFOUND = '32';
+our $E_NOTFOUND = '1';
+our $E_OFFBYADMIN = '32';
our $E_OFFBYMAINT = '33';
-our @RETVALS = ( $E_OK, $E_FOUND, $E_ONBYMAINT, $E_NOTFOUND, $E_OFFBYMAINT );
+our @RETVALS = ( $E_OK, $E_FOUND, $E_OFFBYADMIN, $E_NOTFOUND, $E_OFFBYMAINT );
our @MODULES = ();
our @CONFS = ();
@@ -99,8 +99,9 @@ are known to be compatible with the major version returned.
=item S<-c> [I<CONF>]
Checks whether the configuration I<CONF> is enabled. If no argument was given,
-all enabled configuration files are being returned. I<CONF> is evaluated as
-L<perl>(1) compatible regular expression.
+all enabled configuration files are being returned. I<CONF> is compared by
+string comparison by ignoring a leading "mod_" prefix and possibly a '.conf' or
+'.load' suffix.
=item S<-h>
@@ -133,7 +134,8 @@ B<a2query> returns with a zero (S<0>) exit status if the requested operation was
effectuated successfully and with a non-zero status otherwise. In case of an
error it leaves with error code S<32> if a requested module, site or
configuration was not found and S<33> if a module, site or configuration was
-disabled by a maintainer script.
+disabled by a maintainer script. However, exit status S<1> is returned if the
+module was not found at all
=head1 SEE ALSO
@@ -267,12 +269,21 @@ sub query_state
my $pattern = shift;
my $listref = shift;
- my $matches = 0;
- if (not $pattern)
+ $pattern =~ s/^mod//;
+ $pattern =~ s/\.(conf|load)//;
+ my @candidates;
+
+ if ($pattern)
+ {
+ @candidates = grep { $_ eq $pattern } @{ $listref };
+ }
+ else
{
- $pattern = ".";
+ @candidates = @{ $listref }
}
- foreach my $module (grep { $_ =~ m/$pattern/ } @{ $listref })
+
+ my $matches = 0;
+ foreach my $module (@candidates)
{
my $state = switch_history($type, "enabled", $module);
if (!$state)
@@ -294,6 +305,10 @@ sub query_state
{
$retval = $E_OFFBYMAINT;
}
+ if ($state eq 'admin')
+ {
+ $retval = $E_OFFBYADMIN;
+ }
}
fail($reason, $retval);
}
diff --git a/debian/debhelper/apache2-maintscript-helper b/debian/debhelper/apache2-maintscript-helper
index 02d7933..b8fbdb2 100644
--- a/debian/debhelper/apache2-maintscript-helper
+++ b/debian/debhelper/apache2-maintscript-helper
@@ -173,7 +173,7 @@ apache2_has_module()
{
[ -x /usr/sbin/a2query ] || return 1
local MODULE="$1"
- if a2query -m "^$MODULE\$" > /dev/null ; then
+ if a2query -m "$MODULE" > /dev/null ; then
return 0
fi
@@ -261,11 +261,6 @@ apache2_invoke()
[ -x "/usr/sbin/a2$CMD" ] || return 1
[ -x "/usr/sbin/a2query" ] || return 1
- if ! apache2_needs_action ; then
- apache2_msg "info" "apache2_invoke $CONF: No action required"
- return 0
- fi
-
case "$CMD" in
*conf)
check_switch="-c"
@@ -286,9 +281,21 @@ apache2_invoke()
;;
esac
+ if ! apache2_needs_action ; then
+ # this is a trapdoor. Do act in any case we have no traces of
+ # the configuration. This might be the case for upgrades from
+ # Squeeze.
+ (a2query $check_switch "$CONF" > /dev/null 2>&1)
+ if [ ! "$?" -eq 1 ] ; then
+ apache2_msg "info" "apache2_invoke $CONF: No action required"
+ return 0
+ fi
+ fi
+
+
case "$CMD" in
enconf|enmod|ensite)
- if a2query $check_switch "^$CONF\$" > /dev/null 2>&1 ; then
+ if a2query $check_switch "$CONF" > /dev/null 2>&1 ; then
continue
fi
invoke_rcd=1
@@ -299,8 +306,7 @@ apache2_invoke()
if a2query $check_switch $CONF > /dev/null 2>&1 ; then
invoke_rcd=1
if [ "$APACHE2_MAINTSCRIPT_NAME" = 'postrm' ] && [ "$APACHE2_MAINTSCRIPT_METHOD" = "purge" ] ; then
- #XXX: Replace me by the "forget-state-switch" call
- a2$CMD -f -q "$CONF" || return 1
+ a2$CMD -p -f -q "$CONF" || return 1
else
a2$CMD -m -f -q "$CONF" || return 1
fi
diff --git a/debian/debhelper/dh_apache2.in b/debian/debhelper/dh_apache2.in
index 3b31187..7442d8e 100755
--- a/debian/debhelper/dh_apache2.in
+++ b/debian/debhelper/dh_apache2.in
@@ -233,6 +233,11 @@ build-depend on debhelper >= 9.20120311 to avoid this problem). The expression
should be provided in the postrm and postinst scripts before the B<#DEBHELPER#>
token.
+=item S<B<--restart>> S<B<-r>
+
+In maintainer scripts, do not try to reload the web server, but restart it. The
+default is to reload it.
+
=item B<-n>, B<--noscripts>
Do not modify F<postinst>/F<postrm>/F<prerm> maintainer scripts.
@@ -289,6 +294,7 @@ This manual and L<dh_apache2> was written by Arno Toell <debian at toell.net>.
init(options => {
"conditional=s" => \$dh{CONDITIONAL},
+ "r|restart" => \$dh{RESTART},
});
if (!$dh{CONDITIONAL})
@@ -296,6 +302,15 @@ if (!$dh{CONDITIONAL})
$dh{CONDITIONAL} = 'true';
}
+if (!$dh{RESTART})
+{
+ $dh{RESTART} = 'reload';
+}
+else
+{
+ $dh{RESTART} = 'restart'
+}
+
foreach my $package (getpackages())
{
my %PACKAGE_TYPE = (
@@ -480,6 +495,7 @@ foreach my $package (getpackages())
NAMES => $ref->[1],
ERROR_HANDLER => $PACKAGE_TYPE{handler},
CONDITIONAL_VARIABLE => $PACKAGE_TYPE{conditional},
+ ACTION => $dh{RESTART},
);
if ($script_type eq "postrm")
diff --git a/debian/manpages/a2enconf.8 b/debian/manpages/a2enconf.8
index 978120d..57336c7 100644
--- a/debian/manpages/a2enconf.8
+++ b/debian/manpages/a2enconf.8
@@ -56,6 +56,9 @@ Don't show informative messages.
Enables the maintainer mode, that is the program invokation is effectuated
automatically by a maintainer script. This switch should not be used by end
users.
+.B \-p, \-\-purge
+When disabling a module, purge all traces of the module in the internal state
+data base.
.SH "EXIT STATUS"
.B a2enconf
and
diff --git a/debian/manpages/a2enmod.8 b/debian/manpages/a2enmod.8
index 4bc8b12..dadd4bc 100644
--- a/debian/manpages/a2enmod.8
+++ b/debian/manpages/a2enmod.8
@@ -56,6 +56,9 @@ Don't show informative messages.
Enables the maintainer mode, that is the program invokation is effectuated
automatically by a maintainer script. This switch should not be used by end
users.
+.B \-p, \-\-purge
+When disabling a module, purge all traces of the module in the internal state
+data base.
.SH "EXIT STATUS"
.B a2enmod
and
diff --git a/debian/manpages/a2ensite.8 b/debian/manpages/a2ensite.8
index 17291a7..b115d98 100644
--- a/debian/manpages/a2ensite.8
+++ b/debian/manpages/a2ensite.8
@@ -56,6 +56,9 @@ Don't show informative messages.
Enables the maintainer mode, that is the program invokation is effectuated
automatically by a maintainer script. This switch should not be used by end
users.
+.B \-p, \-\-purge
+When disabling a module, purge all traces of the module in the internal state
+data base.
.SH "EXIT STATUS"
.B a2ensite
and
--
Debian packaging for apache2 (Apache HTTPD 2.x)
More information about the Pkg-apache-commits
mailing list