[libvirt] [PATCH v2 00/24] scripts: convert most perl scripts to python

Daniel P. Berrangé berrange at redhat.com
Wed Sep 11 16:23:09 UTC 2019


This series is an effort to reduce the number of different
languages we use by eliminating most use of perl in favour
of python.

This aligns with fact that the likely future build system
we'll use (meson) is written in python, and that python
is much more commonly used/understood by developers these
days than perl.

With this applied we use perl in a handful of places only:

 - src/rpc/gendispatch.pl - this is a horrendously large
   script and very hard to understand/follow. A straight
   syntax conversion to Python would still leave a hgue
   and hard to understand/follow script. It really needs
   a clean room rewrite from scratch, with better structure.

 - src/rpc/genprotocol.pl - fairly easy to convert, but
   might be obsolete depending on approach for rewriting
   gendispatch.pl, so ignored for now

 - tests/oomtrace.pl - will be purge by the patches that
   drop OOM handling anyway

 - tools/wireshark/util/genxdrstub.pl - a very large
   script, which I haven't got the courage to tackle
   yet.

 - cfg.mk/maint.mk - many syntax rules involve regexes
   which are fed to perl. Decision on what to do
   with syntax-check rules punted to another time.

 - build-aux/gitlog-to-changelog
 - build-aux/useless-if-before-free - Both pulled in
   from gnulib. Could be rewritten quite easily if
   desired, but given that we aren't maintainers of
   them right now, they're ignored as they don't
   really impact our developers.

In v2:

 - Pulled in patch to hacking file
 - Converted many more scripts
 - Forced UTF-8 character set to avoid ascii codec
   on py3 < 3.7

