[libvirt] [PATCH 00/13] build: Fix and improve man pages handling

There are a bunch of issues in the way we handle man pages; most importantly, installed man pages (like libvirtd.8) end up having stuff like SYSCONFDIR/libvirtd.conf in the FILES section. This series makes it so all man pages are generated through the same steps: 1. process $command.pod (shipped) with pod2man(1) to convert pod markup to groff markup and obtain $command.$section.in (shipped) 2. process $command.$section.in with sed(1) to insert host-specific information such as @sysconfdir@ and obtain $command.$section (not shipped) As a follow-up improvement, it would be great if we could abstract those two steps into macros to reduce code duplication even further. Please provide hints on the best way to achieve that :) A number of other minor issues are fixed along the way. Cheers. Andrea Bolognani (13): build: Ship virt-admin.pod build: Extract pod from source files build: Build man pages in $(builddir) build: Perform post-processing on all man pages build: Standardize on .pod -> .x.in -> .x build: Never ship man pages build: Group files build: Ensure intermediate files are cleaned up properly build: Replace variables in man pages build: Always ship virt-login-shell.conf man: Fix NAME section man: Fix SYNOPSIS section man: Fix links daemon/Makefile.am | 43 +++++---- daemon/{libvirtd.pod.in => libvirtd.pod} | 4 +- src/Makefile.am | 69 ++++++++------ src/locking/{virtlockd.pod.in => virtlockd.pod} | 4 +- src/logging/{virtlogd.pod.in => virtlogd.pod} | 4 +- tools/Makefile.am | 114 +++++++++++++++--------- tools/virsh.pod | 6 +- tools/virt-admin.pod | 6 +- tools/virt-host-validate.c | 74 --------------- tools/virt-host-validate.pod | 68 ++++++++++++++ tools/virt-login-shell.pod | 3 +- tools/virt-pki-validate.in | 64 ------------- tools/virt-pki-validate.pod | 61 +++++++++++++ tools/virt-sanlock-cleanup.in | 52 ----------- tools/virt-sanlock-cleanup.pod | 49 ++++++++++ tools/virt-xml-validate.in | 113 ----------------------- tools/virt-xml-validate.pod | 111 +++++++++++++++++++++++ 17 files changed, 440 insertions(+), 405 deletions(-) rename daemon/{libvirtd.pod.in => libvirtd.pod} (97%) rename src/locking/{virtlockd.pod.in => virtlockd.pod} (97%) rename src/logging/{virtlogd.pod.in => virtlogd.pod} (97%) 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 -- 2.5.5

This is the source file for the virt-admin(1) manual page, so it should be shipped. --- tools/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/Makefile.am b/tools/Makefile.am index 560a9a5..70c3a70 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -44,6 +44,7 @@ EXTRA_DIST = \ virt-pki-validate.in \ virt-sanlock-cleanup.in \ virt-sanlock-cleanup.8 \ + virt-admin.pod \ virt-login-shell.pod \ virsh.pod \ libvirt-guests.sysconf \ -- 2.5.5

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

No file should be created inside $(srcdir) during build. --- daemon/Makefile.am | 6 +++--- src/Makefile.am | 10 +++++----- tools/Makefile.am | 10 ++++------ 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 78d7d21..13ae1c2 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -162,7 +162,7 @@ augeastests_DATA = test_libvirtd.aug CLEANFILES += test_libvirtd.aug -libvirtd.8: $(srcdir)/libvirtd.8.in +libvirtd.8: libvirtd.8.in $(AM_V_GEN)sed \ -e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \ -e 's|[@]localstatedir[@]|$(localstatedir)|g' \ @@ -517,7 +517,7 @@ endif ! WITH_LIBVIRTD POD2MAN = pod2man -c "Virtualization Support" \ -r "$(PACKAGE)-$(VERSION)" -s 8 -$(srcdir)/libvirtd.8.in: libvirtd.pod.in $(top_srcdir)/configure.ac +libvirtd.8.in: libvirtd.pod.in $(top_srcdir)/configure.ac $(AM_V_GEN)$(POD2MAN) --name LIBVIRTD $< $@ \ && if grep 'POD ERROR' $@ ; then rm $@; exit 1; fi @@ -540,4 +540,4 @@ endif ! WITH_SASL CLEANFILES += $(BUILT_SOURCES) $(man8_MANS) CLEANFILES += *.cov *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda -MAINTAINERCLEANFILES = $(srcdir)/libvirtd.8.in $(DAEMON_GENERATED) +MAINTAINERCLEANFILES = libvirtd.8.in $(DAEMON_GENERATED) diff --git a/src/Makefile.am b/src/Makefile.am index f5e57c0..c2ec53f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2563,22 +2563,22 @@ virtlogd.init: logging/virtlogd.init.in $(top_builddir)/config.status POD2MAN = pod2man -c "Virtualization Support" \ -r "$(PACKAGE)-$(VERSION)" -s 8 -$(srcdir)/virtlockd.8.in: locking/virtlockd.pod.in $(top_srcdir)/configure.ac +virtlockd.8.in: locking/virtlockd.pod.in $(top_srcdir)/configure.ac $(AM_V_GEN)$(POD2MAN) --name VIRTLOCKD $< $@ \ && if grep 'POD ERROR' $@ ; then rm $@; exit 1; fi -virtlockd.8: $(srcdir)/virtlockd.8.in +virtlockd.8: virtlockd.8.in $(AM_V_GEN)sed \ -e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \ -e 's|[@]localstatedir[@]|$(localstatedir)|g' \ < $< > $@-t && \ mv $@-t $@ -$(srcdir)/virtlogd.8.in: logging/virtlogd.pod.in $(top_srcdir)/configure.ac +virtlogd.8.in: logging/virtlogd.pod.in $(top_srcdir)/configure.ac $(AM_V_GEN)$(POD2MAN) --name VIRTLOGD $< $@ \ && if grep 'POD ERROR' $@ ; then rm $@; exit 1; fi -virtlogd.8: $(srcdir)/virtlogd.8.in +virtlogd.8: virtlogd.8.in $(AM_V_GEN)sed \ -e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \ -e 's|[@]localstatedir[@]|$(localstatedir)|g' \ @@ -2596,7 +2596,7 @@ endif WITH_LIBVIRTD CLEANFILES += test_virtlockd.aug virtlockd.8 \ test_virtlogd.aug virtlogd.8 -MAINTAINERCLEANFILES += $(srcdir)/virtlockd.8.in $(srcdir)/virtlogd.8.in +MAINTAINERCLEANFILES += virtlockd.8.in virtlogd.8.in EXTRA_DIST += \ locking/virtlockd.service.in \ diff --git a/tools/Makefile.am b/tools/Makefile.am index dd058fa..298b01b 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -267,14 +267,12 @@ virsh_win_icon.$(OBJEXT): virsh_win_icon.rc endif WITH_WIN_ICON %.1: %.pod $(top_srcdir)/configure.ac - $(AM_V_GEN)$(POD2MAN) $< $(srcdir)/$@ \ - && if grep 'POD ERROR' $(srcdir)/$@ ; then \ - rm $(srcdir)/$@; exit 1; fi + $(AM_V_GEN)$(POD2MAN) $< $@ \ + && if grep 'POD ERROR' $@ ; then rm $@; 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 + $(AM_V_GEN)$(POD2MAN) --section=8 $< $@ \ + && if grep 'POD ERROR' $@ ; then rm $@; exit 1; fi install-data-local: install-init install-systemd -- 2.5.5

