[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Nbd] [patch] manpages generation fixes



Hi all.

I decided to share a set of patches to fix the generation of manpages.

It fixes build failure with this message:.
----8<-----------
nbd-server.5.in.sgml:1: parser error : StartTag: invalid element name
<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
 ^
nbd-server.5.in.sgml:1: parser error : Extra content at the end of the document
<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
 ^
unable to parse nbd-server.5.in.sgml
----8<-----------

... and optionally simplifies generation routine.

Please review and apply, if you consider it usefull.
>From 4e49aa19b74d3b492f488e0d7c6229b21926fb6f Mon Sep 17 00:00:00 2001
From: Alex 'AdUser' Z <ad_user@...1007...>
Date: Wed, 21 Dec 2011 12:04:14 +1100
Subject: [PATCH 1/2] = fixed builds of man pages

---
 man/nbd-client.8.in.sgml |   12 +++++++-----
 man/nbd-server.1.in.sgml |    8 +++++---
 man/nbd-server.5.in.sgml |    4 +++-
 man/nbd-trdump.1.in.sgml |    4 +++-
 4 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/man/nbd-client.8.in.sgml b/man/nbd-client.8.in.sgml
index 81e003e..f0eb27e 100644
--- a/man/nbd-client.8.in.sgml
+++ b/man/nbd-client.8.in.sgml
@@ -1,4 +1,6 @@
-<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.5//EN" [
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.5//EN"
+                          "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd";
+[
 
 <!-- Process this file with docbook-to-man to generate an nroff manual
      page: `docbook-to-man manpage.sgml > manpage.1'.  You may view
@@ -55,9 +57,9 @@ manpage.1: manpage.sgml
   <refsynopsisdiv>
     <cmdsynopsis>
       <command>&dhpackage;</command>
-      <arg choice=plain><replaceable>host</replaceable></arg>
+      <arg choice="plain"><replaceable>host</replaceable></arg>
       <arg><replaceable>port</replaceable></arg>
-      <arg choice=plain><replaceable>nbd-device</replaceable></arg>
+      <arg choice="plain"><replaceable>nbd-device</replaceable></arg>
       <arg>-sdp</arg>
       <arg>-swap</arg>
       <arg>-persist</arg>
@@ -68,7 +70,7 @@ manpage.1: manpage.sgml
     </cmdsynopsis>
     <cmdsynopsis>
       <command>&dhpackage;</command>
-      <arg choice=plain><option>-d <replaceable>nbd-device</replaceable></option></arg>
+      <arg choice="plain"><option>-d <replaceable>nbd-device</replaceable></option></arg>
     </cmdsynopsis>
     <cmdsynopsis>
       <command>&dhpackage;</command>
@@ -149,7 +151,7 @@ manpage.1: manpage.sgml
 	  connected.</para>
 	  <para>If the device is connected, &dhpackage; will exit
 	  with an exit state of 0 and print the PID of the &dhpackage;
-	  instance that connected it to stdout.
+	  instance that connected it to stdout.</para>
 	  <para>If the device is not
 	  connected or does not exist (for example because the nbd
 	  module was not loaded), &dhpackage; will exit with an exit
diff --git a/man/nbd-server.1.in.sgml b/man/nbd-server.1.in.sgml
index 7a5832e..d63d4e6 100644
--- a/man/nbd-server.1.in.sgml
+++ b/man/nbd-server.1.in.sgml
@@ -1,4 +1,6 @@
-<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.5//EN"
+                          "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd";
+[
 
 <!-- Process this file with docbook-to-man to generate an nroff manual
      page: `docbook-to-man manpage.sgml > manpage.1'.  You may view
@@ -57,8 +59,8 @@ manpage.1: manpage.sgml
     <cmdsynopsis>
       <command>&dhpackage; </command>
 
-      <arg choice=plain><replaceable>[ip@]port</replaceable</arg>
-      <arg choice=plain><replaceable>filename</replaceable></arg>
+      <arg choice="plain"><replaceable>[ip@]port</replaceable></arg>
+      <arg choice="plain"><replaceable>filename</replaceable></arg>
       <arg><replaceable>size</replaceable></arg>
       <arg><option>-r</option></arg>
       <arg><option>-m</option></arg>
diff --git a/man/nbd-server.5.in.sgml b/man/nbd-server.5.in.sgml
index 48ea89b..6a70cd8 100644
--- a/man/nbd-server.5.in.sgml
+++ b/man/nbd-server.5.in.sgml
@@ -1,4 +1,6 @@
-<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.5//EN"
+                          "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd";
+[
 
 <!-- Process this file with docbook-to-man to generate an nroff manual
      page: `docbook-to-man manpage.sgml > manpage.1'.  You may view
diff --git a/man/nbd-trdump.1.in.sgml b/man/nbd-trdump.1.in.sgml
index 4e58617..a2f5846 100644
--- a/man/nbd-trdump.1.in.sgml
+++ b/man/nbd-trdump.1.in.sgml
@@ -1,4 +1,6 @@
-<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.5//EN" [
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.5//EN"
+                          "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd";
+[
 
 <!-- Process this file with docbook-to-man to generate an nroff manual
      page: `docbook-to-man manpage.sgml > manpage.1'.  You may view
-- 
1.7.7

>From db6c036716528e539ecc31ef1cffb912683cf7ab Mon Sep 17 00:00:00 2001
From: Alex 'AdUser' Z <ad_user@...1007...>
Date: Wed, 21 Dec 2011 15:10:32 +1100
Subject: [PATCH 2/2] * simplified manpage generation

---
 autogen.sh      |    2 +-
 configure.ac    |    2 +-
 man/Makefile.am |   43 ++++++++++---------------------------------
 man/sh.tmpl     |    7 -------
 4 files changed, 12 insertions(+), 42 deletions(-)
 delete mode 100644 man/sh.tmpl

diff --git a/autogen.sh b/autogen.sh
index a8fbf14..8d2348d 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,4 +1,4 @@
 #!/bin/sh
 set -ex
-make -C man -f Makefile.am nbd-server.1.sh.in nbd-server.5.sh.in nbd-client.8.sh.in nbd-trdump.1.sh.in
+make -C man -f Makefile.am
 exec autoreconf -f -i
diff --git a/configure.ac b/configure.ac
index e085ce0..985db53 100644
--- a/configure.ac
+++ b/configure.ac
@@ -140,6 +140,6 @@ AC_TYPE_PID_T
 nbd_server_CPPFLAGS=$nbd_server_CPPFLAGS" -DSYSCONFDIR='\"$sysconfdir\"'"
 AC_SUBST(nbd_server_CPPFLAGS)
 AC_CONFIG_HEADERS([config.h])
-AC_CONFIG_FILES([Makefile doc/Doxyfile man/Makefile man/nbd-client.8.sh man/nbd-server.5.sh man/nbd-server.1.sh man/nbd-trdump.1.sh])
+AC_CONFIG_FILES([Makefile doc/Doxyfile man/Makefile])
 AC_OUTPUT
 
diff --git a/man/Makefile.am b/man/Makefile.am
index 10d244f..44c71fb 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -1,38 +1,15 @@
 man_MANS = nbd-server.1 nbd-server.5 nbd-client.8 nbd-trdump.1
 CLEANFILES = manpage.links manpage.refs
 DISTCLEANFILES = nbd-server.1 nbd-client.8 nbd-server.5 nbd-trdump.1
-MAINTAINERCLEANFILES = nbd-server.1.sh.in nbd-client.8.sh.in nbd-server.5.sh.in nbd-trdump.1.sh.in
 EXTRA_DIST = nbd-server.1.in.sgml nbd-client.8.in.sgml nbd-server.5.in.sgml nbd-trdump.1.in.sgml nbd-server.1.sh.in nbd-server.5.sh.in nbd-client.8.sh.in nbd-trdump.1.sh.in sh.tmpl
 
-nbd-server.1: nbd-server.1.sh
-	sh nbd-server.1.sh > nbd-server.1
-nbd-server.5: nbd-server.5.sh
-	sh nbd-server.5.sh > nbd-server.5
-nbd-client.8: nbd-client.8.sh
-	sh nbd-client.8.sh > nbd-client.8
-nbd-trdump.1: nbd-trdump.1.sh
-	sh nbd-trdump.1.sh > nbd-trdump.1
-nbd-server.1.sh.in: nbd-server.1.in.sgml sh.tmpl
-	LC_ALL=C docbook2man nbd-server.1.in.sgml
-	cat sh.tmpl > nbd-server.1.sh.in
-	cat NBD-SERVER.1 >> nbd-server.1.sh.in
-	echo "EOF" >> nbd-server.1.sh.in
-	rm NBD-SERVER.1
-nbd-client.8.sh.in: nbd-client.8.in.sgml sh.tmpl
-	LC_ALL=C docbook2man nbd-client.8.in.sgml
-	cat sh.tmpl > nbd-client.8.sh.in
-	cat NBD-CLIENT.8 >> nbd-client.8.sh.in
-	echo "EOF" >> nbd-client.8.sh.in
-	rm NBD-CLIENT.8
-nbd-server.5.sh.in: nbd-server.5.in.sgml sh.tmpl
-	LC_ALL=C docbook2man nbd-server.5.in.sgml
-	cat sh.tmpl > nbd-server.5.sh.in
-	cat NBD-SERVER.5 >> nbd-server.5.sh.in
-	echo "EOF" >> nbd-server.5.sh.in
-	rm NBD-SERVER.5
-nbd-trdump.1.sh.in: nbd-trdump.1.in.sgml sh.tmpl
-	LC_ALL=C docbook2man nbd-trdump.1.in.sgml
-	cat sh.tmpl > nbd-trdump.1.sh.in
-	cat NBD-TRDUMP.1 >> nbd-trdump.1.sh.in
-	echo "EOF" >> nbd-trdump.1.sh.in
-	rm NBD-TRDUMP.1
+all: nbd-server.1 nbd-server.5 nbd-client.8 nbd-trdump.1
+
+clean:
+	rm -rf nbd-*.[0-9]
+
+%: %.in.sgml
+	LC_ALL=C docbook2man $< --to-stdout > $@
+	sed -i -e 's|$$sysconfdir|$(sysconfdir)|g' $@
+
+# vim: noet:ts=4
diff --git a/man/sh.tmpl b/man/sh.tmpl
deleted file mode 100644
index d97aa3f..0000000
--- a/man/sh.tmpl
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-sysconfdir=@sysconfdir@
-
-cat <<EOF
-- 
1.7.7


Reply to: