From: Chen Miao <chen...@openatom.club>
Hi all,
This series adds scripts/checkversion.py for make versioncheck, keeps
scripts/
checkversion.pl selectable, and switches the default backend to
Python.
The intent is to make this maintenance script easier to read and maintain
while preserving current diagnostics behavior.
Compared with scripts/
checkversion.pl, the Python backend speeds up runtime
with:
- byte-level fast-path filters before regex passes;
- on-demand comment/string masking and checks;
- deferred line-number calculation for diagnostics;
- regex-based path excludes (scripts/checkversion.exclude and
VERSIONCHECK_EXCLUDE_REGEX_FILE);
- a fix for string masking to avoid multi-line overmatching that can hide
real version macro uses.
On the same tree, make versioncheck wall time dropped from 13.08s
(Perl) to 3.52s (Python).
RFC:
- Is it acceptable to migrate this kind of small maintenance script from
Perl to Python when behavior is preserved?
- For this series, is it acceptable to make scripts/checkversion.py the
default for make versioncheck, while keeping CHECKVERSION=perl as a
fallback?
Patch 2 then applies the current versioncheck findings by removing
unnecessary <linux/version.h> includes from the reported files.
Patch summary:
- 1/2: add scripts/checkversion.py, wire CHECKVERSION=perl|python,
and switch the default to Python.
- 2/2: remove redundant <linux/version.h> includes.
Tested with:
- make versioncheck CHECKVERSION=perl
- make versioncheck CHECKVERSION=python
Signed-off-by: Chen Miao <chen...@openatom.club>
Chen Miao (2):
scripts: checkversion: add Python implementation
scripts: checkversion: fix linux/version.h usage reported
Makefile | 13 +-
scripts/checkversion.exclude | 6 +
scripts/checkversion.py | 217 ++++++++++++++++++
.../testing/selftests/bpf/progs/dev_cgroup.c | 1 -
.../testing/selftests/bpf/progs/netcnt_prog.c | 1 -
.../selftests/bpf/progs/test_map_lock.c | 1 -
.../bpf/progs/test_send_signal_kern.c | 1 -
.../selftests/bpf/progs/test_spin_lock.c | 1 -
.../selftests/bpf/progs/test_tcp_estats.c | 1 -
tools/testing/selftests/wireguard/qemu/init.c | 1 -
10 files changed, 235 insertions(+), 8 deletions(-)
create mode 100644 scripts/checkversion.exclude
create mode 100755 scripts/checkversion.py
--
2.43.0