Man pages in daemon/ and src/ are being already subjected to this post-processing step: make it so those in tools/ are as well. --- tools/Makefile.am | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/tools/Makefile.am b/tools/Makefile.am index 298b01b..eb9adb8 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -51,6 +51,13 @@ EXTRA_DIST = \ virt-sanlock-cleanup.pod \ virt-xml-validate.pod \ virsh.pod \ + virt-admin.1.in \ + virt-host-validate.1.in \ + virt-login-shell.1.in \ + virt-pki-validate.1.in \ + virt-sanlock-cleanup.8.in \ + virt-xml-validate.1.in \ + virsh.1.in \ libvirt-guests.sysconf \ virsh-edit.c \ virsh-domain.c \ @@ -266,14 +273,28 @@ virsh_win_icon.$(OBJEXT): virsh_win_icon.rc --output-format coff --output $@ endif WITH_WIN_ICON -%.1: %.pod $(top_srcdir)/configure.ac +%.1.in: %.pod $(AM_V_GEN)$(POD2MAN) $< $@ \ && if grep 'POD ERROR' $@ ; then rm $@; exit 1; fi -%.8: %.pod $(top_srcdir)/configure.ac +%.8.in: %.pod $(AM_V_GEN)$(POD2MAN) --section=8 $< $@ \ && if grep 'POD ERROR' $@ ; then rm $@; exit 1; fi +%.1: %.1.in $(top_srcdir)/configure.ac + $(AM_V_GEN)sed \ + -e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \ + -e 's|[@]localstatedir[@]|$(localstatedir)|g' \ + < $< > $@-t && \ + mv $@-t $@ + +%.8: %.8.in $(top_srcdir)/configure.ac + $(AM_V_GEN)sed \ + -e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \ + -e 's|[@]localstatedir[@]|$(localstatedir)|g' \ + < $< > $@-t && \ + mv $@-t $@ + install-data-local: install-init install-systemd uninstall-local: uninstall-init uninstall-systemd -- 2.5.5

