httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wilfredo Sanchez <wsanc...@apple.com>
Subject [PATCH: apxs: don't screw up second -a invocation]
Date Thu, 08 Jul 1999 03:24:10 GMT
At Rasmus' suggestion-

  This patch allows one to run apxs -a/-A multiple times without  
getting duplicate entries.  If the entry is already there, it simply  
enables or disables it.

  I tried it out by using it in my wrapper makefile to  
enable/disable the default modules after building apache. (I use  
--enable=max so our users don't have to build the rest, but we don't  
want them all turned on in the default config just because we built  
them.)

  Unfortunately, apxs does not handle the some modules because the  
AddModule directive for them isn't consistant with the rest. It tries  
to enable the following AddModule directives:

	mod_action.c
	mod_anon_auth.c
	mod_dbm_auth.c
	mod_includes.c
	mod_config_log.c

  But the actual names used by these modules are slightly different  
(eg. mod_includes is mod_include).  I imagine that trying to fix that  
will get me into trouble.

  Anyway, which this patch, you can use apxs to enable and disable  
your modules, except for the above set.

  I live the patch, but I dislike the 90% nature of its  
functionality due to the above.

	-Fred


Index: apxs.pl
===================================================================
RCS file: /CVSRoot/CoreOS/Services/apache/apache/src/support/apxs.pl,v
retrieving revision 1.6
diff -u -d -b -w -r1.6 apxs.pl
--- apxs.pl     1999/07/08 01:26:39     1.6
+++ apxs.pl     1999/07/08 03:14:33
@@ -485,29 +485,28 @@
             exit(1);
         }

-        my $update = 0;
         my $lmd;
-        foreach $lmd (@lmd) {
-            if ($content !~ m|\n#?\s*$lmd|) {
                  my $c = '';
                  $c = '#' if ($opt_A);
+        foreach $lmd (@lmd) {
+            my $what = $opt_A ? "preparing" : "activating";
+            if ($content !~ m|\n#?\s*$lmd|) {
                  $content =~  
s|^(.*\n#?\s*LoadModule\s+[^\n]+\n)|$1$c$lmd\n|sg;
-                 $update = 1;
+            } else {
+                 $content =~ s|^(.*\n)#?\s*$lmd[^\n]*\n|$1$c$lmd\n|sg;
+            }
                  $lmd =~ m|LoadModule\s+(.+?)_module.*|;
-                 my $what = $opt_A ? "preparing" : "activating";
                  print STDERR "[$what module `$1' in  
$CFG_SYSCONFDIR/$CFG_TARGET.conf]\n";
             }
-        }
         my $amd;
         foreach $amd (@amd) {
             if ($content !~ m|\n#?\s*$amd|) {
-                 my $c = '';
-                 $c = '#' if ($opt_A);
                  $content =~  
s|^(.*\n#?\s*AddModule\s+[^\n]+\n)|$1$c$amd\n|sg;
-                 $update = 1;
+            } else {
+                 $content =~ s|^(.*\n)#?\s*$amd[^\n]*\n|$1$c$amd\n|sg;
             }
         }
-        if ($update) {
+        if (@lmd or @amd) {
             open(FP, ">$CFG_SYSCONFDIR/$CFG_TARGET.conf.new") || die;
             print FP $content;
             close(FP);
Index: apxs.8
===================================================================
RCS file: /CVSRoot/CoreOS/Services/apache/apache/src/support/apxs.8,v
retrieving revision 1.2
diff -u -d -b -w -r1.2 apxs.8
--- apxs.8      1999/07/08 01:26:39     1.2
+++ apxs.8      1999/07/08 03:19:42
@@ -332,20 +332,18 @@
 directory.
 .TP 12
 .B \-a
-This additionally activates the module
-by automatically adding a corresponding
+This activates the module by automatically adding a corresponding
 .B LoadModule
 line to Apache's
 .B httpd.conf
-configuration file (only if no such entry exists yet).
+configuration file, or by enabling it if it already exists.
 .TP 12
 .B \-A
 Same as option
 .B \-a
 but the created
 .B LoadModule
-directive is
-prefixed with a hash sign (#), i.e. the module is
+directive is prefixed with a hash sign (#), i.e. the module is
 just prepared for later activation but initially disabled.
 .TP 12
 .B \-e


--
       Wilfredo Sanchez, wsanchez@apple.com
Apple Computer, Inc., Core Operating Systems / BSD
          Technical Lead, Darwin Project
   1 Infinite Loop, 302-4K, Cupertino, CA 95014


Mime
View raw message