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.
Note that the check-spacing.py script is significantly
slower in Python than in Perl. After researching this
it appears there is nothing that can be done. The Perl
regex engine is simply much better optimized than the
Python one. As previously discussed we need to loook
at uncrustify or clang-format or some other tool to
validate whitespace formatting. This is ongoing. We
can either accept the slow down in the short term or
keep the Perl version in the short term.
In v6:
- Fix various bugs in check-file-access.py so it
now reports same output as original perl script.
- Merged the already-ACKd scripts
In v5:
- Rebased to cope with changes to require VPATH build
- Merged the already-ACKd scripts
In v4:
- Moved all scripts into the scripts/ directory instead
of having them scattered around source tree
- Use re.search instead of re.match
- Don't bother re-compiling regexes
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é (4):
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 | 4 +
build-aux/syntax-check.mk | 3 +-
docs/Makefile.am | 12 +-
docs/genaclperms.pl | 125 --------
docs/hvsupport.pl | 459 -----------------------------
scripts/check-file-access.py | 125 ++++++++
scripts/genaclperms.py | 121 ++++++++
scripts/group-qemu-caps.py | 121 ++++++++
scripts/hvsupport.py | 502 ++++++++++++++++++++++++++++++++
tests/Makefile.am | 3 +-
tests/check-file-access.pl | 130 ---------
tests/file_access_whitelist.txt | 2 +-
tests/group-qemu-caps.pl | 124 --------
13 files changed, 882 insertions(+), 849 deletions(-)
delete mode 100755 docs/genaclperms.pl
delete mode 100755 docs/hvsupport.pl
create mode 100755 scripts/check-file-access.py
create mode 100755 scripts/genaclperms.py
create mode 100755 scripts/group-qemu-caps.py
create mode 100755 scripts/hvsupport.py
delete mode 100755 tests/check-file-access.pl
delete mode 100755 tests/group-qemu-caps.pl
--
2.21.0