After this commit, all man pages are generated using the same two steps: 1. Process a source $command.pod file with pod2man(1) to obtain a valid man page in $command.$section.in 2. Process $command.$section.in with sed(1) to obtain the final man page in $command.$section --- daemon/Makefile.am | 25 +++++++++--------- daemon/{libvirtd.pod.in => libvirtd.pod} | 0 src/Makefile.am | 34 ++++++++++--------------- src/locking/{virtlockd.pod.in => virtlockd.pod} | 0 src/logging/{virtlogd.pod.in => virtlogd.pod} | 0 tools/Makefile.am | 4 +-- 6 files changed, 27 insertions(+), 36 deletions(-) rename daemon/{libvirtd.pod.in => libvirtd.pod} (100%) rename src/locking/{virtlockd.pod.in => virtlockd.pod} (100%) rename src/logging/{virtlogd.pod.in => virtlogd.pod} (100%) diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 13ae1c2..6a82cc9 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -70,7 +70,7 @@ EXTRA_DIST = \ libvirtd.uml.logrotate.in \ test_libvirtd.aug.in \ THREADS.txt \ - libvirtd.pod.in \ + libvirtd.pod \ libvirtd.8.in \ $(DAEMON_SOURCES) \ $(LIBVIRTD_CONF_SOURCES) \ @@ -162,13 +162,6 @@ augeastests_DATA = test_libvirtd.aug CLEANFILES += test_libvirtd.aug -libvirtd.8: libvirtd.8.in - $(AM_V_GEN)sed \ - -e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \ - -e 's|[@]localstatedir[@]|$(localstatedir)|g' \ - < $< > $@-t && \ - mv $@-t $@ - libvirtd_SOURCES = $(DAEMON_SOURCES) #-D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_POSIX_C_SOURCE=199506L @@ -514,12 +507,18 @@ install-data-local: install-data-sasl uninstall-local:: uninstall-data-sasl endif ! WITH_LIBVIRTD -POD2MAN = pod2man -c "Virtualization Support" \ - -r "$(PACKAGE)-$(VERSION)" -s 8 +POD2MAN = pod2man -c "Virtualization Support" -r "$(PACKAGE)-$(VERSION)" -libvirtd.8.in: libvirtd.pod.in $(top_srcdir)/configure.ac - $(AM_V_GEN)$(POD2MAN) --name LIBVIRTD $< $@ \ - && if grep 'POD ERROR' $@ ; then rm $@; exit 1; fi +%.8.in: %.pod + $(AM_V_GEN)$(POD2MAN) --section=8 $< $@ \ + && if grep 'POD ERROR' $@ ; then rm $@; exit 1; fi + +%.8: %.8.in $(top_srcdir)/configure.ac + $(AM_V_GEN)sed \ + -e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \ + -e 's|[@]localstatedir[@]|$(localstatedir)|g' \ + < $< > $@-t && \ + mv $@-t $@ # This is needed for clients too, so can't wrap in # the WITH_LIBVIRTD conditional diff --git a/daemon/libvirtd.pod.in b/daemon/libvirtd.pod similarity index 100% rename from daemon/libvirtd.pod.in rename to daemon/libvirtd.pod diff --git a/src/Makefile.am b/src/Makefile.am index c2ec53f..fcbcd44 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2560,29 +2560,21 @@ virtlogd.init: logging/virtlogd.init.in $(top_builddir)/config.status chmod a+x $@-t && \ mv $@-t $@ -POD2MAN = pod2man -c "Virtualization Support" \ - -r "$(PACKAGE)-$(VERSION)" -s 8 +POD2MAN = pod2man -c "Virtualization Support" -r "$(PACKAGE)-$(VERSION)" -virtlockd.8.in: locking/virtlockd.pod.in $(top_srcdir)/configure.ac - $(AM_V_GEN)$(POD2MAN) --name VIRTLOCKD $< $@ \ - && if grep 'POD ERROR' $@ ; then rm $@; exit 1; fi +virtlockd.8.in: locking/virtlockd.pod + $(AM_V_GEN)$(POD2MAN) --section 8 $< $@ \ + && if grep 'POD ERROR' $@ ; then rm $@; exit 1; fi -virtlockd.8: virtlockd.8.in - $(AM_V_GEN)sed \ - -e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \ - -e 's|[@]localstatedir[@]|$(localstatedir)|g' \ - < $< > $@-t && \ - mv $@-t $@ - -virtlogd.8.in: logging/virtlogd.pod.in $(top_srcdir)/configure.ac - $(AM_V_GEN)$(POD2MAN) --name VIRTLOGD $< $@ \ - && if grep 'POD ERROR' $@ ; then rm $@; exit 1; fi +virtlogd.8.in: logging/virtlogd.pod + $(AM_V_GEN)$(POD2MAN) --section 8 $< $@ \ + && if grep 'POD ERROR' $@ ; then rm $@; exit 1; fi -virtlogd.8: virtlogd.8.in +%.8: %.8.in $(top_srcdir)/configure.ac $(AM_V_GEN)sed \ - -e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \ - -e 's|[@]localstatedir[@]|$(localstatedir)|g' \ - < $< > $@-t && \ + -e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \ + -e 's|[@]localstatedir[@]|$(localstatedir)|g' \ + < $< > $@-t && \ mv $@-t $@ if WITH_LIBVIRTD @@ -2601,14 +2593,14 @@ MAINTAINERCLEANFILES += virtlockd.8.in virtlogd.8.in EXTRA_DIST += \ locking/virtlockd.service.in \ locking/virtlockd.socket.in \ - locking/virtlockd.pod.in \ + locking/virtlockd.pod \ virtlockd.8.in \ locking/virtlockd.aug \ locking/virtlockd.conf \ locking/test_virtlockd.aug.in \ logging/virtlogd.service.in \ logging/virtlogd.socket.in \ - logging/virtlogd.pod.in \ + logging/virtlogd.pod \ virtlogd.8.in \ logging/virtlogd.aug \ logging/virtlogd.conf \ diff --git a/src/locking/virtlockd.pod.in b/src/locking/virtlockd.pod similarity index 100% rename from src/locking/virtlockd.pod.in rename to src/locking/virtlockd.pod diff --git a/src/logging/virtlogd.pod.in b/src/logging/virtlogd.pod similarity index 100% rename from src/logging/virtlogd.pod.in rename to src/logging/virtlogd.pod diff --git a/tools/Makefile.am b/tools/Makefile.am index eb9adb8..78bd22f 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -28,8 +28,6 @@ AM_LDFLAGS = \ $(NO_INDIRECT_LDFLAGS) \ $(NULL) -POD2MAN = pod2man -c "Virtualization Support" -r "$(PACKAGE)-$(VERSION)" - ICON_FILES = \ libvirt_win_icon_16x16.ico \ libvirt_win_icon_32x32.ico \ @@ -273,6 +271,8 @@ virsh_win_icon.$(OBJEXT): virsh_win_icon.rc --output-format coff --output $@ endif WITH_WIN_ICON +POD2MAN = pod2man -c "Virtualization Support" -r "$(PACKAGE)-$(VERSION)" + %.1.in: %.pod $(AM_V_GEN)$(POD2MAN) $< $@ \ && if grep 'POD ERROR' $@ ; then rm $@; exit 1; fi -- 2.5.5

