podwrapper: Add --license parameter, which is required.

This adds standard LICENSE and BUGS sections to all of the man pages
that are processed by podwrapper.

Modify all the calls to $(PODWRAPPER) to add the right --license
parameter according to the content.  Note that this relaxes the
license on some code example pages, making them effectively BSD-style
licensed.

(cherry picked from commit 2f97bf873b)
This commit is contained in:
Richard W.M. Jones
2012-08-21 20:11:52 +01:00
parent ebf3342f5a
commit d37ccaacb3
24 changed files with 155 additions and 0 deletions

View File

@@ -65,6 +65,7 @@ stamp-virt-alignment-scan.pod: virt-alignment-scan.pod
$(PODWRAPPER) \
--man virt-alignment-scan.1 \
--html $(top_builddir)/html/virt-alignment-scan.1.html \
--license GPLv2+ \
$<
touch $@

View File

@@ -103,6 +103,7 @@ stamp-libguestfs-make-fixed-appliance.pod: libguestfs-make-fixed-appliance.pod
$(PODWRAPPER) \
--man libguestfs-make-fixed-appliance.1 \
--html $(top_builddir)/html/libguestfs-make-fixed-appliance.1.html \
--license GPLv2+ \
$<
touch $@

View File

@@ -105,6 +105,7 @@ stamp-virt-cat.pod: virt-cat.pod
$(PODWRAPPER) \
--man virt-cat.1 \
--html $(top_builddir)/html/virt-cat.1.html \
--license GPLv2+ \
$<
touch $@
@@ -114,6 +115,7 @@ stamp-virt-ls.pod: virt-ls.pod
$(PODWRAPPER) \
--man virt-ls.1 \
--html $(top_builddir)/html/virt-ls.1.html \
--license GPLv2+ \
$<
touch $@
@@ -123,6 +125,7 @@ stamp-virt-filesystems.pod: virt-filesystems.pod
$(PODWRAPPER) \
--man virt-filesystems.1 \
--html $(top_builddir)/html/virt-filesystems.1.html \
--license GPLv2+ \
$<
touch $@

View File

@@ -69,6 +69,7 @@ stamp-virt-df.pod: virt-df.pod
$(PODWRAPPER) \
--man virt-df.1 \
--html $(top_builddir)/html/virt-df.1.html \
--license GPLv2+ \
$<
touch $@

View File

@@ -61,6 +61,7 @@ stamp-virt-edit.pod: virt-edit.pod
$(PODWRAPPER) \
--man virt-edit.1 \
--html $(top_builddir)/html/virt-edit.1.html \
--license GPLv2+ \
$<
touch $@

View File

@@ -35,5 +35,6 @@ stamp-guestfs-erlang.pod: guestfs-erlang.pod create_disk.erl inspect_vm.erl
--html $(top_builddir)/html/guestfs-erlang.3.html \
--verbatim $(srcdir)/create_disk.erl:@EXAMPLE1@ \
--verbatim $(srcdir)/inspect_vm.erl:@EXAMPLE2@ \
--license examples \
$<
touch $@

View File

@@ -124,6 +124,7 @@ stamp-guestfs-examples.pod: guestfs-examples.pod create_disk.c inspect_vm.c
--html $(top_builddir)/html/guestfs-examples.3.html \
--verbatim $(srcdir)/create_disk.c:@EXAMPLE1@ \
--verbatim $(srcdir)/inspect_vm.c:@EXAMPLE2@ \
--license examples \
$<
touch $@
@@ -134,6 +135,7 @@ stamp-guestfs-faq.pod: guestfs-faq.pod
--section 1 \
--man guestfs-faq.1 \
--html $(top_builddir)/html/guestfs-faq.1.html \
--license LGPLv2+ \
$<
touch $@
@@ -144,6 +146,7 @@ stamp-guestfs-performance.pod: guestfs-performance.pod
--section 1 \
--man guestfs-performance.1 \
--html $(top_builddir)/html/guestfs-performance.1.html \
--license LGPLv2+ \
$<
touch $@
@@ -154,6 +157,7 @@ stamp-guestfs-recipes.pod: guestfs-recipes.pod
--section 1 \
--man guestfs-recipes.1 \
--html $(top_builddir)/html/guestfs-recipes.1.html \
--license examples \
$<
touch $@
@@ -164,5 +168,6 @@ stamp-guestfs-testing.pod: guestfs-testing.pod
--section 1 \
--man guestfs-testing.1 \
--html $(top_builddir)/html/guestfs-testing.1.html \
--license LGPLv2+ \
$<
touch $@

View File

