[openssl-commits] [openssl] master update

Richard Levitte levitte at openssl.org
Sun May 22 09:00:05 UTC 2016


The branch master has been updated
       via  169a8e391e2956687e9f148719687a5ff6ffaa39 (commit)
      from  4591e5fb4168eb81d198a236d265d87256bf67c1 (commit)


- Log -----------------------------------------------------------------
commit 169a8e391e2956687e9f148719687a5ff6ffaa39
Author: Richard Levitte <levitte at openssl.org>
Date:   Sun May 22 01:26:45 2016 +0200

    Have doc-nit-check look for mandatory manual sections
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 util/doc-nit-check.pl | 40 ++++++++++++++++++++++++++++++++--------
 1 file changed, 32 insertions(+), 8 deletions(-)

diff --git a/util/doc-nit-check.pl b/util/doc-nit-check.pl
index 3cf260b..29599f3 100644
--- a/util/doc-nit-check.pl
+++ b/util/doc-nit-check.pl
@@ -12,33 +12,57 @@ use warnings;
 use strict;
 use Pod::Checker;
 use File::Find;
+use File::Basename;
 
 my $temp = '/tmp/docnits.txt';
 my $OUT;
 
+my %mandatory_sections =
+    ( '*'    => [ 'NAME', 'DESCRIPTION', 'COPYRIGHT' ],
+      1      => [ 'SYNOPSIS', '(COMMAND\s+)?OPTIONS' ],
+      3      => [ 'SYNOPSIS', 'RETURN\s+VALUES' ],
+      5      => [ ],
+      7      => [ ] );
+my %default_sections =
+    ( apps   => 1,
+      crypto => 3,
+      ssl    => 3 );
+
 sub check()
 {
+    my $filename = shift;
+    my $dirname = basename(dirname($filename));
     my $contents = '';
     {
         local $/ = undef;
-        open POD, $_ or die "Couldn't open $_, $!";
+        open POD, $filename or die "Couldn't open $filename, $!";
         $contents = <POD>;
         close POD;
     }
-    print $OUT "$_ doesn't start with =pod\n"
+    print $OUT "$filename doesn't start with =pod\n"
         if $contents !~ /^=pod/;
-    print $OUT "$_ doesn't end with =cut\n"
+    print $OUT "$filename doesn't end with =cut\n"
         if $contents !~ /=cut\n$/;
-    print $OUT "$_ more than one cut line.\n"
+    print $OUT "$filename more than one cut line.\n"
         if $contents =~ /=cut.*=cut/ms;
-    print $OUT "$_ missing copyright\n"
+    print $OUT "$filename missing copyright\n"
         if $contents !~ /Copyright .* The OpenSSL Project Authors/;
-    print $OUT "$_ copyright not last\n"
+    print $OUT "$filename copyright not last\n"
         if $contents =~ /head1 COPYRIGHT.*=head/ms;
-    print $OUT "$_ head2 in All uppercase\n"
+    print $OUT "$filename head2 in All uppercase\n"
         if $contents =~ /head2.*[A-Z ]+\n/;
 
-    podchecker($_, $OUT);
+    my $section = $default_sections{$dirname};
+    if ($contents =~ /^=for\s+comment\s+openssl_manual_section:\s*(\d+)\s*$/m) {
+        $section = $1;
+    }
+
+    foreach ((@{$mandatory_sections{'*'}}, @{$mandatory_sections{$section}})) {
+        print $OUT "$filename doesn't have a head1 section matching $_\n"
+            if $contents !~ /^=head1\s+${_}\s*$/m;
+    }
+
+    podchecker($filename, $OUT);
 }
 
 open $OUT, '>', $temp


More information about the openssl-commits mailing list