The generated man pages may contain information that depend on the build configuration, so they should not be shipped but rather always built on the user's machine. --- tools/Makefile.am | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/tools/Makefile.am b/tools/Makefile.am index 78bd22f..dab5958 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -41,7 +41,6 @@ EXTRA_DIST = \ virt-xml-validate.in \ virt-pki-validate.in \ virt-sanlock-cleanup.in \ - virt-sanlock-cleanup.8 \ virt-admin.pod \ virt-host-validate.pod \ virt-login-shell.pod \ @@ -76,7 +75,7 @@ conf_DATA = bin_SCRIPTS = virt-xml-validate virt-pki-validate bin_PROGRAMS = virsh virt-admin libexec_SCRIPTS = libvirt-guests.sh -dist_man1_MANS = \ +man1_MANS = \ virt-pki-validate.1 \ virt-xml-validate.1 \ virsh.1 \ @@ -84,26 +83,23 @@ dist_man1_MANS = \ if WITH_SANLOCK sbin_SCRIPTS = virt-sanlock-cleanup -dist_man8_MANS = virt-sanlock-cleanup.8 +man8_MANS = virt-sanlock-cleanup.8 DISTCLEANFILES += virt-sanlock-cleanup endif WITH_SANLOCK if WITH_LOGIN_SHELL conf_DATA += virt-login-shell.conf bin_PROGRAMS += virt-login-shell -dist_man1_MANS += virt-login-shell.1 +man1_MANS += virt-login-shell.1 else ! WITH_LOGIN_SHELL EXTRA_DIST += \ - virt-login-shell.conf \ - virt-login-shell.1 + virt-login-shell.conf endif ! WITH_LOGIN_SHELL if WITH_HOST_VALIDATE bin_PROGRAMS += virt-host-validate -dist_man1_MANS += virt-host-validate.1 -else ! WITH_HOST_VALIDATE -EXTRA_DIST += virt-host-validate.1 -endif ! WITH_HOST_VALIDATE +man1_MANS += virt-host-validate.1 +endif WITH_HOST_VALIDATE virt-xml-validate: virt-xml-validate.in Makefile $(AM_V_GEN)sed -e 's|[@]schemadir@|$(pkgdatadir)/schemas|g' \ @@ -490,6 +486,6 @@ clean-local: CLEANFILES += $(bin_SCRIPTS) CLEANFILES += *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda *.i *.s -MAINTAINERCLEANFILES = $(dist_man1_MANS) +CLEANFILES += $(man1_MANS) $(man8_MANS) DISTCLEANFILES += $(BUILT_SOURCES) -- 2.5.5

Define $(PODFILES) and $(MANINFILES) so that adding a new man page only requires changes in a few, well defined spots. --- daemon/Makefile.am | 14 +++++++++++--- src/Makefile.am | 21 ++++++++++++++------- tools/Makefile.am | 39 ++++++++++++++++++++++++--------------- 3 files changed, 49 insertions(+), 25 deletions(-) diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 6a82cc9..9a8b8d1 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -46,6 +46,14 @@ DAEMON_SOURCES = \ LIBVIRTD_CONF_SOURCES = libvirtd-config.c libvirtd-config.h +PODFILES = \ + libvirtd.pod \ + $(NULL) + +MANINFILES = \ + libvirtd.8.in \ + $(NULL) + DISTCLEANFILES = EXTRA_DIST = \ remote_dispatch.h \ @@ -70,8 +78,8 @@ EXTRA_DIST = \ libvirtd.uml.logrotate.in \ test_libvirtd.aug.in \ THREADS.txt \ - libvirtd.pod \ - libvirtd.8.in \ + $(PODFILES) \ + $(MANINFILES) \ $(DAEMON_SOURCES) \ $(LIBVIRTD_CONF_SOURCES) \ $(NULL) @@ -539,4 +547,4 @@ endif ! WITH_SASL CLEANFILES += $(BUILT_SOURCES) $(man8_MANS) CLEANFILES += *.cov *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda -MAINTAINERCLEANFILES = libvirtd.8.in $(DAEMON_GENERATED) +MAINTAINERCLEANFILES = $(MANINFILES) $(DAEMON_GENERATED) diff --git a/src/Makefile.am b/src/Makefile.am index fcbcd44..73e4026 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2586,25 +2586,32 @@ augeas_DATA += locking/virtlockd.aug logging/virtlogd.aug augeastest_DATA += test_virtlockd.aug test_virtlogd.aug endif WITH_LIBVIRTD -CLEANFILES += test_virtlockd.aug virtlockd.8 \ - test_virtlogd.aug virtlogd.8 -MAINTAINERCLEANFILES += virtlockd.8.in virtlogd.8.in +PODFILES = \ + locking/virtlockd.pod \ + logging/virtlogd.pod \ + $(NULL) + +MANINFILES = \ + virtlockd.8.in \ + virtlogd.8.in \ + $(NULL) + +CLEANFILES += test_virtlockd.aug test_virtlogd.aug $(man8_MANS) +MAINTAINERCLEANFILES += $(MANINFILES) EXTRA_DIST += \ locking/virtlockd.service.in \ locking/virtlockd.socket.in \ - locking/virtlockd.pod \ - virtlockd.8.in \ locking/virtlockd.aug \ locking/virtlockd.conf \ locking/test_virtlockd.aug.in \ logging/virtlogd.service.in \ logging/virtlogd.socket.in \ - logging/virtlogd.pod \ - virtlogd.8.in \ logging/virtlogd.aug \ logging/virtlogd.conf \ logging/test_virtlogd.aug.in \ + $(PODFILES) \ + $(MANINFILES) \ $(NULL) diff --git a/tools/Makefile.am b/tools/Makefile.am index dab5958..913689f 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -35,26 +35,32 @@ ICON_FILES = \ libvirt_win_icon_64x64.ico \ virsh_win_icon.rc +PODFILES = \ + 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 \ + $(NULL) + +MANINFILES = \ + virt-admin.1.in \ + virt-host-validate.1.in \ + virt-login-shell.1.in \ + virt-pki-validate.1.in \ + virt-sanlock-cleanup.8.in \ + virt-xml-validate.1.in \ + virsh.1.in \ + $(NULL) + EXTRA_DIST = \ $(ICON_FILES) \ $(conf_DATA) \ virt-xml-validate.in \ virt-pki-validate.in \ virt-sanlock-cleanup.in \ - 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 \ - virt-admin.1.in \ - virt-host-validate.1.in \ - virt-login-shell.1.in \ - virt-pki-validate.1.in \ - virt-sanlock-cleanup.8.in \ - virt-xml-validate.1.in \ - virsh.1.in \ libvirt-guests.sysconf \ virsh-edit.c \ virsh-domain.c \ @@ -63,7 +69,10 @@ EXTRA_DIST = \ virsh-network.c virsh-nodedev.c \ virsh-nwfilter.c virsh-pool.c \ virsh-secret.c virsh-snapshot.c \ - virsh-volume.c + virsh-volume.c \ + $(PODFILES) \ + $(MANINFILES) \ + $(NULL) CLEANFILES = -- 2.5.5

