[OE-core] [PATCH 2/3] oelint.bbclass: add patch checking

Chong Lu Chong.Lu at windriver.com
Fri Aug 1 07:15:07 UTC 2014


Check that all patches have Signed-off-by and Upstream-Status.

[YOCTO #5427]

Signed-off-by: Chong Lu <Chong.Lu at windriver.com>
---
 meta/classes/oelint.bbclass | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/meta/classes/oelint.bbclass b/meta/classes/oelint.bbclass
index 1c6f4b8..0bed74a 100644
--- a/meta/classes/oelint.bbclass
+++ b/meta/classes/oelint.bbclass
@@ -27,4 +27,39 @@ python do_lint() {
         bb.warn("${PN}: SECTION is not set")
     elif not s.islower():
         bb.warn("${PN}: SECTION should only use lower case")
+
+
+    ##############################
+    # Check that all patches have Signed-off-by and Upstream-Status
+    #
+    s = d.getVar("SRC_URI").split()
+    fpaths = (d.getVar('FILESPATH', True) or '').split(':')
+
+    def findPatch(patchname):
+        for dir in fpaths:
+            patchpath = dir + patchname
+            if os.path.exists(patchpath):
+                 return patchpath
+
+    def findKey(path, key):
+        ret = True
+        f = file('%s' % path, mode = 'r')
+        line = f.readline()
+        while line:
+            if line.find(key) != -1:
+                ret = False
+            line = f.readline()
+        f.close()
+        return ret
+
+    length = len("file://")
+    for item in s:
+        if item.startswith("file://"):
+            item = item[length:]
+            if item.endswith(".patch") or item.endswith(".diff"):
+                path = findPatch(item)
+                if findKey(path, "Signed-off-by"):
+                    bb.warn("${PN}: %s doesn't have Signed-off-by" % item)
+                if findKey(path, "Upstream-Status"):
+                    bb.warn("${PN}: %s doesn't have Upstream-Status" % item)
 }
-- 
1.9.1




More information about the Openembedded-core mailing list