aboutsummaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorChong Lu <Chong.Lu@windriver.com>2014-08-01 17:03:37 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-08-06 10:23:39 +0100
commit207e94d4e1ffb7cae5310c16efc6224a7f0ce056 (patch)
tree2380020fceb18c13df6f9dc811ff4166e90857b6 /meta
parent7c85585bf6d436ee874e63cf375d4262ebe204a9 (diff)
downloadopenembedded-core-contrib-207e94d4e1ffb7cae5310c16efc6224a7f0ce056.tar.gz
oelint.bbclass: add patch checking
Check that all patches have Signed-off-by and Upstream-Status. [YOCTO #5427] (From OE-Core rev: a2b6be10daca733ba4e557bd2d831c60589e9ffd) Signed-off-by: Chong Lu <Chong.Lu@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/oelint.bbclass35
1 files changed, 35 insertions, 0 deletions
diff --git a/meta/classes/oelint.bbclass b/meta/classes/oelint.bbclass
index d14e3783f3..07a7ed9d7c 100644
--- a/meta/classes/oelint.bbclass
+++ b/meta/classes/oelint.bbclass
@@ -29,4 +29,39 @@ python do_lint() {
bb.warn("%s: SECTION is not set" % pkgname)
elif not section.islower():
bb.warn("%s: SECTION should only use lower case" % pkgname)
+
+
+ ##############################
+ # Check that all patches have Signed-off-by and Upstream-Status
+ #
+ srcuri = 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 srcuri:
+ 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("%s: %s doesn't have Signed-off-by" % (pkgname, item))
+ if findKey(path, "Upstream-Status"):
+ bb.warn("%s: %s doesn't have Upstream-Status" % (pkgname, item))
}