All $(MANINFILES) should be deleted on distclean. --- tools/Makefile.am | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/Makefile.am b/tools/Makefile.am index 913689f..3ea25a4 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -77,6 +77,7 @@ EXTRA_DIST = \ CLEANFILES = DISTCLEANFILES = +MAINTAINERCLEANFILES = confdir = $(sysconfdir)/libvirt conf_DATA = @@ -498,3 +499,5 @@ CLEANFILES += *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda *.i *.s CLEANFILES += $(man1_MANS) $(man8_MANS) DISTCLEANFILES += $(BUILT_SOURCES) + +MAINTAINERCLEANFILES += $(MANINFILES) -- 2.5.5

We can't use eg. @sysconfdir@ directly in the .pod file, because pod2man(1) will interpret that as a variable name and format it accordingly. Instead, we use eg. SYSCONFDIR and use a subsequent sed(1) call to turn it into the expected @sysconfdir@. --- daemon/Makefile.am | 10 ++++++++-- src/Makefile.am | 20 ++++++++++++++++---- tools/Makefile.am | 20 ++++++++++++++++---- 3 files changed, 40 insertions(+), 10 deletions(-) diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 9a8b8d1..a4c4758 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -518,8 +518,14 @@ endif ! WITH_LIBVIRTD POD2MAN = pod2man -c "Virtualization Support" -r "$(PACKAGE)-$(VERSION)" %.8.in: %.pod - $(AM_V_GEN)$(POD2MAN) --section=8 $< $@ \ - && if grep 'POD ERROR' $@ ; then rm $@; exit 1; fi + $(AM_V_GEN)$(POD2MAN) --section=8 $< $@-t1 && \ + if grep 'POD ERROR' $@-t1; then rm $@-t1; exit 1; fi && \ + sed \ + -e 's|SYSCONFDIR|\@sysconfdir\@|g' \ + -e 's|LOCALSTATEDIR|\@localstatedir\@|g' \ + < $@-t1 > $@-t2 && \ + rm -f $@-t1 && \ + mv $@-t2 $@ %.8: %.8.in $(top_srcdir)/configure.ac $(AM_V_GEN)sed \ diff --git a/src/Makefile.am b/src/Makefile.am index 73e4026..aee9c6e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2563,12 +2563,24 @@ virtlogd.init: logging/virtlogd.init.in $(top_builddir)/config.status POD2MAN = pod2man -c "Virtualization Support" -r "$(PACKAGE)-$(VERSION)" virtlockd.8.in: locking/virtlockd.pod - $(AM_V_GEN)$(POD2MAN) --section 8 $< $@ \ - && if grep 'POD ERROR' $@ ; then rm $@; exit 1; fi + $(AM_V_GEN)$(POD2MAN) --section=8 $< $@-t1 && \ + if grep 'POD ERROR' $@-t1; then rm $@-t1; exit 1; fi && \ + sed \ + -e 's|SYSCONFDIR|\@sysconfdir\@|g' \ + -e 's|LOCALSTATEDIR|\@localstatedir\@|g' \ + < $@-t1 > $@-t2 && \ + rm -f $@-t1 && \ + mv $@-t2 $@ virtlogd.8.in: logging/virtlogd.pod - $(AM_V_GEN)$(POD2MAN) --section 8 $< $@ \ - && if grep 'POD ERROR' $@ ; then rm $@; exit 1; fi + $(AM_V_GEN)$(POD2MAN) --section=8 $< $@-t1 && \ + if grep 'POD ERROR' $@-t1; then rm $@-t1; exit 1; fi && \ + sed \ + -e 's|SYSCONFDIR|\@sysconfdir\@|g' \ + -e 's|LOCALSTATEDIR|\@localstatedir\@|g' \ + < $@-t1 > $@-t2 && \ + rm -f $@-t1 && \ + mv $@-t2 $@ %.8: %.8.in $(top_srcdir)/configure.ac $(AM_V_GEN)sed \ diff --git a/tools/Makefile.am b/tools/Makefile.am index 3ea25a4..254e667 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -280,12 +280,24 @@ endif WITH_WIN_ICON POD2MAN = pod2man -c "Virtualization Support" -r "$(PACKAGE)-$(VERSION)" %.1.in: %.pod - $(AM_V_GEN)$(POD2MAN) $< $@ \ - && if grep 'POD ERROR' $@ ; then rm $@; exit 1; fi + $(AM_V_GEN)$(POD2MAN) $< $@-t1 && \ + if grep 'POD ERROR' $@-t1; then rm $@-t1; exit 1; fi && \ + sed \ + -e 's|SYSCONFDIR|\@sysconfdir\@|g' \ + -e 's|LOCALSTATEDIR|\@localstatedir\@|g' \ + < $@-t1 > $@-t2 && \ + rm -f $@-t1 && \ + mv $@-t2 $@ %.8.in: %.pod - $(AM_V_GEN)$(POD2MAN) --section=8 $< $@ \ - && if grep 'POD ERROR' $@ ; then rm $@; exit 1; fi + $(AM_V_GEN)$(POD2MAN) --section=8 $< $@-t1 && \ + if grep 'POD ERROR' $@-t1; then rm $@-t1; exit 1; fi && \ + sed \ + -e 's|SYSCONFDIR|\@sysconfdir\@|g' \ + -e 's|LOCALSTATEDIR|\@localstatedir\@|g' \ + < $@-t1 > $@-t2 && \ + rm -f $@-t1 && \ + mv $@-t2 $@ %.1: %.1.in $(top_srcdir)/configure.ac $(AM_V_GEN)sed \ -- 2.5.5

