From d4c0f22914b087295eeba9511b2040617b8be2b9 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 28 Aug 2012 13:15:29 +0100 Subject: po-docs: Fix podwrapper so it works on translated POD files. These don't contain literal strings like "AUTHORS" (they have the translated versions instead) and so checking for these English strings is rather useless. Also we don't usually have the '--license' parameter conveniently around so don't enforce this section. (cherry picked from commit ddc67d94f37ca4e942cb385d4e5ec476766fef12) --- po-docs/ja/Makefile.am | 23 ++++++++++++++++++++--- po-docs/uk/Makefile.am | 23 ++++++++++++++++++++--- podwrapper.pl.in | 43 ++++++++++++++++++++++++++++--------------- 3 files changed, 68 insertions(+), 21 deletions(-) diff --git a/po-docs/ja/Makefile.am b/po-docs/ja/Makefile.am index 2e99b022..7bd9a0a3 100644 --- a/po-docs/ja/Makefile.am +++ b/po-docs/ja/Makefile.am @@ -58,8 +58,10 @@ all-local: $(MANPAGES) guestfs.3: guestfs.pod guestfs-actions.pod guestfs-availability.pod guestfs-structs.pod $(PODWRAPPER) \ - --section 3 \ + --no-strict-checks \ --man $@ \ + --section 3 \ + --license LGPLv2+ \ --insert $(srcdir)/guestfs-actions.pod:@ACTIONS@ \ --insert $(srcdir)/guestfs-availability.pod:@AVAILABILITY@ \ --insert $(srcdir)/guestfs-structs.pod:@STRUCTS@ \ @@ -67,16 +69,31 @@ guestfs.3: guestfs.pod guestfs-actions.pod guestfs-availability.pod guestfs-stru guestfish.1: guestfish.pod guestfish-actions.pod guestfish-commands.pod $(PODWRAPPER) \ + --no-strict-checks \ --man $@ \ + --license GPLv2+ \ --insert $(srcdir)/guestfish-actions.pod:@ACTIONS@ \ --insert $(srcdir)/guestfish-commands.pod:@FISH_COMMANDS@ \ $< %.1: %.pod - $(PODWRAPPER) --man $@ $< + $(PODWRAPPER) \ + --no-strict-checks \ + --man $@ \ + $< + +%.3: %.pod + $(PODWRAPPER) \ + --no-strict-checks \ + --man $@ \ + --section 3 \ + $< %.1: %.pl - $(PODWRAPPER) --man $@ $< + $(PODWRAPPER) \ + --no-strict-checks \ + --man $@ \ + $< # Ensure that the first time we build from git, since guestfs.pod # hasn't been built yet, build it. diff --git a/po-docs/uk/Makefile.am b/po-docs/uk/Makefile.am index 2e99b022..7bd9a0a3 100644 --- a/po-docs/uk/Makefile.am +++ b/po-docs/uk/Makefile.am @@ -58,8 +58,10 @@ all-local: $(MANPAGES) guestfs.3: guestfs.pod guestfs-actions.pod guestfs-availability.pod guestfs-structs.pod $(PODWRAPPER) \ - --section 3 \ + --no-strict-checks \ --man $@ \ + --section 3 \ + --license LGPLv2+ \ --insert $(srcdir)/guestfs-actions.pod:@ACTIONS@ \ --insert $(srcdir)/guestfs-availability.pod:@AVAILABILITY@ \ --insert $(srcdir)/guestfs-structs.pod:@STRUCTS@ \ @@ -67,16 +69,31 @@ guestfs.3: guestfs.pod guestfs-actions.pod guestfs-availability.pod guestfs-stru guestfish.1: guestfish.pod guestfish-actions.pod guestfish-commands.pod $(PODWRAPPER) \ + --no-strict-checks \ --man $@ \ + --license GPLv2+ \ --insert $(srcdir)/guestfish-actions.pod:@ACTIONS@ \ --insert $(srcdir)/guestfish-commands.pod:@FISH_COMMANDS@ \ $< %.1: %.pod - $(PODWRAPPER) --man $@ $< + $(PODWRAPPER) \ + --no-strict-checks \ + --man $@ \ + $< + +%.3: %.pod + $(PODWRAPPER) \ + --no-strict-checks \ + --man $@ \ + --section 3 \ + $< %.1: %.pl - $(PODWRAPPER) --man $@ $< + $(PODWRAPPER) \ + --no-strict-checks \ + --man $@ \ + $< # Ensure that the first time we build from git, since guestfs.pod # hasn't been built yet, build it. diff --git a/podwrapper.pl.in b/podwrapper.pl.in index 15e2eadb..b8b04593 100755 --- a/podwrapper.pl.in +++ b/podwrapper.pl.in @@ -131,6 +131,16 @@ not set, defaults to C<1>. =cut +my $strict_checks = 1; + +=item B<--no-strict-checks> + +Disable strict checks of the man page. This is only used +when generating the translated man pages in the C +subdirectory. + +=cut + my $text; =item B<--text=output.txt> @@ -173,6 +183,7 @@ GetOptions ("help|?" => \$help, "man=s" => \$man, "name=s" => \$name, "section=s" => \$section, + "strict-checks!" => \$strict_checks, "text=s" => \$text, "verbatim=s" => \@verbatims ) or pod2usage (2); @@ -182,7 +193,7 @@ die "$progname: missing argument: podwrapper input.pod\n" unless @ARGV == 1; my $input = $ARGV[0]; die "$progname: $input: missing argument: --license parameter is required\n" - unless @licenses >= 1; + if $strict_checks && @licenses == 0; # There should be at least one output. die "$progname: $input: no output format specified. Use --man and/or --html and/or --text.\n" @@ -249,20 +260,22 @@ foreach (@verbatims) { $content =~ s/$a[1]/$replacement/ge; } -# Verify sections present / not present. -die "$progname: $input: missing AUTHOR or AUTHORS section\n" - unless $content =~ /^=head1 AUTHOR/m; -die "$progname: $input: missing SEE ALSO section\n" - unless $content =~ /^=head1 SEE ALSO/m; -die "$progname: $input: missing COPYRIGHT section\n" - unless $content =~ /^=head1 COPYRIGHT/m; -die "$progname: $input: BUGS is now added automatically, do not add it to the POD file\n" - if $content =~ /^=head1 (REPORTING )?BUGS/m; -die "$progname: $input: LICENSE is now added automatically, do not add it to the POD file\n" - if $content =~ /^=head1 LICENSE/m; -die "$progname: $input: GPL/LGPL should be specified using the --license parameter, not included in the POD file\n" - if $content =~ /^This program is free software/ || - $content =~ /^This library is free software/; +if ($strict_checks) { + # Verify sections present / not present. + die "$progname: $input: missing AUTHOR or AUTHORS section\n" + unless $content =~ /^=head1 AUTHOR/m; + die "$progname: $input: missing SEE ALSO section\n" + unless $content =~ /^=head1 SEE ALSO/m; + die "$progname: $input: missing COPYRIGHT section\n" + unless $content =~ /^=head1 COPYRIGHT/m; + die "$progname: $input: BUGS is now added automatically, do not add it to the POD file\n" + if $content =~ /^=head1 (REPORTING )?BUGS/m; + die "$progname: $input: LICENSE is now added automatically, do not add it to the POD file\n" + if $content =~ /^=head1 LICENSE/m; + die "$progname: $input: GPL/LGPL should be specified using the --license parameter, not included in the POD file\n" + if $content =~ /^This program is free software/ || + $content =~ /^This library is free software/; +} # Add standard LICENSE and BUGS sections. my $LGPLv2plus = -- cgit