[Libguestfs] [PATCH 3/3] podwrapper: Remove =encoding from input files and add it back in podwrapper.

Richard W.M. Jones rjones at redhat.com
Tue Mar 18 16:02:39 UTC 2014


This changes podwrapper so that the input (POD) files should not
contain an =encoding directive.  However they must be UTF-8.
Podwrapper then adds the '=encoding utf8' directive back during final
generation.

This in particular avoids problems with nested =encoding directives in
fragments.  These break POD, and are undesirable anyway.
---
 align/virt-alignment-scan.pod                 | 2 --
 appliance/libguestfs-make-fixed-appliance.pod | 2 --
 builder/virt-builder.pod                      | 2 --
 builder/virt-index-validate.pod               | 2 --
 cat/virt-cat.pod                              | 2 --
 cat/virt-filesystems.pod                      | 2 --
 cat/virt-ls.pod                               | 2 --
 daemon/guestfsd.pod                           | 2 --
 df/virt-df.pod                                | 2 --
 diff/virt-diff.pod                            | 2 --
 edit/virt-edit.pod                            | 2 --
 erlang/examples/guestfs-erlang.pod            | 2 --
 examples/guestfs-examples.pod                 | 2 --
 examples/guestfs-faq.pod                      | 2 --
 examples/guestfs-performance.pod              | 2 --
 examples/guestfs-recipes.pod                  | 2 --
 examples/guestfs-testing.pod                  | 2 --
 fish/guestfish.pod                            | 2 --
 fish/libguestfs-tools.conf.pod                | 2 --
 fish/virt-copy-in.pod                         | 2 --
 fish/virt-copy-out.pod                        | 2 --
 fish/virt-tar-in.pod                          | 2 --
 fish/virt-tar-out.pod                         | 2 --
 format/virt-format.pod                        | 2 --
 fuse/guestmount.pod                           | 2 --
 fuse/guestunmount.pod                         | 2 --
 golang/examples/guestfs-golang.pod            | 2 --
 guestfs-release-notes.pod                     | 2 --
 inspector/virt-inspector.pod                  | 2 --
 java/examples/guestfs-java.pod                | 2 --
 lua/examples/guestfs-lua.pod                  | 2 --
 make-fs/virt-make-fs.pod                      | 2 --
 ocaml/examples/guestfs-ocaml.pod              | 2 --
 perl/examples/guestfs-perl.pod                | 2 --
 podwrapper.pl.in                              | 8 ++++++--
 python/examples/guestfs-python.pod            | 2 --
 rescue/virt-rescue.pod                        | 2 --
 resize/virt-resize.pod                        | 2 --
 ruby/examples/guestfs-ruby.pod                | 2 --
 sparsify/virt-sparsify.pod                    | 2 --
 src/guestfs.pod                               | 2 --
 sysprep/virt-sysprep.pod                      | 2 --
 test-tool/libguestfs-test-tool.pod            | 2 --
 tools/virt-list-filesystems                   | 2 --
 tools/virt-list-partitions                    | 2 --
 tools/virt-tar                                | 2 --
 tools/virt-win-reg                            | 2 --
 47 files changed, 6 insertions(+), 94 deletions(-)

diff --git a/align/virt-alignment-scan.pod b/align/virt-alignment-scan.pod
index 1809c14..8dba461 100644
--- a/align/virt-alignment-scan.pod
+++ b/align/virt-alignment-scan.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 virt-alignment-scan - Check alignment of virtual machine partitions
diff --git a/appliance/libguestfs-make-fixed-appliance.pod b/appliance/libguestfs-make-fixed-appliance.pod
index ab0b0c9..8022edf 100644
--- a/appliance/libguestfs-make-fixed-appliance.pod
+++ b/appliance/libguestfs-make-fixed-appliance.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 libguestfs-make-fixed-appliance - Make a "fixed appliance" for libguestfs
diff --git a/builder/virt-builder.pod b/builder/virt-builder.pod
index d035c81..7cf345c 100644
--- a/builder/virt-builder.pod
+++ b/builder/virt-builder.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =begin html
 
 <img src="virt-builder.svg" width="250"
