[libvirt] [PATCH 02/13] build: Extract pod from source files

Andrea Bolognani abologna at redhat.com
Thu Apr 14 12:33:40 UTC 2016


Instead of embedding the pod information inside the respective
source files, store them in separate files.

This allows us to reduce the number of custom build rules as
most of the information can be inferred for the file name;
moreover, text editors are more likely to use proper syntax
highlighting for standalone pod files.
---
 tools/Makefile.am              |  30 ++++-------
 tools/virt-host-validate.c     |  74 ---------------------------
 tools/virt-host-validate.pod   |  67 ++++++++++++++++++++++++
 tools/virt-pki-validate.in     |  64 -----------------------
 tools/virt-pki-validate.pod    |  60 ++++++++++++++++++++++
 tools/virt-sanlock-cleanup.in  |  52 -------------------
 tools/virt-sanlock-cleanup.pod |  48 +++++++++++++++++
 tools/virt-xml-validate.in     | 113 -----------------------------------------
 tools/virt-xml-validate.pod    | 109 +++++++++++++++++++++++++++++++++++++++
 9 files changed, 293 insertions(+), 324 deletions(-)
 create mode 100644 tools/virt-host-validate.pod
 create mode 100644 tools/virt-pki-validate.pod
 create mode 100644 tools/virt-sanlock-cleanup.pod
 create mode 100644 tools/virt-xml-validate.pod

diff --git a/tools/Makefile.am b/tools/Makefile.am
index 70c3a70..dd058fa 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -45,7 +45,11 @@ EXTRA_DIST = \
 	virt-sanlock-cleanup.in				\
 	virt-sanlock-cleanup.8				\
 	virt-admin.pod					\
+	virt-host-validate.pod				\
 	virt-login-shell.pod				\
+	virt-pki-validate.pod				\
+	virt-sanlock-cleanup.pod			\
+	virt-xml-validate.pod				\
 	virsh.pod					\
 	libvirt-guests.sysconf				\
 	virsh-edit.c					\
@@ -101,37 +105,16 @@ virt-xml-validate: virt-xml-validate.in Makefile
 		       -e 's|[@]VERSION@|$(VERSION)|g' \
 	  < $< > $@ || (rm $@ && exit 1) && chmod +x $@
 
-virt-xml-validate.1: virt-xml-validate.in $(top_srcdir)/configure.ac
-	$(AM_V_GEN)$(POD2MAN) --name VIRT-XML-VALIDATE $< $(srcdir)/$@ \
-	    && if grep 'POD ERROR' $(srcdir)/$@ ; then \
-		rm $(srcdir)/$@; exit 1; fi
-
 virt-pki-validate: virt-pki-validate.in Makefile
 	$(AM_V_GEN)sed -e 's|[@]sysconfdir@|$(sysconfdir)|g' \
 		       -e 's|[@]VERSION@|$(VERSION)|g' \
 	  < $< > $@ || (rm $@ && exit 1) && chmod +x $@
 
-virt-pki-validate.1: virt-pki-validate.in $(top_srcdir)/configure.ac
-	$(AM_V_GEN)$(POD2MAN) --name VIRT-PKI-VALIDATE $< $(srcdir)/$@ \
-	    && if grep 'POD ERROR' $(srcdir)/$@ ; then \
-		rm $(srcdir)/$@; exit 1; fi
-
-virt-host-validate.1: virt-host-validate.c $(top_srcdir)/configure.ac
-	$(AM_V_GEN)$(POD2MAN) --name VIRT-HOST-VALIDATE $< $(srcdir)/$@ \
-	    && if grep 'POD ERROR' $(srcdir)/$@ ; then \
-		rm $(srcdir)/$@; exit 1; fi
-
 virt-sanlock-cleanup: virt-sanlock-cleanup.in Makefile
 	$(AM_V_GEN)sed -e 's|[@]sysconfdir@|$(sysconfdir)|' \
 	    -e 's|[@]localstatedir@|$(localstatedir)|' < $< > $@ \
 	    || (rm $@ && exit 1) && chmod +x $@
 
-virt-sanlock-cleanup.8: virt-sanlock-cleanup.in $(top_srcdir)/configure.ac
-	$(AM_V_GEN)$(POD2MAN) --name VIRT-SANLOCK-CLEANUP --section=8 \
-	    $< $(srcdir)/$@ \
-	    && if grep 'POD ERROR' $(srcdir)/$@ ; then \
-		rm $(srcdir)/$@; exit 1; fi
-
 noinst_LTLIBRARIES = libvirt_shell.la
 libvirt_shell_la_CFLAGS = \
 		$(AM_CFLAGS)						\
