capitests/tests
capitests/tests.c
capitests/test*.tmp
+cat/stamp-virt-*.pod
cat/virt-cat
cat/virt-cat.1
cat/virt-cat.static
fish/prepopts.h
fish/rc_protocol.c
fish/rc_protocol.h
+fish/stamp-guestfish.pod
fuse/guestmount
fuse/guestmount.1
fuse/guestmount.static
+fuse/stamp-guestmount.pod
generator/.pod2text.data
generator/generator
generator/stamp-generator
images/windows.img
initramfs
initramfs.timestamp
+inspector/stamp-virt-inspector.pod
inspector/virt-inspector
inspector/virt-inspector.1
inspector/virt-inspector.static
po-docs/*/*.pod
po-docs/*/*.1
po-docs/*/*.3
+podwrapper.sh
python/bindtests.py
python/guestfs.py
python/guestfs-py.c
src/guestfs_protocol.x
src/.libs/libguestfs.so
src/libguestfs.syms
+src/stamp-guestfs.pod
*.swp
stamp-h1
test1.img
.gitignore \
m4/.gitignore
-# HTML versions of manual pages.
-
-noinst_DATA = html/guestfs.3.html html/guestfish.1.html
-
-html/guestfs.3.html: src/guestfs.pod \
- src/guestfs-actions.pod \
- src/guestfs-availability.pod \
- src/guestfs-structs.pod
- mkdir -p html
- sed \
- -e '/@ACTIONS@/rsrc/guestfs-actions.pod' \
- -e 's/@ACTIONS@//' \
- -e '/@AVAILABILITY@/rsrc/guestfs-availability.pod' \
- -e 's/@AVAILABILITY@//' \
- -e '/@STRUCTS@/rsrc/guestfs-structs.pod' \
- -e 's/@STRUCTS@//' \
- < $< | \
- pod2html \
- --css 'pod.css' \
- --title "libguestfs API documentation" \
- --htmldir html \
- --outfile $@
-
-html/guestfish.1.html: fish/guestfish.pod fish/guestfish-actions.pod fish/guestfish-commands.pod
- mkdir -p html
- sed \
- -e '/@ACTIONS@/rfish/guestfish-actions.pod' -e 's/@ACTIONS@//' \
- -e '/@FISH_COMMANDS@/rfish/guestfish-commands.pod' -e 's/@FISH_COMMANDS@//' \
- < $< | \
- pod2html \
- --css 'pod.css' \
- --title "guestfish, libguestfs filesystem interactive shell" \
- --htmldir html \
- --outfile $@
-
# Recipes web page.
html/recipes.html: $(wildcard recipes/*.sh) $(wildcard recipes/*.html) $(wildcard recipes/*.example) Makefile make-recipes.sh
mkdir -p html
- (Optional) FUSE to build the FUSE module
-- perldoc (pod2man, pod2text) to generate the manual pages and
- other documentation.
+- perldoc (pod2man, pod2text, pod2html) to generate the manual pages
+ and other documentation.
- (Optional) Readline to have nicer command-line editing in guestfish.
test-virt-ls.sh \
virt-ls.pod
+CLEANFILES = stamp-virt-cat.pod stamp-virt-ls.pod stamp-virt-filesystems.pod
+
bin_PROGRAMS = virt-cat virt-filesystems virt-ls
SHARED_SOURCE_FILES = \
$(top_builddir)/html/virt-filesystems.1.html \
$(top_builddir)/html/virt-ls.1.html
-virt-cat.1: virt-cat.pod
- $(POD2MAN) \
- --section 1 \
- -c "Virtualization Support" \
- --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
- $< > $@-t && mv $@-t $@
-
-$(top_builddir)/html/virt-cat.1.html: virt-cat.pod
- mkdir -p $(top_builddir)/html
- cd $(top_builddir) && pod2html \
- --css 'pod.css' \
- --htmldir html \
- --outfile html/$@ \
- $(abs_srcdir)/$<
-
-virt-filesystems.1: virt-filesystems.pod
- $(POD2MAN) \
- --section 1 \
- -c "Virtualization Support" \
- --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
- $< > $@-t && mv $@-t $@
-
-$(top_builddir)/html/virt-filesystems.1.html: virt-filesystems.pod
- mkdir -p $(top_builddir)/html
- cd $(top_builddir) && pod2html \
- --css 'pod.css' \
- --htmldir html \
- --outfile html/$@ \
- $(abs_srcdir)/$<
-
-virt-ls.1: virt-ls.pod
- $(POD2MAN) \
- --section 1 \
- -c "Virtualization Support" \
- --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
- $< > $@-t && mv $@-t $@
-
-$(top_builddir)/html/virt-ls.1.html: virt-ls.pod
- mkdir -p $(top_builddir)/html
- cd $(top_builddir) && pod2html \
- --css 'pod.css' \
- --htmldir html \
- --outfile html/$@ \
- $(abs_srcdir)/$<
+virt-cat.1 $(top_builddir)/html/virt-cat.1.html: stamp-virt-cat.pod
+
+stamp-virt-cat.pod: virt-cat.pod
+ $(top_srcdir)/podwrapper.sh \
+ --man virt-cat.1 \
+ --html $(top_builddir)/html/virt-cat.1.html \
+ $<
+ touch $@
+
+virt-ls.1 $(top_builddir)/html/virt-ls.1.html: stamp-virt-ls.pod
+
+stamp-virt-ls.pod: virt-ls.pod
+ $(top_srcdir)/podwrapper.sh \
+ --man virt-ls.1 \
+ --html $(top_builddir)/html/virt-ls.1.html \
+ $<
+ touch $@
+
+virt-filesystems.1 $(top_builddir)/html/virt-filesystems.1.html: stamp-virt-filesystems.pod
+
+stamp-virt-filesystems.pod: virt-filesystems.pod
+ $(top_srcdir)/podwrapper.sh \
+ --man virt-filesystems.1 \
+ --html $(top_builddir)/html/virt-filesystems.1.html \
+ $<
+ touch $@
# Tests.
test "x$GPERF" = "xno" &&
AC_MSG_ERROR([gperf must be installed])
-dnl Check for pod2man and pod2text.
+dnl Check for pod2man, pod2text, pod2html.
AC_CHECK_PROG([POD2MAN],[pod2man],[pod2man],[no])
test "x$POD2MAN" = "xno" &&
AC_MSG_ERROR([pod2man must be installed])
AC_CHECK_PROG([POD2TEXT],[pod2text],[pod2text],[no])
test "x$POD2TEXT" = "xno" &&
AC_MSG_ERROR([pod2text must be installed])
+AC_CHECK_PROG([POD2HTML],[pod2html],[pod2html],[no])
+test "x$POD2HTML" = "xno" &&
+ AC_MSG_ERROR([pod2html must be installed])
dnl Check for mkisofs.
AC_PATH_PROGS([MKISOFS],[mkisofs],[no],
dnl http://www.mail-archive.com/automake@gnu.org/msg10204.html
AC_CONFIG_FILES([appliance/update.sh],
[chmod +x appliance/update.sh])
+AC_CONFIG_FILES([podwrapper.sh],
+ [chmod +x podwrapper.sh])
AC_CONFIG_FILES([Makefile
generator/Makefile
src/Makefile fish/Makefile po/Makefile.in examples/Makefile
include $(top_srcdir)/subdir-rules.mk
+CLEANFILES = stamp-guestfish.pod
+
bin_PROGRAMS = guestfish
generator_built = \
$(guestfish_LINK) $(guestfish_OBJECTS) -static $(guestfish_LDADD) $(guestfish_LIBS) $(LIBVIRT_LIBS) $(LIBXML2_LIBS) -ltinfo -lpcre -lhivex -lmagic -lz -lm
# Manual page.
-# guestfish-actions.pod and guestfish-commands.pod are autogenerated.
-# There is no include mechanism for POD, so we have to do it by hand.
man_MANS = guestfish.1
-
-guestfish.1: guestfish.pod guestfish-actions.pod guestfish-commands.pod
- sed \
- -e '/@ACTIONS@/rguestfish-actions.pod' -e 's/@ACTIONS@//' \
- -e '/@FISH_COMMANDS@/rguestfish-commands.pod' -e 's/@FISH_COMMANDS@//' \
- < $< | \
- $(POD2MAN) \
- --section 1 \
- -c "Virtualization Support" \
- --name "guestfish" \
- --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
- > $@
+noinst_DATA = $(top_builddir)/html/guestfish.1.html
+
+guestfish.1 $(top_builddir)/html/guestfish.1.html: stamp-guestfish.pod
+
+stamp-guestfish.pod: guestfish.pod guestfish-actions.pod guestfish-commands.pod
+ $(top_srcdir)/podwrapper.sh \
+ --man guestfish.1 \
+ --html $(top_builddir)/html/guestfish.1.html \
+ --insert guestfish-actions.pod:@ACTIONS@ \
+ --insert guestfish-commands.pod:@FISH_COMMANDS@ \
+ $<
+ touch $@
# Bash completion script.
EXTRA_DIST = guestmount.pod test-fuse.sh
+CLEANFILES = stamp-guestmount.pod
+
if HAVE_FUSE
bin_PROGRAMS = guestmount
# Documentation.
man_MANS = guestmount.1
+noinst_DATA = $(top_builddir)/html/guestmount.1.html
+
+guestmount.1 $(top_builddir)/html/guestmount.1.html: stamp-guestmount.pod
-guestmount.1: guestmount.pod
- $(POD2MAN) \
- --section 1 \
- -c "Virtualization Support" \
- --name "guestmount" \
- --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
- $< > $@-t; mv $@-t $@
-
-noinst_DATA = \
- $(top_builddir)/html/guestmount.1.html
-
-$(top_builddir)/html/guestmount.1.html: guestmount.pod
- mkdir -p $(top_builddir)/html
- cd $(top_builddir) && pod2html \
- --css 'pod.css' \
- --htmldir html \
- --outfile html/guestmount.1.html \
- fuse/guestmount.pod
+stamp-guestmount.pod: guestmount.pod
+ $(top_srcdir)/podwrapper.sh \
+ --man guestmount.1 \
+ --html $(top_builddir)/html/guestmount.1.html \
+ $<
+ touch $@
# Tests.
run-inspector-locally \
virt-inspector.pod
+CLEANFILES = stamp-virt-inspector.pod
+
docdir = @docdir@
dist_doc_DATA = \
virt-inspector.rng \
# Manual pages and HTML files for the website.
man_MANS = virt-inspector.1
+noinst_DATA = $(top_builddir)/html/virt-inspector.1.html
+
+virt-inspector.1 $(top_builddir)/html/virt-inspector.1.html: stamp-virt-inspector.pod
-noinst_DATA = \
- $(top_builddir)/html/virt-inspector.1.html
-
-virt-inspector.1: virt-inspector.pod
- $(POD2MAN) \
- --section 1 \
- -c "Virtualization Support" \
- --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
- $< > $@-t && mv $@-t $@
-
-$(top_builddir)/html/virt-inspector.1.html: virt-inspector.pod
- mkdir -p $(top_builddir)/html
- cd $(top_builddir) && pod2html \
- --css 'pod.css' \
- --title 'virt-inspector, display OS version, kernel, drivers, mount points, applications, etc. in a virtual machine' \
- --htmldir html \
- --outfile html/virt-inspector.1.html \
- inspector/$<
+stamp-virt-inspector.pod: virt-inspector.pod
+ $(top_srcdir)/podwrapper.sh \
+ --man virt-inspector.1 \
+ --html $(top_builddir)/html/virt-inspector.1.html \
+ $<
+ touch $@
if HAVE_XMLLINT
all-local: $(MANPAGES)
guestfs.3: guestfs.pod guestfs-actions.pod guestfs-availability.pod guestfs-structs.pod
- sed \
- -e '/@ACTIONS@/rguestfs-actions.pod' \
- -e 's/@ACTIONS@//' \
- -e '/@AVAILABILITY@/rguestfs-availability.pod' \
- -e 's/@AVAILABILITY@//' \
- -e '/@STRUCTS@/rguestfs-structs.pod' \
- -e 's/@STRUCTS@//' \
- < $< | \
- $(POD2MAN) -u \
+ $(top_srcdir)/podwrapper.sh \
--section 3 \
- -c "Virtualization Support" \
- --name "guestfs" \
- --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
- > $@-t; mv $@-t $@
+ --man $@ \
+ --insert guestfs-actions.pod:@ACTIONS@ \
+ --insert guestfs-availability.pod:@AVAILABILITY@ \
+ --insert guestfs-structs.pod:@STRUCTS@ \
+ $<
guestfish.1: guestfish.pod guestfish-actions.pod guestfish-commands.pod
- sed \
- -e '/@ACTIONS@/rguestfish-actions.pod' -e 's/@ACTIONS@//' \
- -e '/@FISH_COMMANDS@/rguestfish-commands.pod' -e 's/@FISH_COMMANDS@//' \
- < $< | \
- $(POD2MAN) -u \
- --section 1 \
- -c "Virtualization Support" \
- --name "guestfish" \
- --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
- > $@-t; mv $@-t $@
+ $(top_srcdir)/podwrapper.sh \
+ --man $@ \
+ --insert guestfish-actions.pod:@ACTIONS@ \
+ --insert guestfish-commands.pod:@FISH_COMMANDS@ \
+ $<
guestmount.1: guestmount.pod
- $(POD2MAN) -u \
- --section 1 \
- -c "Virtualization Support" \
- --name "guestmount" \
- --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
- $< > $@-t; mv $@-t $@
+ $(top_srcdir)/podwrapper.sh \
+ --man $@ \
+ $<
libguestfs-test-tool.1: libguestfs-test-tool.pod
- $(POD2MAN) -u \
- --section 1 \
- -c "Virtualization Support" \
- --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
- $< > $@-t; mv $@-t $@
+ $(top_srcdir)/podwrapper.sh \
+ --man $@ \
+ $<
virt-%.1: virt-%.pl
- $(POD2MAN) -u \
- --section 1 \
- -c "Virtualization Support" \
- --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
- $< > $@-t && mv $@-t $@
+ $(top_srcdir)/podwrapper.sh \
+ --man $@ \
+ $<
else
--- /dev/null
+#!/bin/bash -
+# podwrapper.sh
+# Copyright (C) 2010 Red Hat Inc.
+# @configure_input@
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# Wrapper script around POD utilities which can include files in the
+# POD and controls HTML generation.
+
+unset CDPATH
+
+set -e
+#set -x
+
+PACKAGE_NAME="@PACKAGE_NAME@"
+PACKAGE_VERSION="@PACKAGE_VERSION@"
+POD2MAN="@POD2MAN@"
+POD2TEXT="@POD2TEXT@"
+POD2HTML="@POD2HTML@"
+
+declare -a inserts
+declare -a pattern
+declare -a indent
+nr_inserts=0
+
+TEMP=`getopt \
+ -o '' \
+ --long section:,name:,man:,text:,html:,insert:,verbatim: \
+ -n podwrapper.sh -- "$@"`
+if [ $? != 0 ]; then
+ echo "podwrapper.sh: problem parsing the command line arguments"
+ exit 1
+fi
+eval set -- "$TEMP"
+
+while true; do
+ case "$1" in
+ --section)
+ section="$2"
+ shift 2;;
+ --name)
+ name="$2"
+ shift 2;;
+ --man)
+ [ -z "$man_output" ] || {
+ echo "podwrapper.sh: --text option specified more than once"
+ exit 1
+ }
+ man_output="$2"
+ shift 2;;
+ --text)
+ [ -z "$text_output" ] || {
+ echo "podwrapper.sh: --text option specified more than once"
+ exit 1
+ }
+ text_output="$2"
+ shift 2;;
+ --html)
+ [ -z "$html_output" ] || {
+ echo "podwrapper.sh: --html option specified more than once"
+ exit 1
+ }
+ html_output="$2"
+ shift 2;;
+ --insert)
+ inserts[$nr_inserts]=`echo "$2" | awk -F: '{print $1}'`
+ pattern[$nr_inserts]=`echo "$2" | awk -F: '{print $2}'`
+ indent[$nr_inserts]=no
+ ((++nr_inserts))
+ shift 2;;
+ --verbatim)
+ inserts[$nr_inserts]=`echo "$2" | awk -F: '{print $1}'`
+ pattern[$nr_inserts]=`echo "$2" | awk -F: '{print $2}'`
+ indent[$nr_inserts]=yes
+ ((++nr_inserts))
+ shift 2;;
+ --)
+ shift; break;;
+ *)
+ echo "podwrapper.sh: internal error in option parsing"
+ exit 1;;
+ esac
+done
+
+# The remaining argument is the input POD file.
+if [ $# -ne 1 ]; then
+ echo "podwrapper.sh [--options] input.pod"
+ exit 1
+fi
+input="$1"
+
+#echo "input=$input"
+#echo "man_output=$man_output"
+#echo "text_output=$text_output"
+#echo "html_output=$html_output"
+#for i in `seq 0 $(($nr_inserts-1))`; do
+# echo "insert $i: ${inserts[$i]} (pattern: ${pattern[$i]} indent: ${indent[$i]})"
+#done
+
+# Should be at least one sort of output.
+[ -z "$man_output" -a -z "$text_output" -a -z "$html_output" ] && {
+ echo "podwrapper.sh: no output specified"
+ exit 1
+}
+
+# If name and section are not set, make some sensible defaults.
+[ -z "$section" ] && section=1
+[ -z "$name" ] && name=$(basename "$input" .pod)
+
+# Perform the insertions to produce a temporary POD file.
+tmpdir="$(mktemp -d)"
+trap "rm -rf $tmpdir; exit $?" EXIT
+
+if [ $nr_inserts -gt 0 ]; then
+ cmd="sed"
+
+ for i in `seq 0 $(($nr_inserts-1))`; do
+ if [ "${indent[$i]}" = "yes" ]; then
+ sed 's/^/ /' < "${inserts[$i]}" > $tmpdir/$i
+ else
+ cp "${inserts[$i]}" $tmpdir/$i
+ fi
+
+ cmd="$cmd -e /${pattern[$i]}/r$tmpdir/$i -e s/${pattern[$i]}//"
+ done
+
+ $cmd < "$input" > $tmpdir/full.pod
+else
+ cp "$input" $tmpdir/full.pod
+fi
+
+# Now generate the final output format(s).
+if [ -n "$man_output" ]; then
+ "$POD2MAN" --stderr -u \
+ --section "$section" -c "Virtualization Support" --name "$name" \
+ --release "$PACKAGE_NAME-$PACKAGE_VERSION" \
+ < $tmpdir/full.pod > "$man_output".tmp
+ mv "$man_output".tmp "$man_output"
+fi
+
+if [ -n "$text_output" ]; then
+ "$POD2TEXT" --stderr -u \
+ < $tmpdir/full.pod > "$text_output".tmp
+ mv "$text_output".tmp "$text_output"
+fi
+
+if [ -n "$html_output" ]; then
+ "$POD2HTML" \
+ --css "pod.css" --htmldir "$builddir/html" \
+ < $tmpdir/full.pod > "$html_output".tmp
+ mv "$html_output".tmp "$html_output"
+fi
include $(top_srcdir)/subdir-rules.mk
+CLEANFILES = stamp-guestfs.pod
+
generator_built = \
guestfs_protocol.x \
guestfs.h \
endif
# Manual page.
-# guestfs-actions.pod, guestfs-availability.pod and guestfs-structs.pod
-# are autogenerated. There is no include mechanism for POD, so we
-# have to do it by hand.
man_MANS = guestfs.3 libguestfs.3
+noinst_DATA = $(top_builddir)/html/guestfs.3.html
+
+guestfs.3 $(top_builddir)/html/guestfs.3.html: stamp-guestfs.pod
-guestfs.3: guestfs.pod \
+stamp-guestfs.pod: guestfs.pod \
guestfs-actions.pod \
guestfs-availability.pod \
guestfs-structs.pod
- sed \
- -e '/@ACTIONS@/rguestfs-actions.pod' \
- -e 's/@ACTIONS@//' \
- -e '/@AVAILABILITY@/rguestfs-availability.pod' \
- -e 's/@AVAILABILITY@//' \
- -e '/@STRUCTS@/rguestfs-structs.pod' \
- -e 's/@STRUCTS@//' \
- < $< | \
- $(POD2MAN) \
+ $(top_srcdir)/podwrapper.sh \
--section 3 \
- -c "Virtualization Support" \
- --name "guestfs" \
- --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
- > $@
+ --man guestfs.3 \
+ --html $(top_builddir)/html/guestfs.3.html \
+ --insert guestfs-actions.pod:@ACTIONS@ \
+ --insert guestfs-availability.pod:@AVAILABILITY@ \
+ --insert guestfs-structs.pod:@STRUCTS@ \
+ $<
+ touch $@
# Check user doesn't try to do 'make all' or 'make check' as root.
# https://www.redhat.com/archives/libguestfs/2010-April/msg00098.html
$(libguestfs_test_tool_LINK) $(libguestfs_test_tool_OBJECTS) -static $(libguestfs_test_tool_LDADD) $(libguestfs_test_tool_LIBS) $(LIBVIRT_LIBS) $(LIBXML2_LIBS) -lpcre -lhivex -lmagic -lz -lm
libguestfs-test-tool.1: libguestfs-test-tool.pod
- $(POD2MAN) \
- --section 1 \
- -c "Virtualization Support" \
- --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
- $< > $@
+ $(top_srcdir)/podwrapper.sh \
+ --man $@ \
+ $<
noinst_DATA = $(tools:%=$(top_builddir)/html/virt-%.1.html)
virt-%.1: virt-%
- $(POD2MAN) \
- --section 1 \
- -c "Virtualization Support" \
- --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
- $< > $@-t && mv $@-t $@
+ $(top_srcdir)/podwrapper.sh \
+ --man $@ \
+ $<
$(top_builddir)/html/virt-%.1.html: virt-%
- mkdir -p $(top_builddir)/html
- cd $(top_builddir) && pod2html \
- --css 'pod.css' \
- --htmldir html \
- --outfile html/$<.1.html \
- tools/$<
+ $(top_srcdir)/podwrapper.sh \
+ --html $@ \
+ $<
# Tests.