From 57ba0a7715c1bde424bf6033616349c4f5db0ca7 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 17 Feb 2015 15:52:54 -0800 Subject: [PATCH] ovsdb-doc: Get manpage name from the XML file instead of command line. This seems like a better place for it. Signed-off-by: Ben Pfaff Acked-by: Gurucharan Shetty --- ovsdb/ovsdb-doc | 18 ++++++++---------- vswitchd/automake.mk | 1 - vswitchd/vswitch.xml | 2 +- vtep/automake.mk | 1 - vtep/vtep.xml | 2 +- 5 files changed, 10 insertions(+), 14 deletions(-) diff --git a/ovsdb/ovsdb-doc b/ovsdb/ovsdb-doc index b67045238..15618efbe 100755 --- a/ovsdb/ovsdb-doc +++ b/ovsdb/ovsdb-doc @@ -264,7 +264,7 @@ def tableToNroff(schema, tableXml): return s -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 @@ -272,8 +272,10 @@ def docsToNroff(schemaFile, xmlFile, erFile, title=None, version=None): 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" @@ -297,7 +299,7 @@ def docsToNroff(schemaFile, xmlFile, erFile, title=None, version=None): .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 = [] @@ -378,7 +380,6 @@ where SCHEMA is an OVSDB schema in JSON format 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} @@ -388,20 +389,17 @@ if __name__ == "__main__": try: try: options, args = getopt.gnu_getopt(sys.argv[1:], 'hV', - ['er-diagram=', 'title=', + ['er-diagram=', 'version=', 'help']) except getopt.GetoptError, geo: sys.stderr.write("%s: %s\n" % (argv0, geo.msg)) sys.exit(1) er_diagram = None - title = None 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']: @@ -415,7 +413,7 @@ if __name__ == "__main__": 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): diff --git a/vswitchd/automake.mk b/vswitchd/automake.mk index 80affe95a..2f07c0fc7 100644 --- a/vswitchd/automake.mk +++ b/vswitchd/automake.mk @@ -48,7 +48,6 @@ vswitchd/ovs-vswitchd.conf.db.5: \ 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 \ diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index 04de3ca02..c6516af0d 100644 --- a/vswitchd/vswitch.xml +++ b/vswitchd/vswitch.xml @@ -1,5 +1,5 @@ - +

A database with this schema holds the configuration for one Open vSwitch daemon. The top-level configuration for the daemon is the diff --git a/vtep/automake.mk b/vtep/automake.mk index eac81d0ae..a204d0a50 100644 --- a/vtep/automake.mk +++ b/vtep/automake.mk @@ -48,7 +48,6 @@ man_MANS += vtep/vtep.5 vtep/vtep.5: \ ovsdb/ovsdb-doc vtep/vtep.xml vtep/vtep.ovsschema $(VTEP_PIC) $(AM_V_GEN)$(OVSDB_DOC) \ - --title="vtep" \ $(VTEP_DOT_DIAGRAM_ARG) \ --version=$(VERSION) \ $(srcdir)/vtep/vtep.ovsschema \ diff --git a/vtep/vtep.xml b/vtep/vtep.xml index 7ed7f43f0..619905570 100644 --- a/vtep/vtep.xml +++ b/vtep/vtep.xml @@ -1,5 +1,5 @@ - +

This schema specifies relations that a VTEP can use to integrate physical ports into logical switches maintained by a network -- 2.20.1