utils/checkpackagelib/lib_mk.py: check DEPENDENCIES

Check that {FOO}_DEPENDENCIES are never overriden in a conditional

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Reviewed-by: Ricardo Martincoski <ricardo.martincoski@gmail.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
This commit is contained in:
Fabrice Fontaine 2021-11-10 18:52:18 +01:00 committed by Arnout Vandecappelle (Essensium/Mind)
parent cc570eff96
commit 4910a175b3

View File

@ -88,6 +88,8 @@ class OverriddenVariable(_CheckFunction):
r"_SITE\s*=\s*",
r"_SOURCE\s*=\s*",
r"_VERSION\s*=\s*"])))
FORBIDDEN_OVERRIDDEN = re.compile(r"^[A-Z0-9_]+({})".format("|".join([
r"_DEPENDENCIES\s*=\s*"])))
def before(self):
self.conditional = 0
@ -123,6 +125,10 @@ class OverriddenVariable(_CheckFunction):
.format(self.filename, lineno, variable),
text]
else:
if self.FORBIDDEN_OVERRIDDEN.search(text):
return ["{}:{}: conditional override of variable {}"
.format(self.filename, lineno, variable),
text]
if variable not in self.unconditionally_set:
self.conditionally_set.append(variable)
return