diff --git a/builder/virt-index-validate.pod b/builder/virt-index-validate.pod
index 6b03703..d48a93a 100644
--- a/builder/virt-index-validate.pod
+++ b/builder/virt-index-validate.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 virt-index-validate - Validate virt-builder index file
diff --git a/cat/virt-cat.pod b/cat/virt-cat.pod
index 3041199..cf6af4f 100644
--- a/cat/virt-cat.pod
+++ b/cat/virt-cat.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 virt-cat - Display files in a virtual machine
diff --git a/cat/virt-filesystems.pod b/cat/virt-filesystems.pod
index 14b2dc0..fd345ac 100644
--- a/cat/virt-filesystems.pod
+++ b/cat/virt-filesystems.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 virt-filesystems - List filesystems, partitions, block devices, LVM in a virtual machine or disk image
diff --git a/cat/virt-ls.pod b/cat/virt-ls.pod
index 4324878..be955d3 100644
--- a/cat/virt-ls.pod
+++ b/cat/virt-ls.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 virt-ls - List files in a virtual machine
diff --git a/daemon/guestfsd.pod b/daemon/guestfsd.pod
index 60651ff..b68cb20 100644
--- a/daemon/guestfsd.pod
+++ b/daemon/guestfsd.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 guestfsd - guestfs daemon
diff --git a/df/virt-df.pod b/df/virt-df.pod
index 4c94af0..8c44467 100644
--- a/df/virt-df.pod
+++ b/df/virt-df.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 virt-df - Display free space on virtual filesystems
diff --git a/diff/virt-diff.pod b/diff/virt-diff.pod
index 9ec086f..9242829 100644
--- a/diff/virt-diff.pod
+++ b/diff/virt-diff.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 virt-diff - Differences between files in two virtual machines
diff --git a/edit/virt-edit.pod b/edit/virt-edit.pod
index 4730f50..4c5ae71 100644
--- a/edit/virt-edit.pod
+++ b/edit/virt-edit.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 virt-edit - Edit a file in a virtual machine
diff --git a/erlang/examples/guestfs-erlang.pod b/erlang/examples/guestfs-erlang.pod
index ea5ba3f..89cbda1 100644
--- a/erlang/examples/guestfs-erlang.pod
+++ b/erlang/examples/guestfs-erlang.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 guestfs-erlang - How to use libguestfs from Erlang
diff --git a/examples/guestfs-examples.pod b/examples/guestfs-examples.pod
index 2afb6ca..81601c5 100644
--- a/examples/guestfs-examples.pod
+++ b/examples/guestfs-examples.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 guestfs-examples - Examples of using libguestfs from C
diff --git a/examples/guestfs-faq.pod b/examples/guestfs-faq.pod
index ec49409..5609d7c 100644
--- a/examples/guestfs-faq.pod
+++ b/examples/guestfs-faq.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 guestfs-faq - libguestfs Frequently Asked Questions (FAQ)
diff --git a/examples/guestfs-performance.pod b/examples/guestfs-performance.pod
index 9f47e3c..8f395f6 100644
--- a/examples/guestfs-performance.pod
+++ b/examples/guestfs-performance.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 guestfs-performance - engineering libguestfs for greatest performance
diff --git a/examples/guestfs-recipes.pod b/examples/guestfs-recipes.pod
index 3538e8a..9bb6696 100644
--- a/examples/guestfs-recipes.pod
+++ b/examples/guestfs-recipes.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =begin comment
 
 We break with tradition here and don't use ALL CAPS for the section
