Skip to contentSkip to conversation

utils/checkpackagelib: add function to check of the default package source variable

PATCH New Jerzy Grzegorek 3 participants 3 messages Jan 13, 2018 – Jan 15, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 utils/checkpackagelib: add function to check of the default package source variable

Cc Ricardo Martincoski <[email protected]>
Cc Thomas Petazzoni <[email protected]>

---
Changes v2 -> v3
- add missing whitespaces after ',' (Ricardo Martincoski)
- remove value returned by the check function (Ricardo Martincoski)

Changes v1 -> v2
- remove unused variable (Ricardo Martincoski)
- change warning url (Ricardo Martincoski)
- add whitelist of packages (Ricardo Martincoski)

 utils/checkpackagelib/lib_mk.py | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
utils/checkpackagelib/lib_mk.py +24 -0
index 817e809..a6cfeb6 100644
@@ -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)\\$")
 
Signature · 1 line
1.9.1
#1 lore raw

PATCH v3 1/1 utils/checkpackagelib: add function to check of the default package source variable

Hello,

Quoted 1 line · Jerzy Grzegorek
[https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/47905172]

Note 1: the new warning added to check-package job in gitlab will be fixed by:
http://patchwork.ozlabs.org/patch/859399/
Note 2: the warnings already in the tree have fixes too:
http://patchwork.ozlabs.org/patch/860493/
http://patchwork.ozlabs.org/patch/860542/

Regards,
Ricardo

#2 lore raw

PATCH v3 1/1 utils/checkpackagelib: add function to check of the default package source variable

In reply to Jerzy Grzegorek

Hello,

Quoted 7 lines · Jerzy Grzegorek
Cc Ricardo Martincoski <[email protected]>
Cc Thomas Petazzoni <[email protected]>

---
Changes v2 -> v3
- add missing whitespaces after ',' (Ricardo Martincoski)
- remove value returned by the check function (Ricardo Martincoski)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com