@@ -288,6 +271,11 @@ endif WITH_WIN_ICON
 		&& if grep 'POD ERROR' $(srcdir)/$@ ; then \
 		rm $(srcdir)/$@; exit 1; fi
 
+%.8: %.pod $(top_srcdir)/configure.ac
+	$(AM_V_GEN)$(POD2MAN) --section=8 $< $(srcdir)/$@ \
+		&& if grep 'POD ERROR' $(srcdir)/$@ ; then \
+		rm $(srcdir)/$@; exit 1; fi
+
 install-data-local: install-init install-systemd
 
 uninstall-local: uninstall-init uninstall-systemd
diff --git a/tools/virt-host-validate.c b/tools/virt-host-validate.c
index a8c2075..006d792 100644
--- a/tools/virt-host-validate.c
+++ b/tools/virt-host-validate.c
@@ -149,77 +149,3 @@ main(int argc, char **argv)
 
     return ret;
 }
-
-/*
-
-=pod
-
-=head1 NAME
-
-  virt-host-validate - validate host virtualization setup
-
-=head1 SYNOPSIS
-
-  virt-host-validate [OPTIONS...] [HV-TYPE]
-
-=head1 DESCRIPTION
-
-This tool validates that the host is configured in a suitable
-way to run libvirt hypervisor drivers. If invoked without any
-arguments it will check support for all hypervisor drivers it
-is aware of. Optionally it can be given a particular hypervisor
-type ('qemu' or 'lxc') to restrict the checks to those relevant
-for that virtualization technology
-
-=head1 OPTIONS
-
-=over 4
-
-=item C<-v>, C<--version>
-
-Display the command version
-
-=item C<-h>, C<--help>
-
-Display the command line help
-
-=item C<-q>, C<--quiet>
-
-Don't display details of individual checks being performed.
-Only display output if a check does not pass.
-
-=back
-
-=head1 EXIT STATUS
-
-Upon successful validation, an exit status of 0 will be set. Upon
-failure a non-zero status will be set.
-
-=head1 AUTHOR
-
-Daniel P. Berrange
-
-=head1 BUGS
-
-Report any bugs discovered to the libvirt community via the
-mailing list C<http://libvirt.org/contact.html> or bug tracker C<http://libvirt.org/bugs.html>.
-Alternatively report bugs to your software distributor / vendor.
-
-=head1 COPYRIGHT
-
-Copyright (C) 2012 by Red Hat, Inc.
-
-=head1 LICENSE
-
-virt-host-validate is distributed under the terms of the GNU GPL v2+.
-This is free software; see the source for copying conditions. There
-is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE
-
-=head1 SEE ALSO
-
-C<virsh(1)>, C<virt-pki-validate>, C<virt-xml-validate>
-
-=cut
-
-*/
diff --git a/tools/virt-host-validate.pod b/tools/virt-host-validate.pod
new file mode 100644
index 0000000..51edf2d
--- /dev/null
+++ b/tools/virt-host-validate.pod
@@ -0,0 +1,67 @@
+=head1 NAME
+
+  virt-host-validate - validate host virtualization setup
+
+=head1 SYNOPSIS
+
+  virt-host-validate [OPTIONS...] [HV-TYPE]
+
+=head1 DESCRIPTION
+
+This tool validates that the host is configured in a suitable
+way to run libvirt hypervisor drivers. If invoked without any
+arguments it will check support for all hypervisor drivers it
+is aware of. Optionally it can be given a particular hypervisor
+type ('qemu' or 'lxc') to restrict the checks to those relevant
+for that virtualization technology
+
+=head1 OPTIONS
+
+=over 4
+
+=item C<-v>, C<--version>
+
+Display the command version
+
+=item C<-h>, C<--help>
+
+Display the command line help
+
+=item C<-q>, C<--quiet>
+
+Don't display details of individual checks being performed.
+Only display output if a check does not pass.
+
+=back
+
+=head1 EXIT STATUS
+
+Upon successful validation, an exit status of 0 will be set. Upon
+failure a non-zero status will be set.
+
+=head1 AUTHOR
+
+Daniel P. Berrange
+
+=head1 BUGS
+
+Report any bugs discovered to the libvirt community via the
+mailing list C<http://libvirt.org/contact.html> or bug tracker C<http://libvirt.org/bugs.html>.
+Alternatively report bugs to your software distributor / vendor.
+
+=head1 COPYRIGHT
+
+Copyright (C) 2012 by Red Hat, Inc.
+
+=head1 LICENSE
+
+virt-host-validate is distributed under the terms of the GNU GPL v2+.
+This is free software; see the source for copying conditions. There
+is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE
+
+=head1 SEE ALSO
+
+C<virsh(1)>, C<virt-pki-validate>, C<virt-xml-validate>
+
+=cut
diff --git a/tools/virt-pki-validate.in b/tools/virt-pki-validate.in
index cda55d1..92df9ed 100755
--- a/tools/virt-pki-validate.in
+++ b/tools/virt-pki-validate.in
@@ -320,67 +320,3 @@ fi
 
 
 exit 0