diff --git a/examples/guestfs-testing.pod b/examples/guestfs-testing.pod
index 237835b..2186ed3 100644
--- a/examples/guestfs-testing.pod
+++ b/examples/guestfs-testing.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 guestfs-testing - manual testing of libguestfs, you can help!
diff --git a/fish/guestfish.pod b/fish/guestfish.pod
index a0a884d..a53ef92 100644
--- a/fish/guestfish.pod
+++ b/fish/guestfish.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 guestfish - the guest filesystem shell
diff --git a/fish/libguestfs-tools.conf.pod b/fish/libguestfs-tools.conf.pod
index bba00e3..2f79fd6 100644
--- a/fish/libguestfs-tools.conf.pod
+++ b/fish/libguestfs-tools.conf.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 libguestfs-tools.conf - configuration file for guestfish, guestmount, virt-rescue
diff --git a/fish/virt-copy-in.pod b/fish/virt-copy-in.pod
index f2223f2..3891ce5 100644
--- a/fish/virt-copy-in.pod
+++ b/fish/virt-copy-in.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 virt-copy-in - Copy files and directories into a virtual machine disk image.
diff --git a/fish/virt-copy-out.pod b/fish/virt-copy-out.pod
index 1d99caa..f3ad07c 100644
--- a/fish/virt-copy-out.pod
+++ b/fish/virt-copy-out.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 virt-copy-out - Copy files and directories out of a virtual machine disk image.
diff --git a/fish/virt-tar-in.pod b/fish/virt-tar-in.pod
index ef90f62..9ccad1d 100644
--- a/fish/virt-tar-in.pod
+++ b/fish/virt-tar-in.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 virt-tar-in - Unpack a tarball into a virtual machine disk image.
diff --git a/fish/virt-tar-out.pod b/fish/virt-tar-out.pod
index c64c5fc..b455ca3 100644
--- a/fish/virt-tar-out.pod
+++ b/fish/virt-tar-out.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 virt-tar-out - Pack a virtual machine disk image directory into a tarball.
diff --git a/format/virt-format.pod b/format/virt-format.pod
index ac2b8e6..caec411 100644
--- a/format/virt-format.pod
+++ b/format/virt-format.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 virt-format - Erase and make a blank disk
diff --git a/fuse/guestmount.pod b/fuse/guestmount.pod
index 6ebf51f..05a3c1d 100644
--- a/fuse/guestmount.pod
+++ b/fuse/guestmount.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 guestmount - Mount a guest filesystem on the host using FUSE and libguestfs
diff --git a/fuse/guestunmount.pod b/fuse/guestunmount.pod
index 2038e77..72c5dc4 100644
--- a/fuse/guestunmount.pod
+++ b/fuse/guestunmount.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 guestunmount - Unmount a guestmounted filesystem
diff --git a/golang/examples/guestfs-golang.pod b/golang/examples/guestfs-golang.pod
index d63486b..c2de45e 100644
--- a/golang/examples/guestfs-golang.pod
+++ b/golang/examples/guestfs-golang.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 guestfs-golang - How to use libguestfs from Go
diff --git a/guestfs-release-notes.pod b/guestfs-release-notes.pod
index a15ed22..d531209 100644
--- a/guestfs-release-notes.pod
+++ b/guestfs-release-notes.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 guestfs-release-notes - libguestfs Release Notes
diff --git a/inspector/virt-inspector.pod b/inspector/virt-inspector.pod
index 4578f42..66ca276 100644
--- a/inspector/virt-inspector.pod
+++ b/inspector/virt-inspector.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 virt-inspector - Display operating system version and other information about a virtual machine
diff --git a/java/examples/guestfs-java.pod b/java/examples/guestfs-java.pod
index 10deebe..5ea2e84 100644
--- a/java/examples/guestfs-java.pod
+++ b/java/examples/guestfs-java.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 guestfs-java - How to use libguestfs from Java
diff --git a/lua/examples/guestfs-lua.pod b/lua/examples/guestfs-lua.pod
index cb93db6..36ea297 100644
--- a/lua/examples/guestfs-lua.pod
+++ b/lua/examples/guestfs-lua.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 guestfs-lua - How to use libguestfs from Lua
diff --git a/make-fs/virt-make-fs.pod b/make-fs/virt-make-fs.pod
index 6817909..26b0350 100644
--- a/make-fs/virt-make-fs.pod
+++ b/make-fs/virt-make-fs.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 virt-make-fs - Make a filesystem from a tar archive or files
diff --git a/ocaml/examples/guestfs-ocaml.pod b/ocaml/examples/guestfs-ocaml.pod
index 86becfd..f185914 100644
--- a/ocaml/examples/guestfs-ocaml.pod
+++ b/ocaml/examples/guestfs-ocaml.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 guestfs-ocaml - How to use libguestfs from OCaml
diff --git a/perl/examples/guestfs-perl.pod b/perl/examples/guestfs-perl.pod
index 0571bcd..1042f69 100644
--- a/perl/examples/guestfs-perl.pod
+++ b/perl/examples/guestfs-perl.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 guestfs-perl - How to use libguestfs from Perl
diff --git a/podwrapper.pl.in b/podwrapper.pl.in
index 74432ad..c2cb5e1 100755
--- a/podwrapper.pl.in
+++ b/podwrapper.pl.in
@@ -31,8 +31,6 @@ use File::Basename;
 # https://www.redhat.com/archives/libguestfs/2013-May/thread.html#00088
 eval { $Text::Wrap::huge = "overflow" };
 
-=encoding utf8
-
 =head1 NAME
 
 podwrapper.pl - Generate libguestfs documentation from POD input files
@@ -291,6 +289,12 @@ foreach (@verbatims) {
         if $content eq $oldcontent;
 }
 
