kumquat-buildroot/support/scripts
Ricardo Martincoski 0c5472ace2 utils/check-symbols: new script
This script checks for inconsistencies on symbols declared in Config.in
and used in .mk files.
Currently it checks only symbols following the pattern BR2_\w+ .

The script first gets the list of all files in the repository (using git
ls-files like 'make check-flake8' already do).

Then it parses all relevant files, searching for symbol definitions and
usages, and add entries into a database.

At the end, the database is searched for inconsistencies:
- symbol that is part of "choice" and is referenced with "select";
- legacy symbol being referenced in packages;
- legacy symbol being redefined in packages;
- symbol referenced but not defined;
- symbol defined but not referenced;
- legacy symbol that has a Note stating it is referenced by a package
  (for legacy handling) but is referenced in the package without a
  comment "# legacy";
- legacy symbol that has a Note stating it is referenced by a package
  but it is not actually referenced.

There is also a debug parameter --search that dumps any filename or
symbol entries from the database that matches a regexp.

Sample usages:
$ utils/check-symbols
$ utils/docker-run utils/check-symbols
$ utils/check-symbols --search 'GETTEXT\b|\/openssl'

At same time the script is created:
- add unit tests for it, they can be run using:
  utils/docker-run python3 -m pytest -v utils/checksymbolslib/
- add two more GitLab CI jobs: check-symbols (to check current tree
  using the script) and check-check-symbols (to check the script against
  its unit tests)

Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com>
[Peter: print warnings to stderr, rename change_current_dir() to
	change_to_top_dir()]
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2023-02-06 16:30:20 +01:00
..
apply-patches.sh
boot-qemu-image.py support/scripts/boot-qemu-image.py: increase the timeout by 10 2022-07-27 15:56:57 +02:00
br2-external support/scripts/br2-external: add kernel extensions 2022-06-22 22:22:30 +02:00
brpkgutil.py
check-bin-arch
check-dotconfig.py
check-host-rpath support/scripts: fix TABs/spaces in check-host-rpath 2022-07-30 18:15:08 +02:00
check-kernel-headers.sh
check-merged-usr.sh
cpedb.py
cve.py
expunge-gconv-modules toolchain: support gconv modules from glibc >= 2.34 2022-10-21 21:02:40 +02:00
fix-configure-powerpc64.sh
fix-rpath
gen-bootlin-toolchains toolchain: invert glibc <-> !static dependency 2022-07-27 11:11:19 +02:00
gen-missing-cpe
generate-gitlab-ci-yml utils/check-symbols: new script 2023-02-06 16:30:20 +01:00
genimage.sh
graph-build-time
graph-depends
hardlink-or-copy
mkmakefile
mkusers
pkg-stats support/scripts/pkg-stats: fix flake8 errors 2022-08-27 23:02:38 +02:00
pyinstaller.py package/pkg-python: clean conflicting pep517 packages before install 2022-08-22 11:54:25 +02:00
setlocalversion
size-stats support/scripts/size-stats: count compiled python (.pyc) files 2022-09-24 10:34:30 +02:00