This seems like a better place for it.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Gurucharan Shetty <gshetty@nicira.com>
-def docsToNroff(schemaFile, xmlFile, erFile, title=None, version=None):
+def docsToNroff(schemaFile, xmlFile, erFile, 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
xmlDate = os.stat(xmlFile).st_mtime
d = date.fromtimestamp(max(schemaDate, xmlDate))
xmlDate = os.stat(xmlFile).st_mtime
d = date.fromtimestamp(max(schemaDate, xmlDate))
- if title == None:
- title = schema.name
+ if doc.hasAttribute('name'):
+ manpage = doc.attributes['name'].nodeValue
+ else:
+ manpage = schema.name
if version == None:
version = "UNKNOWN"
if version == None:
version = "UNKNOWN"
.SH NAME
%s \- %s database schema
.PP
.SH NAME
%s \- %s database schema
.PP
-''' % (title, schema.version, version, textToNroff(schema.name), schema.name)
+''' % (manpage, schema.version, version, textToNroff(manpage), schema.name)
tables = ""
introNodes = []
tables = ""
introNodes = []
The following options are also available:
--er-diagram=DIAGRAM.PIC include E-R diagram from DIAGRAM.PIC
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
--version=VERSION use VERSION to display on document footer
-h, --help display this help message\
""" % {'argv0': argv0}
--version=VERSION use VERSION to display on document footer
-h, --help display this help message\
""" % {'argv0': argv0}
try:
try:
options, args = getopt.gnu_getopt(sys.argv[1:], 'hV',
try:
try:
options, args = getopt.gnu_getopt(sys.argv[1:], 'hV',
- ['er-diagram=', 'title=',
'version=', 'help'])
except getopt.GetoptError, geo:
sys.stderr.write("%s: %s\n" % (argv0, geo.msg))
sys.exit(1)
er_diagram = None
'version=', 'help'])
except getopt.GetoptError, geo:
sys.stderr.write("%s: %s\n" % (argv0, geo.msg))
sys.exit(1)
er_diagram = None
version = None
for key, value in options:
if key == '--er-diagram':
er_diagram = value
version = None
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']:
elif key == '--version':
version = value
elif key in ['-h', '--help']:
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, version)
+ s = docsToNroff(args[0], args[1], er_diagram, 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):
ovsdb/ovsdb-doc vswitchd/vswitch.xml vswitchd/vswitch.ovsschema \
$(VSWITCH_PIC)
$(AM_V_GEN)$(OVSDB_DOC) \
ovsdb/ovsdb-doc vswitchd/vswitch.xml vswitchd/vswitch.ovsschema \
$(VSWITCH_PIC)
$(AM_V_GEN)$(OVSDB_DOC) \
- --title="ovs-vswitchd.conf.db" \
$(VSWITCH_DOT_DIAGRAM_ARG) \
--version=$(VERSION) \
$(srcdir)/vswitchd/vswitch.ovsschema \
$(VSWITCH_DOT_DIAGRAM_ARG) \
--version=$(VERSION) \
$(srcdir)/vswitchd/vswitch.ovsschema \
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
-<database title="Open vSwitch Configuration Database">
+<database name="ovs-vswitchd.conf.db" title="Open vSwitch Configuration Database">
<p>
A database with this schema holds the configuration for one Open
vSwitch daemon. The top-level configuration for the daemon is the
<p>
A database with this schema holds the configuration for one Open
vSwitch daemon. The top-level configuration for the daemon is the
vtep/vtep.5: \
ovsdb/ovsdb-doc vtep/vtep.xml vtep/vtep.ovsschema $(VTEP_PIC)
$(AM_V_GEN)$(OVSDB_DOC) \
vtep/vtep.5: \
ovsdb/ovsdb-doc vtep/vtep.xml vtep/vtep.ovsschema $(VTEP_PIC)
$(AM_V_GEN)$(OVSDB_DOC) \
$(VTEP_DOT_DIAGRAM_ARG) \
--version=$(VERSION) \
$(srcdir)/vtep/vtep.ovsschema \
$(VTEP_DOT_DIAGRAM_ARG) \
--version=$(VERSION) \
$(srcdir)/vtep/vtep.ovsschema \
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
-<database title="Hardware VTEP Database">
+<database name="vtep" title="Hardware VTEP Database">
<p>
This schema specifies relations that a VTEP can use to integrate
physical ports into logical switches maintained by a network
<p>
This schema specifies relations that a VTEP can use to integrate
physical ports into logical switches maintained by a network