X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=util%2Fprocess_docs.pl;h=8b8de81acdaadac0521a25668239903f7c4f51e6;hp=eaa4964869bc8cf549ba7234c23e6d4108db21ad;hb=73a9f60dd127df9ca05bec7afd835ff7c9bee9ae;hpb=2bc57c88d852d83ee31f68f5b84b36d54b4c3dc4 diff --git a/util/process_docs.pl b/util/process_docs.pl index eaa4964869..8b8de81acd 100644 --- a/util/process_docs.pl +++ b/util/process_docs.pl @@ -13,12 +13,18 @@ use File::Spec::Functions; use File::Basename; use File::Copy; use File::Path; +use if $^O ne "VMS", 'File::Glob' => qw/glob/; use Getopt::Long; use Pod::Usage; use lib '.'; use configdata; +# We know we are in the 'util' directory and that our perl modules are +# in util/perl +use lib catdir(dirname($0), "perl"); +use OpenSSL::Util::Pod; + my %options = (); GetOptions(\%options, 'sourcedir=s', # Source directory @@ -74,36 +80,13 @@ foreach my $subdir (keys %{$options{subdir}}) { my $podsourcedir = catfile($options{sourcedir}, $subdir); my $podglob = catfile($podsourcedir, "*.pod"); - foreach my $podfile (glob "$podglob") { + foreach my $podfile (glob $podglob) { my $podname = basename($podfile, ".pod"); my $podpath = catfile($podfile); - my %podinfo = ( section => $section ); - - print STDERR "DEBUG: Reading $podpath\n" if $options{debug}; - open my $pod_fh, $podpath or die "Trying to read $podpath: $!\n"; - while (<$pod_fh>) { - s|\R$||; - if (m|^=for\s+comment\s+openssl_manual_section:\s*([0-9])\s*$|) { - print STDERR "Found section number $1\n" if $options{debug}; - $podinfo{section} = $1; - } - last if m|^=head1| && defined $podinfo{lastsect} eq "NAME"; - if (m|^head1=\s*(.*)|) { - $podinfo{lastsect} = $1; - $podinfo{lastsect} =~ s/\s+$//; - } - next if (m|^=| || m|^\s*$|); - $podinfo{lastsecttext} .= " "; - $podinfo{lastsecttext} .= $_; - } - close $pod_fh; - $podinfo{lastsecttext} =~ s| - .*$||; - print STDERR "DEBUG: Done reading $podpath\n" if $options{debug}; - - my @podfiles = - grep { $_ ne $podname } - map { s|\s+||g; $_ } - split(m|,|, $podinfo{lastsecttext}); + my %podinfo = extract_pod_info($podpath, + { debug => $options{debug}, + section => $section }); + my @podfiles = grep { $_ ne $podname } @{$podinfo{names}}; my $updir = updir(); my $name = uc $podname;