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.
This commit is contained in:
Richard W.M. Jones
2012-08-28 13:15:29 +01:00
parent 540fbfcf34
commit ddc67d94f3
3 changed files with 72 additions and 21 deletions

View File

@@ -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,23 +69,40 @@ 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@ \
$<
virt-sysprep.1: virt-sysprep.pod sysprep-extra-options.pod sysprep-operations.pod
$(PODWRAPPER) \
--no-strict-checks \
--man $@ \
--license GPLv2+ \
--insert sysprep-extra-options.pod:@EXTRA_OPTIONS@ \
--insert sysprep-operations.pod:@OPERATIONS@ \
$<
%.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.

View File

@@ -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,23 +69,40 @@ 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@ \
$<
virt-sysprep.1: virt-sysprep.pod sysprep-extra-options.pod sysprep-operations.pod
$(PODWRAPPER) \
--no-strict-checks \
--man $@ \
--license GPLv2+ \
--insert sysprep-extra-options.pod:@EXTRA_OPTIONS@ \
--insert sysprep-operations.pod:@OPERATIONS@ \
$<
%.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.

View File

@@ -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<po-docs>
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 =