-
-: <<=cut
-=pod
-
-=head1 NAME
-
-  virt-pki-validate - validate libvirt PKI files are configured correctly
-
-=head1 SYNOPSIS
-
-  virt-pki-validate [OPTION]
-
-=head1 DESCRIPTION
-
-This tool validates that the necessary PKI files are configured for
-a secure libvirt server or client using the TLS encryption protocol.
-It will report any missing certificate or key files on the host. It
-should be run as root to ensure it can read all the necessary files
-
-=head1 OPTIONS
-
-=over
-
-=item B<-h, --help>
-
-Display command line help usage then exit.
-
-=item B<-V, --version>
-
-Display version information then exit.
-
-=back
-
-=head1 EXIT STATUS
-
-Upon successful validation, an exit status of 0 will be set. Upon
-failure a non-zero status will be set.
-
-=head1 AUTHOR
-
-Richard Jones
-
-=head1 BUGS
-
-Report any bugs discovered to the libvirt community via the
-mailing list C<http://libvirt.org/contact.html> or bug tracker C<http://libvirt.org/bugs.html>.
-Alternatively report bugs to your software distributor / vendor.
-
-=head1 COPYRIGHT
-
-Copyright (C) 2006-2012 by Red Hat, Inc.
-
-=head1 LICENSE
-
-virt-pki-validate is distributed under the terms of the GNU GPL v2+.
-This is free software; see the source for copying conditions. There
-is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE
-
-=head1 SEE ALSO
-
-C<virsh(1)>, online PKI setup instructions C<http://libvirt.org/remote.html>
-
-=cut
diff --git a/tools/virt-pki-validate.pod b/tools/virt-pki-validate.pod
new file mode 100644
index 0000000..b216f56
--- /dev/null
+++ b/tools/virt-pki-validate.pod
@@ -0,0 +1,60 @@
+=head1 NAME
+
+  virt-pki-validate - validate libvirt PKI files are configured correctly
+
+=head1 SYNOPSIS
+
+  virt-pki-validate [OPTION]
+
+=head1 DESCRIPTION
+
+This tool validates that the necessary PKI files are configured for
+a secure libvirt server or client using the TLS encryption protocol.
+It will report any missing certificate or key files on the host. It
+should be run as root to ensure it can read all the necessary files
+
+=head1 OPTIONS
+
+=over
+
+=item B<-h, --help>
+
+Display command line help usage then exit.
+
+=item B<-V, --version>
+
+Display version information then exit.
+
+=back
+
+=head1 EXIT STATUS
+
+Upon successful validation, an exit status of 0 will be set. Upon
+failure a non-zero status will be set.
+
+=head1 AUTHOR
+
+Richard Jones
+
+=head1 BUGS
+
+Report any bugs discovered to the libvirt community via the
+mailing list C<http://libvirt.org/contact.html> or bug tracker C<http://libvirt.org/bugs.html>.
+Alternatively report bugs to your software distributor / vendor.
+
+=head1 COPYRIGHT
+
+Copyright (C) 2006-2012 by Red Hat, Inc.
+
+=head1 LICENSE
+
+virt-pki-validate is distributed under the terms of the GNU GPL v2+.
+This is free software; see the source for copying conditions. There
+is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE
+
+=head1 SEE ALSO
+
+C<virsh(1)>, online PKI setup instructions C<http://libvirt.org/remote.html>
+
+=cut
diff --git a/tools/virt-sanlock-cleanup.in b/tools/virt-sanlock-cleanup.in
index 9855f42..6551b04 100644
--- a/tools/virt-sanlock-cleanup.in
+++ b/tools/virt-sanlock-cleanup.in
@@ -59,55 +59,3 @@ do
 done
 
 exit 0