+# There should be no =encoding line present in the content (we will add one).
+die "$progname: $input: =encoding must not be present in input\n"
+    if $content =~ /^=encoding/m;
+
+$content = "=encoding utf8\n\n$content";
+
 if ($strict_checks) {
     # Verify sections present / not present.
     die "$progname: $input: missing AUTHOR or AUTHORS section\n"
diff --git a/python/examples/guestfs-python.pod b/python/examples/guestfs-python.pod
index 710a673..d1cb40f 100644
--- a/python/examples/guestfs-python.pod
+++ b/python/examples/guestfs-python.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 guestfs-python - How to use libguestfs from Python
diff --git a/rescue/virt-rescue.pod b/rescue/virt-rescue.pod
index c295bda..6e209d8 100644
--- a/rescue/virt-rescue.pod
+++ b/rescue/virt-rescue.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 virt-rescue - Run a rescue shell on a virtual machine
diff --git a/resize/virt-resize.pod b/resize/virt-resize.pod
index 0f42448..0fd7e9e 100644
--- a/resize/virt-resize.pod
+++ b/resize/virt-resize.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 virt-resize - Resize a virtual machine disk
diff --git a/ruby/examples/guestfs-ruby.pod b/ruby/examples/guestfs-ruby.pod
index df7f99a..5e4e187 100644
--- a/ruby/examples/guestfs-ruby.pod
+++ b/ruby/examples/guestfs-ruby.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 guestfs-ruby - How to use libguestfs from Ruby
diff --git a/sparsify/virt-sparsify.pod b/sparsify/virt-sparsify.pod
index 59ef4f2..014c3d9 100644
--- a/sparsify/virt-sparsify.pod
+++ b/sparsify/virt-sparsify.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 virt-sparsify - Make a virtual machine disk sparse
diff --git a/src/guestfs.pod b/src/guestfs.pod
index 1e6ec3f..b3c32eb 100644
--- a/src/guestfs.pod
+++ b/src/guestfs.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 guestfs - Library for accessing and modifying virtual machine images
diff --git a/sysprep/virt-sysprep.pod b/sysprep/virt-sysprep.pod
index 33ec624..1eaecef 100644
--- a/sysprep/virt-sysprep.pod
+++ b/sysprep/virt-sysprep.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 virt-sysprep - Reset, unconfigure or customize a virtual machine so clones can be made
diff --git a/test-tool/libguestfs-test-tool.pod b/test-tool/libguestfs-test-tool.pod
index 2ac299b..116730c 100644
--- a/test-tool/libguestfs-test-tool.pod
+++ b/test-tool/libguestfs-test-tool.pod
@@ -1,5 +1,3 @@
-=encoding utf8
-
 =head1 NAME
 
 libguestfs-test-tool - Diagnostics for libguestfs
diff --git a/tools/virt-list-filesystems b/tools/virt-list-filesystems
index 6e2cb83..3a179de 100755
--- a/tools/virt-list-filesystems
+++ b/tools/virt-list-filesystems
@@ -24,8 +24,6 @@ use Pod::Usage;
 use Getopt::Long;
 use Locale::TextDomain 'libguestfs';
 
-=encoding utf8
-
 =head1 NAME
 
 virt-list-filesystems - List filesystems in a virtual machine or disk image
diff --git a/tools/virt-list-partitions b/tools/virt-list-partitions
index c268791..2487b56 100755
--- a/tools/virt-list-partitions
+++ b/tools/virt-list-partitions
@@ -24,8 +24,6 @@ use Pod::Usage;
 use Getopt::Long;
 use Locale::TextDomain 'libguestfs';
 
-=encoding utf8
-
 =head1 NAME
 
 virt-list-partitions - List partitions in a virtual machine or disk image
diff --git a/tools/virt-tar b/tools/virt-tar
index b13285d..41d875c 100755
--- a/tools/virt-tar
+++ b/tools/virt-tar
@@ -25,8 +25,6 @@ use Getopt::Long;
 use File::Basename;
 use Locale::TextDomain 'libguestfs';
 
-=encoding utf8
-
 =head1 NAME
 
 virt-tar - Extract or upload files to a virtual machine
diff --git a/tools/virt-win-reg b/tools/virt-win-reg
index bcd836c..a47db97 100755
--- a/tools/virt-win-reg
+++ b/tools/virt-win-reg
@@ -29,8 +29,6 @@ use File::Temp qw/tempdir/;
 use File::Basename;
 use Locale::TextDomain 'libguestfs';
 
-=encoding utf8
-
 =head1 NAME
 
 virt-win-reg - Export and merge Windows Registry entries from a Windows guest
-- 
1.8.5.3




More information about the Libguestfs mailing list