No need to special-case this one: we can add it to EXTRA_DIST so that it will be shipped in any case, and if WITH_LOGIN_SHELL happens to be enabled we mark it for installation as well. --- tools/Makefile.am | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/Makefile.am b/tools/Makefile.am index 254e667..bda3622 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -62,6 +62,7 @@ EXTRA_DIST = \ virt-pki-validate.in \ virt-sanlock-cleanup.in \ libvirt-guests.sysconf \ + virt-login-shell.conf \ virsh-edit.c \ virsh-domain.c \ virsh-domain-monitor.c \ @@ -101,10 +102,7 @@ if WITH_LOGIN_SHELL conf_DATA += virt-login-shell.conf bin_PROGRAMS += virt-login-shell man1_MANS += virt-login-shell.1 -else ! WITH_LOGIN_SHELL -EXTRA_DIST += \ - virt-login-shell.conf -endif ! WITH_LOGIN_SHELL +endif WITH_LOGIN_SHELL if WITH_HOST_VALIDATE bin_PROGRAMS += virt-host-validate -- 2.5.5

podchecker(1) complained about these, eg. *** WARNING: Verbatim paragraph in NAME section at line 3 in file tools/virt-host-validate.pod --- tools/virt-host-validate.pod | 2 +- tools/virt-pki-validate.pod | 2 +- tools/virt-sanlock-cleanup.pod | 2 +- tools/virt-xml-validate.pod | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/virt-host-validate.pod b/tools/virt-host-validate.pod index 51edf2d..d5503a0 100644 --- a/tools/virt-host-validate.pod +++ b/tools/virt-host-validate.pod @@ -1,6 +1,6 @@ =head1 NAME - virt-host-validate - validate host virtualization setup +virt-host-validate - validate host virtualization setup =head1 SYNOPSIS diff --git a/tools/virt-pki-validate.pod b/tools/virt-pki-validate.pod index b216f56..b208454 100644 --- a/tools/virt-pki-validate.pod +++ b/tools/virt-pki-validate.pod @@ -1,6 +1,6 @@ =head1 NAME - virt-pki-validate - validate libvirt PKI files are configured correctly +virt-pki-validate - validate libvirt PKI files are configured correctly =head1 SYNOPSIS diff --git a/tools/virt-sanlock-cleanup.pod b/tools/virt-sanlock-cleanup.pod index 69a2b5d..232093f 100644 --- a/tools/virt-sanlock-cleanup.pod +++ b/tools/virt-sanlock-cleanup.pod @@ -1,6 +1,6 @@ =head1 NAME - virt-sanlock-cleanup - remove stale sanlock resource lease files +virt-sanlock-cleanup - remove stale sanlock resource lease files =head1 SYNOPSIS diff --git a/tools/virt-xml-validate.pod b/tools/virt-xml-validate.pod index 1df5a93..75f697b 100644 --- a/tools/virt-xml-validate.pod +++ b/tools/virt-xml-validate.pod @@ -1,6 +1,6 @@ =head1 NAME - virt-xml-validate - validate libvirt XML files against a schema +virt-xml-validate - validate libvirt XML files against a schema =head1 SYNOPSIS -- 2.5.5

Format the text properly. --- daemon/libvirtd.pod | 4 +--- src/locking/virtlockd.pod | 4 +--- src/logging/virtlogd.pod | 4 +--- tools/virt-host-validate.pod | 2 +- tools/virt-pki-validate.pod | 2 +- tools/virt-sanlock-cleanup.pod | 2 +- tools/virt-xml-validate.pod | 5 +++-- 7 files changed, 9 insertions(+), 14 deletions(-) diff --git a/daemon/libvirtd.pod b/daemon/libvirtd.pod index 9901ecf..3b819a2 100644 --- a/daemon/libvirtd.pod +++ b/daemon/libvirtd.pod @@ -4,9 +4,7 @@ libvirtd - libvirtd management daemon =head1 SYNOPSIS -B<libvirtd> [ -dlv ] [ -f config_file ] [ -p pid_file ] [ -t timeout_seconds ] - -B<libvirtd> --version +B<libvirtd> [I<OPTION>]... =head1 DESCRIPTION diff --git a/src/locking/virtlockd.pod b/src/locking/virtlockd.pod index 661473c..a3bb268 100644 --- a/src/locking/virtlockd.pod +++ b/src/locking/virtlockd.pod @@ -4,9 +4,7 @@ virtlockd - libvirt lock management daemon =head1 SYNOPSIS -B<virtlockd> [ -dvV ] [ -t timeout] [ -f config_file ] [ -p pid_file ] - -B<virtlockd> --version +B<virtlockd> [I<OPTION>]... =head1 DESCRIPTION diff --git a/src/logging/virtlogd.pod b/src/logging/virtlogd.pod index ce57f95..7e55c9e 100644 --- a/src/logging/virtlogd.pod +++ b/src/logging/virtlogd.pod @@ -4,9 +4,7 @@ virtlogd - libvirt log management daemon =head1 SYNOPSIS -B<virtlogd> [ -dvV ] [-t timeout] [ -f config_file ] [ -p pid_file ] - -B<virtlogd> --version +B<virtlogd> [I<OPTION>]... =head1 DESCRIPTION diff --git a/tools/virt-host-validate.pod b/tools/virt-host-validate.pod index d5503a0..72f7e6b 100644 --- a/tools/virt-host-validate.pod +++ b/tools/virt-host-validate.pod @@ -4,7 +4,7 @@ virt-host-validate - validate host virtualization setup =head1 SYNOPSIS - virt-host-validate [OPTIONS...] [HV-TYPE] +B<virt-host-validate> [I<OPTIONS>...] [I<HV-TYPE>] =head1 DESCRIPTION diff --git a/tools/virt-pki-validate.pod b/tools/virt-pki-validate.pod index b208454..4568bff 100644 --- a/tools/virt-pki-validate.pod +++ b/tools/virt-pki-validate.pod @@ -4,7 +4,7 @@ virt-pki-validate - validate libvirt PKI files are configured correctly =head1 SYNOPSIS - virt-pki-validate [OPTION] +B<virt-pki-validate> [I<OPTION>] =head1 DESCRIPTION diff --git a/tools/virt-sanlock-cleanup.pod b/tools/virt-sanlock-cleanup.pod index 232093f..6e70f45 100644 --- a/tools/virt-sanlock-cleanup.pod +++ b/tools/virt-sanlock-cleanup.pod @@ -4,7 +4,7 @@ virt-sanlock-cleanup - remove stale sanlock resource lease files =head1 SYNOPSIS - virt-sanlock-cleanup +B<virt-sanlock-cleanup> =head1 DESCRIPTION diff --git a/tools/virt-xml-validate.pod b/tools/virt-xml-validate.pod index 75f697b..f6b4d70 100644 --- a/tools/virt-xml-validate.pod +++ b/tools/virt-xml-validate.pod @@ -4,8 +4,9 @@ virt-xml-validate - validate libvirt XML files against a schema =head1 SYNOPSIS - virt-xml-validate XML-FILE [SCHEMA-NAME] - virt-xml-validate OPTION +B<virt-xml-validate> I<XML-FILE> [I<SCHEMA-NAME>] + +B<virt-xml-validate> I<OPTION> =head1 DESCRIPTION -- 2.5.5