Daniel P. Berrangé (24):
  docs: document that C & Python are the preferred languages
  cfg.mk: fix comment detection for python semicolon check
  build: force a UTF-8 locale for python
  build-aux: rewrite augest test generator in Python
  build-aux: rewrite po file minimizer in Python
  build-aux: rewrite duplicate header checker in Python
  build-aux: rewrite whitespace checker in Python
  build-aux: rewrite mock inline checker in Python
  build-aux: rewrite header ifdef checker in Python
  src: rewrite ACL permissions checker in Python
  src: rewrite symfile sorting checker in Python
  src: rewrite symfile library checker in Python
  src: rewrite systemtap probe generator in Python
  src: rewrite systemtap function generator in Python
  src: rewrite driver name checker in Python
  src: rewrite driver impl checker in Python
  src: rewrite ACL rule checker in Python
  src: rewrite polkit ACL generator in Python
  src: rewrite remote protocol checker in Python
  tests: rewrite test argv line wrapper in Python
  tests: rewrite qemu capability grouper in Python
  tests: rewrite file access checker in Python
  docs: rewrite hvsupport.html page generator in python
  docs: rewrite polkit docs generator in Python

 Makefile.am                            |  14 +-
 build-aux/augeas-gentest.pl            |  60 ----
 build-aux/augeas-gentest.py            |  72 ++++
 build-aux/check-spacing.pl             | 198 ----------
 build-aux/check-spacing.py             | 204 +++++++++++
 build-aux/header-ifdef.pl              | 182 ----------
 build-aux/header-ifdef.py              | 206 +++++++++++
 build-aux/minimize-po.pl               |  37 --
 build-aux/minimize-po.py               |  60 ++++
 build-aux/mock-noinline.pl             |  75 ----
 build-aux/mock-noinline.py             |  88 +++++
 build-aux/prohibit-duplicate-header.pl |  26 --
 build-aux/prohibit-duplicate-header.py |  54 +++
 cfg.mk                                 |  32 +-
 configure.ac                           |   8 +
 docs/Makefile.am                       |  17 +-
 docs/genaclperms.pl                    | 125 -------
 docs/genaclperms.py                    | 122 +++++++
 docs/hacking.html.in                   |  30 ++
 docs/hvsupport.pl                      | 458 -----------------------
 docs/hvsupport.py                      | 479 +++++++++++++++++++++++++
 po/Makefile.am                         |   2 +-
 src/Makefile.am                        | 156 +++-----
 src/access/Makefile.inc.am             |   6 +-
 src/access/genpolkit.pl                | 119 ------
 src/access/genpolkit.py                | 119 ++++++
 src/bhyve/Makefile.inc.am              |   4 +-
 src/check-aclperms.pl                  |  73 ----
 src/check-aclperms.py                  |  77 ++++
 src/check-aclrules.pl                  | 252 -------------
 src/check-aclrules.py                  | 244 +++++++++++++
 src/check-driverimpls.pl               |  80 -----
 src/check-driverimpls.py               |  96 +++++
 src/check-drivername.pl                |  83 -----
 src/check-drivername.py                | 112 ++++++
 src/check-remote-protocol.py           | 131 +++++++
 src/check-symfile.pl                   |  70 ----
 src/check-symfile.py                   |  80 +++++
 src/check-symsorting.pl                | 106 ------
 src/check-symsorting.py                | 112 ++++++
 src/dtrace2systemtap.pl                | 130 -------
 src/dtrace2systemtap.py                | 140 ++++++++
 src/esx/Makefile.inc.am                |   2 +-
 src/hyperv/Makefile.inc.am             |   2 +-
 src/interface/Makefile.inc.am          |   2 +-
 src/libxl/Makefile.inc.am              |   4 +-
 src/locking/Makefile.inc.am            |   6 +-
 src/logging/Makefile.inc.am            |   2 +-
 src/lxc/Makefile.inc.am                |   4 +-
 src/network/Makefile.inc.am            |   2 +-
 src/node_device/Makefile.inc.am        |   2 +-
 src/nwfilter/Makefile.inc.am           |   2 +-
 src/qemu/Makefile.inc.am               |   4 +-
 src/remote/Makefile.inc.am             |   4 +-
 src/rpc/Makefile.inc.am                |   2 +-
 src/rpc/gensystemtap.pl                | 193 ----------
 src/rpc/gensystemtap.py                | 174 +++++++++
 src/secret/Makefile.inc.am             |   2 +-
 src/storage/Makefile.inc.am            |   2 +-
 src/util/Makefile.inc.am               |   8 +-
 src/vbox/Makefile.inc.am               |   2 +-
 src/vz/Makefile.inc.am                 |   2 +-
 tests/Makefile.am                      |   4 +-
 tests/check-file-access.pl             | 126 -------
 tests/check-file-access.py             | 121 +++++++
 tests/file_access_whitelist.txt        |   2 +-
 tests/group-qemu-caps.pl               | 124 -------
 tests/group-qemu-caps.py               | 115 ++++++
 tests/test-wrap-argv.pl                | 174 ---------
 tests/test-wrap-argv.py                | 162 +++++++++
 tests/testutils.c                      |  16 +-
 71 files changed, 3132 insertions(+), 2872 deletions(-)
 delete mode 100755 build-aux/augeas-gentest.pl
 create mode 100755 build-aux/augeas-gentest.py
 delete mode 100755 build-aux/check-spacing.pl
 create mode 100755 build-aux/check-spacing.py
 delete mode 100644 build-aux/header-ifdef.pl
 create mode 100644 build-aux/header-ifdef.py
 delete mode 100755 build-aux/minimize-po.pl
 create mode 100755 build-aux/minimize-po.py
 delete mode 100644 build-aux/mock-noinline.pl
 create mode 100644 build-aux/mock-noinline.py
 delete mode 100644 build-aux/prohibit-duplicate-header.pl
 create mode 100644 build-aux/prohibit-duplicate-header.py
 delete mode 100755 docs/genaclperms.pl
 create mode 100755 docs/genaclperms.py
 delete mode 100755 docs/hvsupport.pl
 create mode 100755 docs/hvsupport.py
 delete mode 100755 src/access/genpolkit.pl
 create mode 100755 src/access/genpolkit.py
 delete mode 100755 src/check-aclperms.pl
 create mode 100755 src/check-aclperms.py
 delete mode 100755 src/check-aclrules.pl
 create mode 100755 src/check-aclrules.py
 delete mode 100755 src/check-driverimpls.pl
 create mode 100755 src/check-driverimpls.py
 delete mode 100755 src/check-drivername.pl
 create mode 100644 src/check-drivername.py
 create mode 100644 src/check-remote-protocol.py
 delete mode 100755 src/check-symfile.pl
 create mode 100755 src/check-symfile.py
 delete mode 100755 src/check-symsorting.pl
 create mode 100755 src/check-symsorting.py
 delete mode 100755 src/dtrace2systemtap.pl
 create mode 100755 src/dtrace2systemtap.py
 delete mode 100755 src/rpc/gensystemtap.pl
 create mode 100755 src/rpc/gensystemtap.py
 delete mode 100755 tests/check-file-access.pl
 create mode 100755 tests/check-file-access.py
 delete mode 100755 tests/group-qemu-caps.pl
 create mode 100755 tests/group-qemu-caps.py
 delete mode 100755 tests/test-wrap-argv.pl
 create mode 100755 tests/test-wrap-argv.py

-- 
2.21.0




More information about the libvir-list mailing list