[ovs-dev] [PATCH 5/8] ovsdb-doc: Get manpage name from the XML file instead of command line.

Gurucharan Shetty shettyg at nicira.com
Thu Feb 19 11:25:15 UTC 2015


On Thu, Feb 19, 2015 at 12:12 AM, Ben Pfaff <blp at nicira.com> wrote:
> This seems like a better place for it.
>
> Signed-off-by: Ben Pfaff <blp at nicira.com>
Acked-by: Gurucharan Shetty <gshetty at nicira.com>
> ---
>  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 b670452..15618ef 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 80affe9..2f07c0f 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 04de3ca..c6516af 100644
> --- a/vswitchd/vswitch.xml
> +++ b/vswitchd/vswitch.xml
> @@ -1,5 +1,5 @@
>  <?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
> diff --git a/vtep/automake.mk b/vtep/automake.mk
> index eac81d0..a204d0a 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 7ed7f43..6199055 100644
> --- a/vtep/vtep.xml
> +++ b/vtep/vtep.xml
> @@ -1,5 +1,5 @@
>  <?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
> --
> 2.1.3
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev



More information about the dev mailing list