[Pkg-apache-commits] r1115 - in /trunk/apache2: README.Debian changelog patches/00list patches/076_apxs2_a2enmod.dpatch

sf at alioth.debian.org sf at alioth.debian.org
Sat Jan 2 21:44:03 UTC 2010


Author: sf
Date: Sat Jan  2 21:44:03 2010
New Revision: 1115

URL: http://svn.debian.org/wsvn/pkg-apache/?sc=1&rev=1115
Log:
Make apxs2 use a2enmod and /etc/apache2/mods-available. Closes: #470178,
LP: #500703

Added:
    trunk/apache2/patches/076_apxs2_a2enmod.dpatch   (with props)
Modified:
    trunk/apache2/README.Debian
    trunk/apache2/changelog
    trunk/apache2/patches/00list

Modified: trunk/apache2/README.Debian
URL: http://svn.debian.org/wsvn/pkg-apache/trunk/apache2/README.Debian?rev=1115&op=diff
==============================================================================
--- trunk/apache2/README.Debian (original)
+++ trunk/apache2/README.Debian Sat Jan  2 21:44:03 2010
@@ -144,6 +144,8 @@
 
 a2ensite and a2dissite do essentially the same thing as the above tools, but
 for sites rather than modules.
+
+apxs2 -a/-A is modified to use a2enmod to activate newly installed modules.
 
 
 Using mod_disk_cache

Modified: trunk/apache2/changelog
URL: http://svn.debian.org/wsvn/pkg-apache/trunk/apache2/changelog?rev=1115&op=diff
==============================================================================
--- trunk/apache2/changelog (original)
+++ trunk/apache2/changelog Sat Jan  2 21:44:03 2010
@@ -12,12 +12,14 @@
     Closes: #483219
   * Re-introduce objcopy magic to avoid dangling symlinks to the debug info
     in the mpm packages. Closes: #563278
+  * Make apxs2 use a2enmod and /etc/apache2/mods-available. Closes: #470178,
+    LP: #500703
   * Point to README.backtrace in apache2-dbg's description.
   * Use more debhelper functions to simplify debian/rules.
   * Add misc-depends to various packages to make lintian happy.
   * Change build-dep from libcap2-dev to libcap-dev because of package rename.
 
- -- Stefan Fritsch <sf at debian.org>  Sat, 02 Jan 2010 17:41:40 +0100
+ -- Stefan Fritsch <sf at debian.org>  Sat, 02 Jan 2010 22:32:27 +0100
 
 apache2 (2.2.14-4) unstable; urgency=low
 

Modified: trunk/apache2/patches/00list
URL: http://svn.debian.org/wsvn/pkg-apache/trunk/apache2/patches/00list?rev=1115&op=diff
==============================================================================
--- trunk/apache2/patches/00list (original)
+++ trunk/apache2/patches/00list Sat Jan  2 21:44:03 2010
@@ -25,6 +25,7 @@
 073_mod_dav_trunk_fixes.dpatch
 074_link_support_progs_with_lcrypt.dpatch
 075_mod_rewrite_literal_ipv6_redirect.dpatch
+076_apxs2_a2enmod.dpatch
 099_config_guess_sub_update
 200_cp_suexec.dpatch
 201_build_suexec-custom.dpatch

Added: trunk/apache2/patches/076_apxs2_a2enmod.dpatch
URL: http://svn.debian.org/wsvn/pkg-apache/trunk/apache2/patches/076_apxs2_a2enmod.dpatch?rev=1115&op=file
==============================================================================
--- trunk/apache2/patches/076_apxs2_a2enmod.dpatch (added)
+++ trunk/apache2/patches/076_apxs2_a2enmod.dpatch Sat Jan  2 21:44:03 2010
@@ -1,0 +1,146 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 076_apxs2_a2enmo.dpatch by Stefan Fritsch <sf at debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Make apxs2 use a2enmod and /etc/apache2/mods-available
+
+ at DPATCH@
+diff -urNad trunk~/support/apxs.in trunk/support/apxs.in
+--- trunk~/support/apxs.in	2010-01-02 21:52:57.828866228 +0100
++++ trunk/support/apxs.in	2010-01-02 21:55:48.375597120 +0100
+@@ -522,7 +522,7 @@
+ 	# $dir =~ s|^$CFG_PREFIX/?||;
+         $dir =~ s|(.)$|$1/|;
+ 	$t =~ s|\.la$|.so|;
+-        push(@lmd, sprintf("LoadModule %-18s %s", "${name}_module", "$dir$t"));
++        push(@lmd, [ $name, sprintf("LoadModule %-18s %s", "${name}_module", "$dir$t") ] );
+     }
+ 
+     #   execute the commands
+@@ -530,105 +530,35 @@
+ 
+     #   activate module via LoadModule/AddModule directive
+     if ($opt_a or $opt_A) {
+-        if (not -f "$CFG_SYSCONFDIR/httpd.conf") {
+-            error("Config file $CFG_SYSCONFDIR/httpd.conf not found");
+-            exit(1);
+-        }
+-
+-        open(FP, "<$CFG_SYSCONFDIR/httpd.conf") || die;
+-        my $content = join('', <FP>);
+-        close(FP);
+-
+-        if ($content !~ m|\n#?\s*LoadModule\s+|) {
+-            error("Activation failed for custom $CFG_SYSCONFDIR/httpd.conf file.");
+-            error("At least one `LoadModule' directive already has to exist.");
++        if (not -d "$CFG_SYSCONFDIR/mods-available") {
++            error("Config file $CFG_SYSCONFDIR/mods-available not found");
+             exit(1);
+         }
+ 
+-        my $lmd;
+-        my $c = '';
+-        $c = '#' if ($opt_A);
+-        foreach $lmd (@lmd) {
+-            my $what = $opt_A ? "preparing" : "activating";
+-            if ($content !~ m|\n#?\s*$lmd|) {
+-                # check for open <containers>, so that the new LoadModule
+-                # directive always appears *outside* of an <container>.
+-
+-                my $before = ($content =~ m|^(.*\n)#?\s*LoadModule\s+[^\n]+\n|s)[0];
+-
+-                # the '()=' trick forces list context and the scalar
+-                # assignment counts the number of list members (aka number
+-                # of matches) then
+-                my $cntopen = () = ($before =~ m|^\s*<[^/].*$|mg);
+-                my $cntclose = () = ($before =~ m|^\s*</.*$|mg);
+-
+-                if ($cntopen == $cntclose) {
+-                    # fine. Last LoadModule is contextless.
+-                    $content =~ s|^(.*\n#?\s*LoadModule\s+[^\n]+\n)|$1$c$lmd\n|s;
+-                }
+-                elsif ($cntopen < $cntclose) {
+-                    error('Configuration file is not valid. There are sections'
+-                          . ' closed before opened.');
+-                    exit(1);
++        my $entry;
++        foreach $entry (@lmd) {
++            my ($name, $lmd) = @{$entry};
++            my $filename = "$CFG_SYSCONFDIR/mods-available/$name.load";
++            if (-f $filename) {
++                my $cmd = "mv $filename $filename.bak~";
++                if (system($cmd) != 0) {
++                    die "'$cmd' failed\n";
+                 }
+-                else {
+-                    # put our cmd after the section containing the last
+-                    # LoadModule.
+-                    my $found =
+-                    $content =~ s!\A (               # string and capture start
+-                                  (?:(?:
+-                                    ^\s*             # start of conf line with a
+-                                    (?:[^<]|<[^/])   # directive which does not
+-                                                     # start with '</'
+-
+-                                    .*(?:$)\n        # rest of the line.
+-                                                     # the '$' is in parentheses
+-                                                     # to avoid misinterpreting
+-                                                     # the string "$\" as
+-                                                     # perl variable.
+-
+-                                    )*               # catch as much as possible
+-                                                     # of such lines. (including
+-                                                     # zero)
+-
+-                                    ^\s*</.*(?:$)\n? # after the above, we
+-                                                     # expect a config line with
+-                                                     # a closing container (</)
+-
+-                                  ) {$cntopen}       # the whole pattern (bunch
+-                                                     # of lines that end up with
+-                                                     # a closing directive) must
+-                                                     # be repeated $cntopen
+-                                                     # times. That's it.
+-                                                     # Simple, eh? ;-)
++            }
+ 
+-                                  )                  # capture end
+-                                 !$1$c$lmd\n!mx;
++            notice("[preparing module `$name' in $filename]");
++            open(FP, ">$filename") || die;
++            print FP "$lmd\n";
++            close(FP);
+ 
+-                    unless ($found) {
+-                        error('Configuration file is not valid. There are '
+-                              . 'sections opened and not closed.');
+-                        exit(1);
+-                    }
++            if ($opt_a) {
++                my $cmd = "a2enmod $name";
++                if (system($cmd) != 0) {
++                    die "'$cmd' failed\n";
+                 }
+-            } else {
+-                # replace already existing LoadModule line
+-                $content =~ s|^(.*\n)#?\s*$lmd[^\n]*\n|$1$c$lmd\n|s;
+-            }
+-            $lmd =~ m|LoadModule\s+(.+?)_module.*|;
+-            notice("[$what module `$1' in $CFG_SYSCONFDIR/httpd.conf]");
++            }               
++
+         }
+-        if (@lmd) {
+-            if (open(FP, ">$CFG_SYSCONFDIR/httpd.conf.new")) {
+-                print FP $content;
+-                close(FP);
+-                system("cp $CFG_SYSCONFDIR/httpd.conf $CFG_SYSCONFDIR/httpd.conf.bak && " .
+-                       "cp $CFG_SYSCONFDIR/httpd.conf.new $CFG_SYSCONFDIR/httpd.conf && " .
+-                       "rm $CFG_SYSCONFDIR/httpd.conf.new");
+-            } else {
+-                notice("unable to open configuration file");
+-            }
+-	}
+     }
+ }
+ 

Propchange: trunk/apache2/patches/076_apxs2_a2enmod.dpatch
------------------------------------------------------------------------------
    svn:executable = *




More information about the Pkg-apache-commits mailing list