utils/checkpackagelib: warn about $(HOST_DIR)/usr

It's been ages (5 years at the next release) that we've not installed
host packages in $(HOST_DIR)/usr, but we still have a few packages that
reference it or install things in there. See [1]

Add a new check_function that warns when a file is added installing to
or referencing $(HOST_DIR)/usr .

[1] "d9ff62c4cd pacakge: drop remnants of $(HOST_DIR)/usr"

Cc: Yann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com>
[Arnout: exclude skeleton.mk with disable comment instead of explicit
         code]
Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
This commit is contained in:
Ricardo Martincoski
2022-07-31 16:35:20 -03:00
committed by Arnout Vandecappelle
parent 47910ccc36
commit 29a0dd4a30
3 changed files with 34 additions and 0 deletions

View File

@@ -21,6 +21,16 @@ continue_conditional = ["elif", "else"]
end_conditional = ["endif"]
class DoNotInstallToHostdirUsr(_CheckFunction):
INSTALL_TO_HOSTDIR_USR = re.compile(r"^[^#].*\$\(HOST_DIR\)/usr")
def check_line(self, lineno, text):
if self.INSTALL_TO_HOSTDIR_USR.match(text.rstrip()):
return ["{}:{}: install files to $(HOST_DIR)/ instead of $(HOST_DIR)/usr/"
.format(self.filename, lineno),
text]
class Ifdef(_CheckFunction):
IFDEF = re.compile(r"^\s*(else\s+|)(ifdef|ifndef)\s")