aboutsummaryrefslogtreecommitdiff
path: root/utils/checkpackagelib
diff options
context:
space:
mode:
authorGravatar Ricardo Martincoski <ricardo.martincoski@gmail.com>2018-07-08 22:56:47 -0300
committerGravatar Thomas Petazzoni <thomas.petazzoni@bootlin.com>2018-09-21 00:05:55 +0200
commit910ee6f7bd23da264fa47a820506ca64e9e7b738 (patch)
treea80edd2c659f6e53a79de3827b9aab60bb5f32e8 /utils/checkpackagelib
parente9963cd2b51f2f5d64c576ad2f2188a644627be3 (diff)
downloadbuildroot-910ee6f7bd23da264fa47a820506ca64e9e7b738.tar.gz
buildroot-910ee6f7bd23da264fa47a820506ca64e9e7b738.tar.bz2
utils/check-package: detect the use of ${} in .mk files
And warn to use $() instead. For examples see [1] and [2]. In the regexp, search for ${VARIABLE} but: - ignore comments; - ignore variables to be expanded by the shell "$${}". [1] http://lists.busybox.net/pipermail/buildroot/2018-July/225211.html [2] https://github.com/buildroot/buildroot/commit/36305380db1312442623128689fe5067d9058381 Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> Cc: Arnout Vandecappelle <arnout@mind.be> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Cc: Yann E. MORIN <yann.morin.1998@free.fr> Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Diffstat (limited to 'utils/checkpackagelib')
-rw-r--r--utils/checkpackagelib/lib_mk.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/utils/checkpackagelib/lib_mk.py b/utils/checkpackagelib/lib_mk.py
index 86e9aa2d97..0e430a2f12 100644
--- a/utils/checkpackagelib/lib_mk.py
+++ b/utils/checkpackagelib/lib_mk.py
@@ -251,3 +251,13 @@ class UselessFlag(_CheckFunction):
"({}#_infrastructure_for_autotools_based_packages)"
.format(self.filename, lineno, self.url_to_manual),
text]
+
+
+class VariableWithBraces(_CheckFunction):
+ VARIABLE_WITH_BRACES = re.compile(r"^[^#].*[^$]\${\w+}")
+
+ def check_line(self, lineno, text):
+ if self.VARIABLE_WITH_BRACES.match(text.rstrip()):
+ return ["{}:{}: use $() to delimit variables, not ${{}}"
+ .format(self.filename, lineno),
+ text]