-
-: <<=cut
-=pod
-
-=head1 NAME
-
-  virt-sanlock-cleanup - remove stale sanlock resource lease files
-
-=head1 SYNOPSIS
-
-  virt-sanlock-cleanup
-
-=head1 DESCRIPTION
-
-This tool removes any resource lease files created by the sanlock
-lock manager plugin. The resource lease files only need to exist
-on disks when a guest using the resource is active. This script
-reclaims the disk space used by resources which are not currently
-active.
-
-=head1 EXIT STATUS
-
-Upon successful processing of leases cleanup, an exit status
-of 0 will be set. Upon fatal error a non-zero status will
-be set.
-
-=head1 AUTHOR
-
-Daniel Berrange
-
-=head1 BUGS
-
-Report any bugs discovered to the libvirt community via the
-mailing list C<http://libvirt.org/contact.html> or bug tracker C<http://libvirt.org/bugs.html>.
-Alternatively report bugs to your software distributor / vendor.
-
-=head1 COPYRIGHT
-
-Copyright (C) 2011, 2013 Red Hat, Inc.
-
-=head1 LICENSE
-
-virt-sanlock-cleanup is distributed under the terms of the GNU GPL v2+.
-This is free software; see the source for copying conditions. There
-is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE
-
-=head1 SEE ALSO
-
-C<virsh(1)>, online instructions C<http://libvirt.org/locking.html>
-
-=cut
diff --git a/tools/virt-sanlock-cleanup.pod b/tools/virt-sanlock-cleanup.pod
new file mode 100644
index 0000000..69a2b5d
--- /dev/null
+++ b/tools/virt-sanlock-cleanup.pod
@@ -0,0 +1,48 @@
+=head1 NAME
+
+  virt-sanlock-cleanup - remove stale sanlock resource lease files
+
+=head1 SYNOPSIS
+
+  virt-sanlock-cleanup
+
+=head1 DESCRIPTION
+
+This tool removes any resource lease files created by the sanlock
+lock manager plugin. The resource lease files only need to exist
+on disks when a guest using the resource is active. This script
+reclaims the disk space used by resources which are not currently
+active.
+
+=head1 EXIT STATUS
+
+Upon successful processing of leases cleanup, an exit status
+of 0 will be set. Upon fatal error a non-zero status will
+be set.
+
+=head1 AUTHOR
+
+Daniel Berrange
+
+=head1 BUGS
+
+Report any bugs discovered to the libvirt community via the
+mailing list C<http://libvirt.org/contact.html> or bug tracker C<http://libvirt.org/bugs.html>.
+Alternatively report bugs to your software distributor / vendor.
+
+=head1 COPYRIGHT
+
+Copyright (C) 2011, 2013 Red Hat, Inc.
+
+=head1 LICENSE
+
+virt-sanlock-cleanup is distributed under the terms of the GNU GPL v2+.
+This is free software; see the source for copying conditions. There
+is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE
+
+=head1 SEE ALSO
+
+C<virsh(1)>, online instructions C<http://libvirt.org/locking.html>
+
+=cut
diff --git a/tools/virt-xml-validate.in b/tools/virt-xml-validate.in
index a04fa06..81fde4d 100644
--- a/tools/virt-xml-validate.in
+++ b/tools/virt-xml-validate.in
@@ -102,116 +102,3 @@ fi
 xmllint --noout --relaxng "$SCHEMA" "$XMLFILE"
 
 exit