Use L<> instead of C<> for URLs and man pages. --- tools/virsh.pod | 6 ++++-- tools/virt-admin.pod | 6 ++++-- tools/virt-host-validate.pod | 5 +++-- tools/virt-login-shell.pod | 3 ++- tools/virt-pki-validate.pod | 5 +++-- tools/virt-sanlock-cleanup.pod | 5 +++-- tools/virt-xml-validate.pod | 5 +++-- 7 files changed, 22 insertions(+), 13 deletions(-) diff --git a/tools/virsh.pod b/tools/virsh.pod index d2cc5b2..0ad1936 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -4272,14 +4272,16 @@ Messages at level ERROR or above =back -For further information about debugging options consult C<http://libvirt.org/logging.html> +For further information about debugging options consult +L<http://libvirt.org/logging.html> =back =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>. +list L<http://libvirt.org/contact.html> or bug tracker +L<http://libvirt.org/bugs.html>. Alternatively report bugs to your software distributor / vendor. =head1 AUTHORS diff --git a/tools/virt-admin.pod b/tools/virt-admin.pod index f2b1012..9b1f69d 100644 --- a/tools/virt-admin.pod +++ b/tools/virt-admin.pod @@ -219,14 +219,16 @@ Messages at level ERROR or above =back -For further information about debugging options consult C<http://libvirt.org/logging.html> +For further information about debugging options consult +L<http://libvirt.org/logging.html> =back =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>. +list L<http://libvirt.org/contact.html> or bug tracker +L<http://libvirt.org/bugs.html>. Alternatively report bugs to your software distributor / vendor. =head1 AUTHORS diff --git a/tools/virt-host-validate.pod b/tools/virt-host-validate.pod index 72f7e6b..84917c8 100644 --- a/tools/virt-host-validate.pod +++ b/tools/virt-host-validate.pod @@ -46,7 +46,8 @@ 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>. +mailing list L<http://libvirt.org/contact.html> or bug tracker +L<http://libvirt.org/bugs.html>. Alternatively report bugs to your software distributor / vendor. =head1 COPYRIGHT @@ -62,6 +63,6 @@ PURPOSE =head1 SEE ALSO -C<virsh(1)>, C<virt-pki-validate>, C<virt-xml-validate> +L<virsh(1)>, L<virt-pki-validate(1)>, L<virt-xml-validate(1)> =cut diff --git a/tools/virt-login-shell.pod b/tools/virt-login-shell.pod index 56861f7..b9abf91 100644 --- a/tools/virt-login-shell.pod +++ b/tools/virt-login-shell.pod @@ -71,7 +71,8 @@ shell; for example, if libvirtd is not running. =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>. +list L<http://libvirt.org/contact.html> or bug tracker +L<http://libvirt.org/bugs.html>. Alternatively report bugs to your software distributor / vendor. =head1 AUTHORS diff --git a/tools/virt-pki-validate.pod b/tools/virt-pki-validate.pod index 4568bff..5f04318 100644 --- a/tools/virt-pki-validate.pod +++ b/tools/virt-pki-validate.pod @@ -39,7 +39,8 @@ 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>. +mailing list L<http://libvirt.org/contact.html> or bug tracker +L<http://libvirt.org/bugs.html>. Alternatively report bugs to your software distributor / vendor. =head1 COPYRIGHT @@ -55,6 +56,6 @@ PURPOSE =head1 SEE ALSO -C<virsh(1)>, online PKI setup instructions C<http://libvirt.org/remote.html> +L<virsh(1)>, online PKI setup instructions L<http://libvirt.org/remote.html> =cut diff --git a/tools/virt-sanlock-cleanup.pod b/tools/virt-sanlock-cleanup.pod index 6e70f45..f80a281 100644 --- a/tools/virt-sanlock-cleanup.pod +++ b/tools/virt-sanlock-cleanup.pod @@ -27,7 +27,8 @@ 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>. +mailing list L<http://libvirt.org/contact.html> or bug tracker +L<http://libvirt.org/bugs.html>. Alternatively report bugs to your software distributor / vendor. =head1 COPYRIGHT @@ -43,6 +44,6 @@ PURPOSE =head1 SEE ALSO -C<virsh(1)>, online instructions C<http://libvirt.org/locking.html> +L<virsh(1)>, online instructions L<http://libvirt.org/locking.html> =cut diff --git a/tools/virt-xml-validate.pod b/tools/virt-xml-validate.pod index f6b4d70..0a5b7db 100644 --- a/tools/virt-xml-validate.pod +++ b/tools/virt-xml-validate.pod @@ -88,7 +88,8 @@ 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>. +mailing list L<http://libvirt.org/contact.html> or bug tracker +L<http://libvirt.org/bugs.html>. Alternatively report bugs to your software distributor / vendor. =head1 COPYRIGHT @@ -105,6 +106,6 @@ PURPOSE =head1 SEE ALSO -C<virsh(1)>, online XML format descriptions C<http://libvirt.org/format.html> +L<virsh(1)>, online XML format descriptions L<http://libvirt.org/format.html> =cut -- 2.5.5

