INN commit: trunk/scripts (inncheck.in innupgrade.in)

INN Commit Russ_Allbery at isc.org
Sat Apr 11 22:15:35 UTC 2009


    Date: Saturday, April 11, 2009 @ 15:15:35
  Author: iulius
Revision: 8410

* Also update scripts (forgotten from previous /large/
commit 8409).

see #101

Modified:
  trunk/scripts/inncheck.in
  trunk/scripts/innupgrade.in

---------------+
 inncheck.in   |   55 -------------------------------------------------------
 innupgrade.in |   53 +++++++++++++++++++++++++++++++++++++++++------------
 2 files changed, 41 insertions(+), 67 deletions(-)

Modified: inncheck.in
===================================================================
--- inncheck.in	2009-04-11 22:13:41 UTC (rev 8409)
+++ inncheck.in	2009-04-11 22:15:35 UTC (rev 8410)
@@ -32,7 +32,6 @@
     'newsbin',		"$INN::Config::pathbin",
     'newsboot',		"$INN::Config::pathbin/rc.news",
     'newsfeeds',	"$INN::Config::newsfeeds",
-    'overview.fmt',	"$INN::Config::pathetc/overview.fmt",
     'newsetc',		"$INN::Config::pathetc",
     'newslib',		"$INN::Config::newslib",
     'nnrpd',		"$INN::Config::pathbin/nnrpd",
@@ -57,7 +56,6 @@
     'inn.conf',		'inn_conf',
     'moderators',	'moderators',
     'newsfeeds',	'newsfeeds',
-    'overview.fmt',	'overview_fmt',
     'nntpsend.ctl',	'nntpsend_ctl',
     'passwd.nntp',	'passwd_nntp',
     'readers.conf',	'readers_conf'
@@ -73,7 +71,6 @@
     'inn.conf',		[0400, 0664],
     'moderators',	[0400, 0664],
     'newsfeeds',	[0400, 0664],
-    'overview.fmt',	[0400, 0664],
     'passwd.nntp',	[0400, 0660],
 );
 
@@ -543,57 +540,6 @@
 
 
 ##
-##  overview.fmt
-##
-#%overview_fmtheaders = (
-#    'Approved',		1,
-#    'Bytes',		1,
-#    'Control',		1,
-#    'Date',		1,
-#    'Distribution',	1,
-#    'Expires',		1,
-#    'From',		1,
-#    'Lines',		1,
-#    'Message-ID',	1,
-#    'Newsgroups',	1,
-#    'Path',		1,
-#    'References',	1,
-#    'Reply-To',		1,
-#    'Sender',		1,
-#    'Subject',		1,
-#    'Supersedes',	1,
-#);
-
-sub
-overview_fmt
-{
-    local ($header, $mode, $sawfull);
-
-    $sawfull = 0;
-    input: while ( <IN> ) {
-	next input if &spacious($file, ++$line);
-
-	unless ( ($header, $mode) = /^([^:]+):([^:]*)$/ ) {
-	    print "$file:$line: malformed line.\n";
-	    next input;
-	}
-
-	#print "$file:$line: unknown header `$header'\n"
-	#    if !defined $overview_fmtheaders{$header};
-	if ( $mode eq "full" ) {
-	    $sawfull++;
-	} elsif ( $mode eq "" ) {
-	    print "$file:$line: short header `$header' appears after full one\n"
-		if $sawfull;
-	} else {
-	    print "$file:$line: unknown mode `$mode'\n";
-	}
-    }
-    1;
-}
-
-
-##
 ##  nntpsend.ctl
 ##
 sub
@@ -945,7 +891,6 @@
     &moderators();
     &nntpsend_ctl();
     &newsfeeds();
-    &overview_fmt();
     &passwd_nntp();
     &readers_conf();
 }

Modified: innupgrade.in
===================================================================
--- innupgrade.in	2009-04-11 22:13:41 UTC (rev 8409)
+++ innupgrade.in	2009-04-11 22:15:35 UTC (rev 8410)
@@ -22,6 +22,7 @@
 ##   * Clean up inn.conf for the new parser in INN 2.4.
 ##   * Add the hismethod parameter to inn.conf if not found.
 ##   * Rename nntpactsync to incominglogfrequency in inn.conf.
