diff options
author | Chong Lu <Chong.Lu@windriver.com> | 2014-08-01 17:03:37 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-08-06 10:23:39 +0100 |
commit | 207e94d4e1ffb7cae5310c16efc6224a7f0ce056 (patch) | |
tree | 2380020fceb18c13df6f9dc811ff4166e90857b6 /meta | |
parent | 7c85585bf6d436ee874e63cf375d4262ebe204a9 (diff) | |
download | poky-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.bbclass | 35 |
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() { | |||
29 | bb.warn("%s: SECTION is not set" % pkgname) | 29 | bb.warn("%s: SECTION is not set" % pkgname) |
30 | elif not section.islower(): | 30 | elif not section.islower(): |
31 | bb.warn("%s: SECTION should only use lower case" % pkgname) | 31 | bb.warn("%s: SECTION should only use lower case" % pkgname) |
32 | |||
33 | |||
34 | ############################## | ||
35 | # Check that all patches have Signed-off-by and Upstream-Status | ||
36 | # | ||
37 | srcuri = d.getVar("SRC_URI").split() | ||
38 | fpaths = (d.getVar('FILESPATH', True) or '').split(':') | ||
39 | |||
40 | def findPatch(patchname): | ||
41 | for dir in fpaths: | ||
42 | patchpath = dir + patchname | ||
43 | if os.path.exists(patchpath): | ||
44 | return patchpath | ||
45 | |||
46 | def findKey(path, key): | ||
47 | ret = True | ||
48 | f = file('%s' % path, mode = 'r') | ||
49 | line = f.readline() | ||
50 | while line: | ||
51 | if line.find(key) != -1: | ||
52 | ret = False | ||
53 | line = f.readline() | ||
54 | f.close() | ||
55 | return ret | ||
56 | |||
57 | length = len("file://") | ||
58 | for item in srcuri: | ||
59 | if item.startswith("file://"): | ||
60 | item = item[length:] | ||
61 | if item.endswith(".patch") or item.endswith(".diff"): | ||
62 | path = findPatch(item) | ||
63 | if findKey(path, "Signed-off-by"): | ||
64 | bb.warn("%s: %s doesn't have Signed-off-by" % (pkgname, item)) | ||
65 | if findKey(path, "Upstream-Status"): | ||
66 | bb.warn("%s: %s doesn't have Upstream-Status" % (pkgname, item)) | ||
32 | } | 67 | } |