[PATCH v3 00/22] scripts: convert most perl scripts to python

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

 



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 v3:

 - All scripts comply with all flake8 style rules with
   exception of

    E129 visually indented line with same indent as next logical line

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é (22):
  docs: document that C & Python are the preferred languages
  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                            |  12 +-
 build-aux/augeas-gentest.pl            |  60 ---
 build-aux/augeas-gentest.py            |  72 ++++
 build-aux/check-spacing.pl             | 198 ----------
 build-aux/check-spacing.py             | 229 +++++++++++
 build-aux/header-ifdef.pl              | 182 ---------
 build-aux/header-ifdef.py              | 231 +++++++++++
 build-aux/minimize-po.pl               |  37 --
 build-aux/minimize-po.py               |  60 +++
 build-aux/mock-noinline.pl             |  75 ----
 build-aux/mock-noinline.py             |  89 +++++
 build-aux/prohibit-duplicate-header.pl |  26 --
 build-aux/prohibit-duplicate-header.py |  57 +++
 cfg.mk                                 |  30 +-
 docs/Makefile.am                       |  14 +-
 docs/genaclperms.pl                    | 125 ------
 docs/genaclperms.py                    | 123 ++++++
 docs/hacking.html.in                   |  30 ++
 docs/hvsupport.pl                      | 458 ----------------------
 docs/hvsupport.py                      | 516 +++++++++++++++++++++++++
 po/Makefile.am                         |   2 +-
 src/Makefile.am                        | 156 +++-----
 src/access/Makefile.inc.am             |   7 +-
 src/access/genpolkit.pl                | 119 ------
 src/access/genpolkit.py                | 122 ++++++
 src/bhyve/Makefile.inc.am              |   4 +-
 src/check-aclperms.pl                  |  73 ----
 src/check-aclperms.py                  |  78 ++++
 src/check-aclrules.pl                  | 252 ------------
 src/check-aclrules.py                  | 263 +++++++++++++
 src/check-driverimpls.pl               |  80 ----
 src/check-driverimpls.py               | 102 +++++
 src/check-drivername.pl                |  83 ----
 src/check-drivername.py                | 114 ++++++
 src/check-remote-protocol.py           | 137 +++++++
 src/check-symfile.pl                   |  70 ----
 src/check-symfile.py                   |  81 ++++
 src/check-symsorting.pl                | 106 -----
 src/check-symsorting.py                | 119 ++++++
 src/dtrace2systemtap.pl                | 130 -------
 src/dtrace2systemtap.py                | 143 +++++++
 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                | 184 +++++++++
 src/secret/Makefile.inc.am             |   2 +-
 src/storage/Makefile.inc.am            |   2 +-
 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             | 123 ++++++
 tests/file_access_whitelist.txt        |   2 +-
 tests/group-qemu-caps.pl               | 124 ------
 tests/group-qemu-caps.py               | 123 ++++++
 tests/test-wrap-argv.pl                | 174 ---------
 tests/test-wrap-argv.py                | 170 ++++++++
 tests/testutils.c                      |  16 +-
 67 files changed, 3283 insertions(+), 2863 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[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