aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorGravatar Jerzy Grzegorek <jerzy.m.grzegorek@gmail.com>2018-01-13 22:39:43 +0100
committerGravatar Thomas Petazzoni <thomas.petazzoni@free-electrons.com>2018-01-15 23:27:02 +0100
commit2f5421cb2c0afd0e14800997a8d1a688a3f91d3d (patch)
treed6f2ff5f4cec5e8d03e1daf8dd2b6c817e46d734 /utils
parent612d91a62281cf31154e56020bc6d7155ee61eee (diff)
downloadbuildroot-2f5421cb2c0afd0e14800997a8d1a688a3f91d3d.tar.gz
buildroot-2f5421cb2c0afd0e14800997a8d1a688a3f91d3d.tar.bz2
utils/checkpackagelib: add function to check of the default package source variable
Signed-off-by: Jerzy Grzegorek <jerzy.m.grzegorek@gmail.com> Cc: Ricardo Martincoski <ricardo.martincoski@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Reviewed-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> Tested-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'utils')
-rw-r--r--utils/checkpackagelib/lib_mk.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/utils/checkpackagelib/lib_mk.py b/utils/checkpackagelib/lib_mk.py
index 817e80923e..a6cfeb6d15 100644
--- a/utils/checkpackagelib/lib_mk.py
+++ b/utils/checkpackagelib/lib_mk.py
@@ -99,6 +99,30 @@ class PackageHeader(_CheckFunction):
text]
+class RemoveDefaultPackageSourceVariable(_CheckFunction):
+ packages_that_may_contain_default_source = ["binutils", "gcc", "gdb"]
+ PACKAGE_NAME = re.compile("/([^/]+)\.mk")
+
+ def before(self):
+ package = self.PACKAGE_NAME.search(self.filename).group(1)
+ package_upper = package.replace("-", "_").upper()
+ self.package = package
+ self.FIND_SOURCE = re.compile(
+ "^{}_SOURCE\s*=\s*{}-\$\({}_VERSION\)\.tar\.gz"
+ .format(package_upper, package, package_upper))
+
+ def check_line(self, lineno, text):
+ if self.FIND_SOURCE.search(text):
+
+ if self.package in self.packages_that_may_contain_default_source:
+ return
+
+ return ["{}:{}: remove default value of _SOURCE variable "
+ "({}#generic-package-reference)"
+ .format(self.filename, lineno, self.url_to_manual),
+ text]
+
+
class SpaceBeforeBackslash(_CheckFunction):
TAB_OR_MULTIPLE_SPACES_BEFORE_BACKSLASH = re.compile(r"^.*( |\t)\\$")