+##   * Move parameters from overview.fmt to inn.conf if needed.
 ##   * Move parameters from sasl.conf to inn.conf if needed.
 ##   * Change startinnfeed to innfeed or imapfeed in newsfeeds.
 
@@ -47,7 +48,7 @@
 sub fix_inn_conf {
     my ($input, $output, $file) = @_;
     my $line = 0;
-    my ($raw, $hismethod, $tls);
+    my ($raw, $hismethod, $overview, $tls);
     local $_;
     for $raw (@$input) {
         $_ = $raw;
@@ -72,19 +73,21 @@
             next;
         }
 
+        $hismethod = 1 if $key eq 'hismethod';
+        $overview = 1 if $key =~ /^extraoverview(advertised|hidden)$/;
+        $tls = 1 if $key =~ /^tls(capath|cafile|certfile|keyfile)$/;
+
+        if ($key eq 'nntpactsync') {
+            $key = 'incominglogfrequency';
+        }
+
         # A list value (on only one line).
+        # This condition must occur after having checked for $overview.
         if ($value =~ /^\[/) {
             push (@$output, "$_\n");
             next;
         }
 
-        $hismethod = 1 if $key eq 'hismethod';
-
-        if ($key eq 'nntpactsync') {
-            $key = 'incominglogfrequency';
-        }
-
-        $tls = 1 if $key =~ /^tls(capath|cafile|certfile|keyfile)$/;
         $value =~ s/\s+$//;
         if ($value =~ /[\s;\"<>\[\]\\{}]/ && $value !~ /^\".*\"\s*$/) {
             $value =~ s/([\"\\])/\\$1/g;
@@ -96,9 +99,35 @@
 
     # Add a setting of hismethod if one wasn't present in the original file.
     unless ($hismethod) {
-        push (@$output, "\n# Added by innupgrade\nhismethod: hisv6\n");
+        push (@$output, "\n# Added by innupgrade.\nhismethod: hisv6\n");
     }
 
+    # Import the settings from overview.fmt if present and not found in inn.conf.
+    if (!$overview && -f 'overview.fmt') {
+        open (OVERVIEWFMT, 'overview.fmt') or die "Can't open overview.fmt: $!\n";
+        my (@extraoverview, $foundxref);
+        while (<OVERVIEWFMT>) {
+            # Find out what follows the *first* "Xref:full" in the file.
+            # One "Xref" is already advertised as the eighth field in
+            # the overview database.
+            if (!$foundxref) {
+                $foundxref = 1 if (/Xref:full/i && !/^\s*\#/);
+                next;
+            }
+            next if /^\s*\#/ || !/:full/i;
+            chomp;
+            s/\s//g;
+            s/:full.*$//i;
+            push (@extraoverview, $_);
+        }
+        close (OVERVIEWFMT);
+        if ($#extraoverview > 0) {
+            push (@$output, "\n# Moved from overview.fmt by innupgrade.\n");
+            push (@$output, "extraoverviewadvertised: [ " .
+                            join (" ", @extraoverview) . " ]\n");
+        }
+    }
+
     # Import the settings from sasl.conf if present and not found in inn.conf.
     if (!$tls && -f 'sasl.conf') {
         open (SASL, 'sasl.conf') or die "Can't open sasl.conf: $!\n";
@@ -111,9 +140,9 @@
             s/^(\s*)tls_key_file:/tlskeyfile:/;
             push (@sasl, $_);
         }
-        close SASL;
+        close (SASL);
         if ($found) {
-            push (@$output, "\n# Moved from sasl.conf by innupgrade\n");
+            push (@$output, "\n# Moved from sasl.conf by innupgrade.\n");
             push (@$output, @sasl);
         }
     }
@@ -205,7 +234,7 @@
             upgrade_file ($file, $FIXES{$file});
         }
     }
-    closedir DIR;
+    closedir (DIR);
 }
 
 




More information about the inn-committers mailing list