[RFCv3 00/25] RFC: Generate parsexml/formatbuf functions based on directives

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

 



V2 here: [https://listman.redhat.com/archives/libvir-list/2020-September/msg00204.html]

Differ from V2:

  * Add tests for xmlgen to illustrate all the different features we can use
    and make sure its proper functions in the future.

  * Add docs/xmlgen.rst to explain the usage of all directives and the tool
    itself.

  * Now xmlgen can check whether the first item of enum ends with _NONE, _DEFAULT
    or _ABSENT and generate proper code. So we no longer need to add extra
    'default' item for enum.

  * Now xmlgen can provide extra [tips] when we execute its command-line to show
    generated code for preview.

  * Enable/disable hooks by macros rather than by special directives.

  * Add virStrToBoolYesNo/virStrToBoolTrueFalse/virStrToBoolOnOff
    and explicitly check both the true and false values.

  * Stronger check for python3-clang and libclang.so to make sure it can work.

  * Add python3-clang to the libvirt.spec.in and the mingw-libvirt.spec.in.

  Thanks!


Shi Lei (25):
  scripts: Add a tool to generate xml parse/format functions
  maint: Check python3-clang and libclang
  maint: Call xmlgen automatically when c-head-files change
  docs: Add xmlgen.rst to explain how to use it
  build-aux: Only check *.[ch] for sc_prohibit_useless_translation
  tests: Add tests for xmlgen
  util: Add some xml-helper-functions to cooperate with xmlgen
  util: Add helper aliases and functions for 'bool' and 'time_t' to cooperate with xmlgen
  util: Add parsexml/formatbuf helper functions for virSocketAddr
  util: Add virUUID type and parse/format functions
  conf: Extract error-checking code from virNetworkDNSTxtDefParseXML
  conf: Replace virNetworkDNSTxtDefParseXML(hardcoded) with namesake(generated)
  conf: Generate virNetworkDNSTxtDefFormatBuf
  conf: Extract error-checking code from virNetworkDNSSrvDefParseXML
  conf: Replace virNetworkDNSSrvDefParseXML(hardcoded) with namesake(generated)
  conf: Generate virNetworkDNSSrvDefFormatBuf
  conf: Extract error-checking code from virNetworkDNSHostDefParseXML
  conf: Replace virNetworkDNSHostDefParseXML(hardcoded) with namesake(generated)
  conf: Generate virNetworkDNSHostDefFormatBuf
  conf: Extract virNetworkDNSForwarderParseXML from virNetworkDNSParseXML
  conf: Replace virNetworkDNSForwarderParseXML(hardcoded) with namesake(generated)
  conf: Generate virNetworkDNSForwarderFormatBuf
  conf: Extract error-checking code from virNetworkDNSDefParseXML
  conf: Replace virNetworkDNSDefParseXML(hardcoded) with namesake(generated)
  conf: Generate virNetworkDNSDefFormatBuf

 build-aux/syntax-check.mk                |    2 +-
 docs/meson.build                         |    1 +
 docs/xmlgen.rst                          |  684 +++++++++++++
 libvirt.spec.in                          |    1 +
 meson.build                              |   10 +
 mingw-libvirt.spec.in                    |    1 +
 po/POTFILES.in                           |    2 +
 scripts/meson.build                      |    8 +
 scripts/xmlgen/directive.py              | 1192 ++++++++++++++++++++++
 scripts/xmlgen/go                        |   29 +
 scripts/xmlgen/main.py                   |  534 ++++++++++
 scripts/xmlgen/utils.py                  |  121 +++
 src/conf/meson.build                     |   37 +
 src/conf/network_conf.c                  |  463 ++-------
 src/conf/network_conf.h                  |   59 +-
 src/internal.h                           |    8 +
 src/libvirt_private.syms                 |   13 +
 src/meson.build                          |    6 +
 src/util/meson.build                     |   36 +
 src/util/virbuffer.c                     |   44 +
 src/util/virbuffer.h                     |    8 +-
 src/util/virsocketaddr.c                 |   42 +
 src/util/virsocketaddr.h                 |   23 +-
 src/util/virstring.c                     |  102 ++
 src/util/virstring.h                     |   15 +
 src/util/viruuid.c                       |   31 +
 src/util/viruuid.h                       |   18 +
 src/util/virxml.c                        |  120 +++
 src/util/virxml.h                        |    6 +
 tests/meson.build                        |    3 +
 tests/xmlgenin/conf/array.h              |   17 +
 tests/xmlgenin/conf/empty.h              |    7 +
 tests/xmlgenin/conf/enum-first-item.h    |   12 +
 tests/xmlgenin/conf/external.h           |    9 +
 tests/xmlgenin/conf/genformat-separate.h |   11 +
 tests/xmlgenin/conf/genformat.h          |   11 +
 tests/xmlgenin/conf/genparse.h           |   11 +
 tests/xmlgenin/conf/namespace.h          |   12 +
 tests/xmlgenin/conf/required.h           |    9 +
 tests/xmlgenin/conf/skipparse.h          |   10 +
 tests/xmlgenin/conf/specify.h            |   13 +
 tests/xmlgenin/conf/xmlattr.h            |   10 +
 tests/xmlgenin/conf/xmlelem.h            |   10 +
 tests/xmlgenin/conf/xmlgroup.h           |    8 +
 tests/xmlgenin/conf/xmlswitch.h          |   17 +
 tests/xmlgenin/util/enums.h              |   58 ++
 tests/xmlgenin/util/structs.h            |   67 ++
 tests/xmlgenout/array.txt                |  364 +++++++
 tests/xmlgenout/empty.txt                |  181 ++++
 tests/xmlgenout/enum-first-item.txt      |  297 ++++++
 tests/xmlgenout/external.txt             |  205 ++++
 tests/xmlgenout/genformat-separate.txt   |  190 ++++
 tests/xmlgenout/genformat.txt            |  142 +++
 tests/xmlgenout/genparse.txt             |  154 +++
 tests/xmlgenout/namespace.txt            |  222 ++++
 tests/xmlgenout/required.txt             |  236 +++++
 tests/xmlgenout/skipparse.txt            |  223 ++++
 tests/xmlgenout/specify.txt              |  291 ++++++
 tests/xmlgenout/xmlattr.txt              |  252 +++++
 tests/xmlgenout/xmlelem.txt              |  243 +++++
 tests/xmlgenout/xmlgroup.txt             |  204 ++++
 tests/xmlgenout/xmlswitch.txt            |  470 +++++++++
 tests/xmlgentest.c                       |  107 ++
 tools/meson.build                        |    3 +
 64 files changed, 7289 insertions(+), 406 deletions(-)
 create mode 100644 docs/xmlgen.rst
 create mode 100644 scripts/xmlgen/directive.py
 create mode 100755 scripts/xmlgen/go
 create mode 100755 scripts/xmlgen/main.py
 create mode 100644 scripts/xmlgen/utils.py
 create mode 100644 tests/xmlgenin/conf/array.h
 create mode 100644 tests/xmlgenin/conf/empty.h
 create mode 100644 tests/xmlgenin/conf/enum-first-item.h
 create mode 100644 tests/xmlgenin/conf/external.h
 create mode 100644 tests/xmlgenin/conf/genformat-separate.h
 create mode 100644 tests/xmlgenin/conf/genformat.h
 create mode 100644 tests/xmlgenin/conf/genparse.h
 create mode 100644 tests/xmlgenin/conf/namespace.h
 create mode 100644 tests/xmlgenin/conf/required.h
 create mode 100644 tests/xmlgenin/conf/skipparse.h
 create mode 100644 tests/xmlgenin/conf/specify.h
 create mode 100644 tests/xmlgenin/conf/xmlattr.h
 create mode 100644 tests/xmlgenin/conf/xmlelem.h
 create mode 100644 tests/xmlgenin/conf/xmlgroup.h
 create mode 100644 tests/xmlgenin/conf/xmlswitch.h
 create mode 100644 tests/xmlgenin/util/enums.h
 create mode 100644 tests/xmlgenin/util/structs.h
 create mode 100644 tests/xmlgenout/array.txt
 create mode 100644 tests/xmlgenout/empty.txt
 create mode 100644 tests/xmlgenout/enum-first-item.txt
 create mode 100644 tests/xmlgenout/external.txt
 create mode 100644 tests/xmlgenout/genformat-separate.txt
 create mode 100644 tests/xmlgenout/genformat.txt
 create mode 100644 tests/xmlgenout/genparse.txt
 create mode 100644 tests/xmlgenout/namespace.txt
 create mode 100644 tests/xmlgenout/required.txt
 create mode 100644 tests/xmlgenout/skipparse.txt
 create mode 100644 tests/xmlgenout/specify.txt
 create mode 100644 tests/xmlgenout/xmlattr.txt
 create mode 100644 tests/xmlgenout/xmlelem.txt
 create mode 100644 tests/xmlgenout/xmlgroup.txt
 create mode 100644 tests/xmlgenout/xmlswitch.txt
 create mode 100644 tests/xmlgentest.c

-- 
2.25.1





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux