buildroot/utils/checkpackagelib/lib_defconfig.py
Yann E. MORIN 7931f78c16 utils/check-package: new check for Buildroot's defconfig files
Now that we do have support for checking hashes for custom versions
(for the few packages for which we do support custom versions, like the
kernel, some bootloaders...), we want to ensure that our defconfig
files, when they enable one or more such custom version, do enable
checking the hashes for those versions, and thus we want to require all
our defconfigs do enable BR2_DOWNLOAD_FORCE_CHECK_HASHES.

Add a check for that condition.

We need to be careful that we only check Buildroot's defconfig, whether
in-tree or in a br2-external, and not kernel or other kconfig-based
defconfig files, like those in board/ sub-directories. So we only match
defconfig files that are in a configs/ directory, whether at the
toplevel (for in-tree defconfigs), or not (for br2-external defconfigs).

Since we only have two defconfigs that check hashes for custom versions,
regnerate .checkpackageignore to ignore all so-far broken defconfigs.

Suggested-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Ricardo Martincoski <ricardo.martincoski@datacom.com.br>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2024-05-01 21:41:27 +02:00

21 lines
576 B
Python

# See utils/checkpackagelib/readme.txt before editing this file.
from checkpackagelib.base import _CheckFunction
class ForceCheckHash(_CheckFunction):
"""Checks that a defconfig does force checking all hashes"""
def before(self):
self.forces = False
def check_line(self, lineno, text):
if self.forces:
return
if text == "BR2_DOWNLOAD_FORCE_CHECK_HASHES=y\n":
self.forces = True
def after(self):
if not self.forces:
return [f"{self.filename}:0: missing BR2_DOWNLOAD_FORCE_CHECK_HASHES"]