@@ -187,6 +187,7 @@ stamp-guestfish.pod: guestfish.pod guestfish-actions.pod guestfish-commands.pod
--html $(top_builddir)/html/guestfish.1.html \
--insert $(srcdir)/guestfish-actions.pod:@ACTIONS@ \
--insert $(srcdir)/guestfish-commands.pod:@FISH_COMMANDS@ \
--license GPLv2+ \
$<
touch $@
@@ -196,6 +197,7 @@ stamp-virt-copy-in.pod: virt-copy-in.pod
$(PODWRAPPER) \
--man virt-copy-in.1 \
--html $(top_builddir)/html/virt-copy-in.1.html \
--license GPLv2+ \
$<
touch $@
@@ -205,6 +207,7 @@ stamp-virt-copy-out.pod: virt-copy-out.pod
$(PODWRAPPER) \
--man virt-copy-out.1 \
--html $(top_builddir)/html/virt-copy-out.1.html \
--license GPLv2+ \
$<
touch $@
@@ -214,6 +217,7 @@ stamp-virt-tar-in.pod: virt-tar-in.pod
$(PODWRAPPER) \
--man virt-tar-in.1 \
--html $(top_builddir)/html/virt-tar-in.1.html \
--license GPLv2+ \
$<
touch $@
@@ -223,6 +227,7 @@ stamp-virt-tar-out.pod: virt-tar-out.pod
$(PODWRAPPER) \
--man virt-tar-out.1 \
--html $(top_builddir)/html/virt-tar-out.1.html \
--license GPLv2+ \
$<
touch $@

View File

@@ -62,6 +62,7 @@ stamp-virt-format.pod: virt-format.pod
$(PODWRAPPER) \
--man virt-format.1 \
--html $(top_builddir)/html/virt-format.1.html \
--license GPLv2+ \
$<
touch $@

View File

@@ -67,6 +67,7 @@ stamp-guestmount.pod: guestmount.pod
$(PODWRAPPER) \
--man guestmount.1 \
--html $(top_builddir)/html/guestmount.1.html \
--license GPLv2+ \
$<
touch $@

View File

@@ -87,6 +87,7 @@ stamp-virt-inspector.pod: virt-inspector.pod
$(PODWRAPPER) \
--man virt-inspector.1 \
--html $(top_builddir)/html/virt-inspector.1.html \
--license GPLv2+ \
$<
touch $@

View File

@@ -37,6 +37,7 @@ stamp-guestfs-java.pod: guestfs-java.pod CreateDisk.java InspectVM.java
--html $(top_builddir)/html/guestfs-java.3.html \
--verbatim $(srcdir)/CreateDisk.java:@EXAMPLE1@ \
--verbatim $(srcdir)/InspectVM.java:@EXAMPLE2@ \
--license examples \
$<
touch $@

View File

@@ -37,6 +37,7 @@ stamp-guestfs-ocaml.pod: guestfs-ocaml.pod create_disk.ml inspect_vm.ml
--html $(top_builddir)/html/guestfs-ocaml.3.html \
--verbatim $(srcdir)/create_disk.ml:@EXAMPLE1@ \
--verbatim $(srcdir)/inspect_vm.ml:@EXAMPLE2@ \
--license examples \
$<
touch $@

View File

@@ -35,5 +35,6 @@ stamp-guestfs-perl.pod: guestfs-perl.pod create_disk.pl inspect_vm.pl
--html $(top_builddir)/html/guestfs-perl.3.html \
--verbatim $(srcdir)/create_disk.pl:@EXAMPLE1@ \
--verbatim $(srcdir)/inspect_vm.pl:@EXAMPLE2@ \
--license examples \
$<
touch $@

View File