On 04/14/2016 08:33 AM, Andrea Bolognani wrote:
There are a bunch of issues in the way we handle man pages; most importantly, installed man pages (like libvirtd.8) end up having stuff like
SYSCONFDIR/libvirtd.conf
in the FILES section.
This series makes it so all man pages are generated through the same steps:
1. process $command.pod (shipped) with pod2man(1) to convert pod markup to groff markup and obtain $command.$section.in (shipped)
2. process $command.$section.in with sed(1) to insert host-specific information such as @sysconfdir@ and obtain $command.$section (not shipped)
As a follow-up improvement, it would be great if we could abstract those two steps into macros to reduce code duplication even further. Please provide hints on the best way to achieve that :)
A number of other minor issues are fixed along the way.
Cheers.
Andrea Bolognani (13): build: Ship virt-admin.pod build: Extract pod from source files build: Build man pages in $(builddir) build: Perform post-processing on all man pages build: Standardize on .pod -> .x.in -> .x build: Never ship man pages build: Group files build: Ensure intermediate files are cleaned up properly build: Replace variables in man pages build: Always ship virt-login-shell.conf man: Fix NAME section man: Fix SYNOPSIS section man: Fix links
daemon/Makefile.am | 43 +++++---- daemon/{libvirtd.pod.in => libvirtd.pod} | 4 +- src/Makefile.am | 69 ++++++++------ src/locking/{virtlockd.pod.in => virtlockd.pod} | 4 +- src/logging/{virtlogd.pod.in => virtlogd.pod} | 4 +- tools/Makefile.am | 114 +++++++++++++++--------- tools/virsh.pod | 6 +- tools/virt-admin.pod | 6 +- tools/virt-host-validate.c | 74 --------------- tools/virt-host-validate.pod | 68 ++++++++++++++ tools/virt-login-shell.pod | 3 +- tools/virt-pki-validate.in | 64 ------------- tools/virt-pki-validate.pod | 61 +++++++++++++ tools/virt-sanlock-cleanup.in | 52 ----------- tools/virt-sanlock-cleanup.pod | 49 ++++++++++ tools/virt-xml-validate.in | 113 ----------------------- tools/virt-xml-validate.pod | 111 +++++++++++++++++++++++ 17 files changed, 440 insertions(+), 405 deletions(-) rename daemon/{libvirtd.pod.in => libvirtd.pod} (97%) rename src/locking/{virtlockd.pod.in => virtlockd.pod} (97%) rename src/logging/{virtlogd.pod.in => virtlogd.pod} (97%) 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
Changes seem reasonable to me (although not exactly my specialty). Should I assume you ran make dist or distcheck to ensure everything gets to the right place? I'm missing some things so those don't work for me any more (first error for me was "recipe for target 'libvirt-daemon-arch.png' failed" - I didn't bother to dig). ACK John

On Fri, 2016-04-22 at 15:22 -0400, John Ferlan wrote:
Andrea Bolognani (13): build: Ship virt-admin.pod build: Extract pod from source files build: Build man pages in $(builddir) build: Perform post-processing on all man pages build: Standardize on .pod -> .x.in -> .x build: Never ship man pages build: Group files build: Ensure intermediate files are cleaned up properly build: Replace variables in man pages build: Always ship virt-login-shell.conf man: Fix NAME section man: Fix SYNOPSIS section man: Fix links daemon/Makefile.am | 43 +++++---- daemon/{libvirtd.pod.in => libvirtd.pod} | 4 +- src/Makefile.am | 69 ++++++++------ src/locking/{virtlockd.pod.in => virtlockd.pod} | 4 +- src/logging/{virtlogd.pod.in => virtlogd.pod} | 4 +- tools/Makefile.am | 114 +++++++++++++++--------- tools/virsh.pod | 6 +- tools/virt-admin.pod | 6 +- tools/virt-host-validate.c | 74 --------------- tools/virt-host-validate.pod | 68 ++++++++++++++ tools/virt-login-shell.pod | 3 +- tools/virt-pki-validate.in | 64 ------------- tools/virt-pki-validate.pod | 61 +++++++++++++ tools/virt-sanlock-cleanup.in | 52 ----------- tools/virt-sanlock-cleanup.pod | 49 ++++++++++ tools/virt-xml-validate.in | 113 ----------------------- tools/virt-xml-validate.pod | 111 +++++++++++++++++++++++ 17 files changed, 440 insertions(+), 405 deletions(-) rename daemon/{libvirtd.pod.in => libvirtd.pod} (97%) rename src/locking/{virtlockd.pod.in => virtlockd.pod} (97%) rename src/logging/{virtlogd.pod.in => virtlogd.pod} (97%) 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 Changes seem reasonable to me (although not exactly my specialty). Should I assume you ran make dist or distcheck to ensure everything gets to the right place?
On several distributions... If anything weird pops up we can just fix it after the fact.
I'm missing some things so those don't work for me any more (first error for me was "recipe for target 'libvirt-daemon-arch.png' failed" - I didn't bother to dig).
Looks like those .png files are created from .fig files using convert(1)... Do you have ImageMagick installed on your host?
ACK
I've now pushed the series. Thanks for your review :) -- Andrea Bolognani Software Engineer - Virtualization Team

Changes seem reasonable to me (although not exactly my specialty). Should I assume you ran make dist or distcheck to ensure everything gets to the right place?
On several distributions... If anything weird pops up we can just fix it after the fact.
I'm missing some things so those don't work for me any more (first error for me was "recipe for target 'libvirt-daemon-arch.png' failed" - I didn't bother to dig).
Looks like those .png files are created from .fig files using convert(1)... Do you have ImageMagick installed on your host?
seems so: # dnf list installed ImageMagick Last metadata expiration check: 1:30:56 ago on Mon Apr 25 08:47:34 2016. Installed Packages ImageMagick.x86_64 # I'm not too worried about it though - some day when I have the need I'll chase it down - not on my have to do list though! John
participants (2)
-
Andrea Bolognani
-
John Ferlan