-
-: <<=cut
-=pod
-
-=head1 NAME
-
-  virt-xml-validate - validate libvirt XML files against a schema
-
-=head1 SYNOPSIS
-
-  virt-xml-validate XML-FILE [SCHEMA-NAME]
-  virt-xml-validate OPTION
-
-=head1 DESCRIPTION
-
-Validates a libvirt XML for compliance with the published schema.
-The first compulsory argument is the path to the XML file to be
-validated. The optional second argument is the name of the schema
-to validate against. If omitted, the schema name will be inferred
-from the name of the root element in the XML document.
-
-Valid schema names currently include
-
-=over 4
-
-=item C<domainsnapshot>
-
-The schema for the XML format used by domain snapshot configuration
-
-=item C<domain>
-
-The schema for the XML format used by guest domains configuration
-
-=item C<network>
-
-The schema for the XML format used by virtual network configuration
-
-=item C<storagepool>
-
-The schema for the XML format used by storage pool configuration
-
-=item C<storagevol>
-
-The schema for the XML format used by storage volume descriptions
-
-=item C<nodedev>
-
-The schema for the XML format used by node device descriptions
-
-=item C<capability>
-
-The schema for the XML format used to declare driver capabilities
-
-=item C<nwfilter>
-
-The schema for the XML format used by network traffic filters
-
-=item C<secret>
-
-The schema for the XML format used by secrets descriptions
-
-=item C<interface>
-
-The schema for the XML format used by physical host interfaces
-
-=back
-
-=head1 OPTIONS
-
-=over
-
-=item B<-h, --help>
-
-Display command line help usage then exit.
-
-=item B<-V, --version>
-
-Display version information then exit.
-
-=back
-
-=head1 EXIT STATUS
-
-Upon successful validation, an exit status of 0 will be set. Upon
-failure a non-zero status will be set.
-
-=head1 AUTHOR
-
-Daniel P.Berrange
-
-=head1 BUGS
-
-Report any bugs discovered to the libvirt community via the
-mailing list C<http://libvirt.org/contact.html> or bug tracker C<http://libvirt.org/bugs.html>.
-Alternatively report bugs to your software distributor / vendor.
-
-=head1 COPYRIGHT
-
-Copyright (C) 2009-2013 by Red Hat, Inc.
-Copyright (C) 2009 by Daniel P. Berrange
-
-=head1 LICENSE
-
-virt-xml-validate is distributed under the terms of the GNU GPL v2+.
-This is free software; see the source for copying conditions. There
-is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE
-
-=head1 SEE ALSO
-
-C<virsh(1)>, online XML format descriptions C<http://libvirt.org/format.html>
-
-=cut
diff --git a/tools/virt-xml-validate.pod b/tools/virt-xml-validate.pod
new file mode 100644
index 0000000..1df5a93
--- /dev/null
+++ b/tools/virt-xml-validate.pod
@@ -0,0 +1,109 @@
+=head1 NAME
+
+  virt-xml-validate - validate libvirt XML files against a schema
+
+=head1 SYNOPSIS
+
+  virt-xml-validate XML-FILE [SCHEMA-NAME]
+  virt-xml-validate OPTION
+
+=head1 DESCRIPTION
+
+Validates a libvirt XML for compliance with the published schema.
+The first compulsory argument is the path to the XML file to be
+validated. The optional second argument is the name of the schema
+to validate against. If omitted, the schema name will be inferred
+from the name of the root element in the XML document.
+
+Valid schema names currently include
+
+=over 4
+
+=item C<domainsnapshot>
+
+The schema for the XML format used by domain snapshot configuration
+
+=item C<domain>
+
+The schema for the XML format used by guest domains configuration
+
+=item C<network>
+
+The schema for the XML format used by virtual network configuration
+
+=item C<storagepool>
+
+The schema for the XML format used by storage pool configuration
+
+=item C<storagevol>
+
+The schema for the XML format used by storage volume descriptions
+
+=item C<nodedev>
+
+The schema for the XML format used by node device descriptions
+
+=item C<capability>
+
+The schema for the XML format used to declare driver capabilities
+
+=item C<nwfilter>
+
+The schema for the XML format used by network traffic filters
+
+=item C<secret>
+
+The schema for the XML format used by secrets descriptions
+
+=item C<interface>
+
+The schema for the XML format used by physical host interfaces
+
+=back
+
+=head1 OPTIONS
+
+=over
+
+=item B<-h, --help>
+
+Display command line help usage then exit.
+
+=item B<-V, --version>
+
+Display version information then exit.
+
+=back
+
+=head1 EXIT STATUS
+
+Upon successful validation, an exit status of 0 will be set. Upon
+failure a non-zero status will be set.
+
+=head1 AUTHOR
+
+Daniel P.Berrange
+
+=head1 BUGS
+
+Report any bugs discovered to the libvirt community via the
+mailing list C<http://libvirt.org/contact.html> or bug tracker C<http://libvirt.org/bugs.html>.
+Alternatively report bugs to your software distributor / vendor.
+
+=head1 COPYRIGHT
+
+Copyright (C) 2009-2013 by Red Hat, Inc.
+Copyright (C) 2009 by Daniel P. Berrange
+
+=head1 LICENSE
+
+virt-xml-validate is distributed under the terms of the GNU GPL v2+.
+This is free software; see the source for copying conditions. There
+is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE
+
+=head1 SEE ALSO
+
+C<virsh(1)>, online XML format descriptions C<http://libvirt.org/format.html>
+
+=cut
-- 
2.5.5




More information about the libvir-list mailing list