@@ -93,6 +93,16 @@ you can use any string as the pattern.
=cut
my @licenses;
=item B<--license=GPLv2+|LGPLv2+|examples>
Add the given license to the end of the man page. This parameter
is required. The parameter may be given multiple times (eg. for
mixed content).
=cut
my $man;
=item B<--man=output.n>
@@ -158,6 +168,7 @@ $progname =~ s{.*/}{};
# Parse options.
GetOptions ("help|?" => \$help,
"html=s" => \$html,
"license=s" => \@licenses,
"insert=s" => \@inserts,
"man=s" => \$man,
"name=s" => \$name,
@@ -170,6 +181,9 @@ pod2usage (1) if $help;
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;
# There should be at least one output.
die "$progname: $input: no output format specified. Use --man and/or --html and/or --text.\n"
unless defined $man || defined $html || defined $text;
@@ -235,6 +249,113 @@ 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/;
# Add standard LICENSE and BUGS sections.
my $LGPLv2plus =
"This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
";
my $GPLv2plus =
"This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
";
my $examples_license =
"This manual page contains examples which we hope you will use in
your programs. The examples may be freely copied, modified and
distributed for any purpose without any restrictions.
";
my $reporting_bugs =
"=head1 BUGS
To get a list of bugs against libguestfs, use this link:
L<https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools>
To report a new bug against libguestfs, use this link:
L<https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools>
When reporting a bug, please supply:
\=over 4
\=item *
The version of libguestfs.
\=item *
Where you got libguestfs (eg. which Linux distro, compiled from source, etc)
\=item *
Describe the bug accurately and give a way to reproduce it.
\=item *
Run L<libguestfs-test-tool(1)> and paste the B<complete, unedited>
output into the bug report.
\=back
";
$content .= "\n\n=head1 LICENSE\n\n";
foreach (@licenses) {
if ($_ eq "LGPLv2+") {
$content .= $LGPLv2plus . "\n\n";
}
elsif ($_ eq "GPLv2+") {
$content .= $GPLv2plus . "\n\n";
}
elsif ($_ eq "examples") {
$content .= $examples_license . "\n\n";
}
else {
die "$progname: $input: invalid --license parameter: $_\n";
}
}
$content .= "\n\n$reporting_bugs";
# Output man page.
SUBMAN: {
package Podwrapper::Man;

View File

@@ -35,5 +35,6 @@ stamp-guestfs-python.pod: guestfs-python.pod create_disk.py inspect_vm.py
--html $(top_builddir)/html/guestfs-python.3.html \
--verbatim $(srcdir)/create_disk.py:@EXAMPLE1@ \
--verbatim $(srcdir)/inspect_vm.py:@EXAMPLE2@ \
--license examples \
$<
touch $@

View File

@@ -60,5 +60,6 @@ stamp-virt-rescue.pod: virt-rescue.pod
$(PODWRAPPER) \
--man virt-rescue.1 \
--html $(top_builddir)/html/virt-rescue.1.html \
--license GPLv2+ \
$<
touch $@

View File

@@ -95,6 +95,7 @@ stamp-virt-resize.pod: virt-resize.pod
$(PODWRAPPER) \
--man virt-resize.1 \
--html $(top_builddir)/html/virt-resize.1.html \
--license GPLv2+ \
$<
touch $@

View File

@@ -35,5 +35,6 @@ stamp-guestfs-ruby.pod: guestfs-ruby.pod create_disk.rb inspect_vm.rb
--html $(top_builddir)/html/guestfs-ruby.3.html \
--verbatim $(srcdir)/create_disk.rb:@EXAMPLE1@ \
--verbatim $(srcdir)/inspect_vm.rb:@EXAMPLE2@ \
--license examples \
$<
touch $@

View File

@@ -94,6 +94,7 @@ stamp-virt-sparsify.pod: virt-sparsify.pod
$(PODWRAPPER) \
--man virt-sparsify.1 \
--html $(top_builddir)/html/virt-sparsify.1.html \
--license GPLv2+ \
$<
touch $@

View File

@@ -222,5 +222,6 @@ stamp-guestfs.pod: guestfs.pod \
--insert $(srcdir)/guestfs-actions.pod:@ACTIONS@ \
--insert $(srcdir)/guestfs-availability.pod:@AVAILABILITY@ \
--insert $(srcdir)/guestfs-structs.pod:@STRUCTS@ \
--license LGPLv2+ \
$<
touch $@

View File

@@ -103,6 +103,7 @@ stamp-virt-sysprep.pod: virt-sysprep.pod sysprep-extra-options.pod sysprep-opera
--insert sysprep-extra-options.pod:@EXTRA_OPTIONS@ \
--insert sysprep-operations.pod:@OPERATIONS@ \
--html $(top_builddir)/html/virt-sysprep.1.html \
--license GPLv2+ \
$<
touch $@

View File

@@ -39,5 +39,6 @@ stamp-libguestfs-test-tool.pod: libguestfs-test-tool.pod
$(PODWRAPPER) \
--man libguestfs-test-tool.1 \
--html $(top_builddir)/html/libguestfs-test-tool.1.html \
--license GPLv2+ \
$<
touch $@

View File

@@ -46,11 +46,13 @@ noinst_DATA = $(tools:%=$(top_builddir)/html/virt-%.1.html)
virt-%.1: virt-%
$(PODWRAPPER) \
--man $@ \
--license GPLv2+ \
$<
$(top_builddir)/html/virt-%.1.html: virt-%
$(PODWRAPPER) \
--html $@ \
--license GPLv2+ \
$<
# Tests.