Certain platforms like xenserver do not have the latest
python libraries that are needed by ovsdb-doc (which in-turn
creates ovs-vswitchd.conf.db.5). When we run 'make dist' and
copy over the tar ball to xenserver ddk environemt, we
already include ovs-vswitchd.conf.db.5. But the absence of
ovsdb-doc results in an attempt to regenerate ovs-vswitchd.conf.db.5
and that fails because of the missing python libraries.
Instead of producing ovsdb-doc from ovsdb-doc.in dynamically, we
statically provide ovsdb-doc and pass on the version information
to it through the command line option --version.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
$(OVSIDL_BUILT): ovsdb/ovsdb-idlc.in
# ovsdb-doc
$(OVSIDL_BUILT): ovsdb/ovsdb-idlc.in
# ovsdb-doc
-EXTRA_DIST += ovsdb/ovsdb-doc.in
-noinst_SCRIPTS += ovsdb/ovsdb-doc
-DISTCLEANFILES += ovsdb/ovsdb-doc
-OVSDB_DOC = $(run_python) $(builddir)/ovsdb/ovsdb-doc
+EXTRA_DIST += ovsdb/ovsdb-doc
+OVSDB_DOC = $(run_python) $(srcdir)/ovsdb/ovsdb-doc
# ovsdb-dot
EXTRA_DIST += ovsdb/ovsdb-dot.in ovsdb/dot2pic
# ovsdb-dot
EXTRA_DIST += ovsdb/ovsdb-dot.in ovsdb/dot2pic
from datetime import date
import getopt
from datetime import date
import getopt
-def docsToNroff(schemaFile, xmlFile, erFile, title=None):
+def docsToNroff(schemaFile, xmlFile, erFile, title=None, version=None):
schema = ovs.db.schema.DbSchema.from_json(ovs.json.from_file(schemaFile))
doc = xml.dom.minidom.parse(xmlFile).documentElement
schema = ovs.db.schema.DbSchema.from_json(ovs.json.from_file(schemaFile))
doc = xml.dom.minidom.parse(xmlFile).documentElement
if title == None:
title = schema.name
if title == None:
title = schema.name
+ if version == None:
+ version = "UNKNOWN"
+
# Putting '\" p as the first line tells "man" that the manpage
# needs to be preprocessed by "pic".
s = r''''\" p
# Putting '\" p as the first line tells "man" that the manpage
# needs to be preprocessed by "pic".
s = r''''\" p
-.TH "%s" 5 @VERSION@ "Open vSwitch" "Open vSwitch Manual"
+.TH "%s" 5 "%s" "Open vSwitch" "Open vSwitch Manual"
.\" -*- nroff -*-
.de TQ
. br
.\" -*- nroff -*-
.de TQ
. br
.SH NAME
%s \- %s database schema
.PP
.SH NAME
%s \- %s database schema
.PP
-''' % (title, textToNroff(schema.name), schema.name)
+''' % (title, version, textToNroff(schema.name), schema.name)
tables = ""
introNodes = []
tables = ""
introNodes = []
The following options are also available:
--er-diagram=DIAGRAM.PIC include E-R diagram from DIAGRAM.PIC
--title=TITLE use TITLE as title instead of schema name
The following options are also available:
--er-diagram=DIAGRAM.PIC include E-R diagram from DIAGRAM.PIC
--title=TITLE use TITLE as title instead of schema name
- -h, --help display this help message
- -V, --version display version information\
+ --version=VERSION use VERSION to display on document footer
+ -h, --help display this help message\
""" % {'argv0': argv0}
sys.exit(0)
""" % {'argv0': argv0}
sys.exit(0)
try:
options, args = getopt.gnu_getopt(sys.argv[1:], 'hV',
['er-diagram=', 'title=',
try:
options, args = getopt.gnu_getopt(sys.argv[1:], 'hV',
['er-diagram=', 'title=',
except getopt.GetoptError, geo:
sys.stderr.write("%s: %s\n" % (argv0, geo.msg))
sys.exit(1)
er_diagram = None
title = None
except getopt.GetoptError, geo:
sys.stderr.write("%s: %s\n" % (argv0, geo.msg))
sys.exit(1)
er_diagram = None
title = None
for key, value in options:
if key == '--er-diagram':
er_diagram = value
elif key == '--title':
title = value
for key, value in options:
if key == '--er-diagram':
er_diagram = value
elif key == '--title':
title = value
+ elif key == '--version':
+ version = value
elif key in ['-h', '--help']:
usage()
elif key in ['-h', '--help']:
usage()
- elif key in ['-V', '--version']:
- print "ovsdb-doc (Open vSwitch) @VERSION@"
sys.exit(1)
# XXX we should warn about undocumented tables or columns
sys.exit(1)
# XXX we should warn about undocumented tables or columns
- s = docsToNroff(args[0], args[1], er_diagram, title)
+ s = docsToNroff(args[0], args[1], er_diagram, title, version)
for line in s.split("\n"):
line = line.strip()
if len(line):
for line in s.split("\n"):
line = line.strip()
if len(line):
# vswitch schema documentation
EXTRA_DIST += vswitchd/vswitch.xml
# vswitch schema documentation
EXTRA_DIST += vswitchd/vswitch.xml
+DISTCLEANFILES += $(srcdir)/vswitchd/ovs-vswitchd.conf.db.5
dist_man_MANS += vswitchd/ovs-vswitchd.conf.db.5
$(srcdir)/vswitchd/ovs-vswitchd.conf.db.5: \
ovsdb/ovsdb-doc vswitchd/vswitch.xml vswitchd/vswitch.ovsschema \
dist_man_MANS += vswitchd/ovs-vswitchd.conf.db.5
$(srcdir)/vswitchd/ovs-vswitchd.conf.db.5: \
ovsdb/ovsdb-doc vswitchd/vswitch.xml vswitchd/vswitch.ovsschema \
$(OVSDB_DOC) \
--title="ovs-vswitchd.conf.db" \
--er-diagram=$(srcdir)/vswitchd/vswitch.pic \
$(OVSDB_DOC) \
--title="ovs-vswitchd.conf.db" \
--er-diagram=$(srcdir)/vswitchd/vswitch.pic \
$(srcdir)/vswitchd/vswitch.ovsschema \
$(srcdir)/vswitchd/vswitch.xml > $@.tmp
mv $@.tmp $@
$(srcdir)/vswitchd/vswitch.ovsschema \
$(srcdir)/vswitchd/vswitch.xml > $@.tmp
mv $@.tmp $@