diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2015-03-18 22:33:01 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-03-22 09:19:33 +0000 |
commit | bb3b8e4e7580c1dfdfe584d3b5f0fe6803826a43 (patch) | |
tree | 0bdac9af2a34e2676062745fd6b73f9a12a9a26b /meta/classes/oelint.bbclass | |
parent | 122ef911aac96b311bbe19106fb9ecbe004fd51b (diff) | |
download | openembedded-core-bb3b8e4e7580c1dfdfe584d3b5f0fe6803826a43.tar.gz openembedded-core-bb3b8e4e7580c1dfdfe584d3b5f0fe6803826a43.tar.bz2 openembedded-core-bb3b8e4e7580c1dfdfe584d3b5f0fe6803826a43.zip |
oelint.bbclass: remove duplicated code
The old code 'if not srcpath.find("{PN}") == -1:' looks strange, use
'if srcpath.find("{PN}") != -1:' and remove duplicated code.
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/oelint.bbclass')
-rw-r--r-- | meta/classes/oelint.bbclass | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/meta/classes/oelint.bbclass b/meta/classes/oelint.bbclass index 1cee4b0f25..3e01503756 100644 --- a/meta/classes/oelint.bbclass +++ b/meta/classes/oelint.bbclass @@ -54,6 +54,12 @@ python do_lint() { f.close() return ret + def checkPN(pkgname, varname, str): + if str.find("{PN}") != -1: + bb.warn("%s: should use BPN instead of PN in %s" % (pkgname, varname)) + if str.find("{P}") != -1: + bb.warn("%s: should use BP instead of P in %s" % (pkgname, varname)) + length = len("file://") for item in srcuri: if item.startswith("file://"): @@ -72,14 +78,7 @@ python do_lint() { # for s in srcuri: if not s.startswith("file://"): - if not s.find("{PN}") == -1: - bb.warn("%s: should use BPN instead of PN in SRC_URI" % pkgname) - if not s.find("{P}") == -1: - bb.warn("%s: should use BP instead of P in SRC_URI" % pkgname) + checkPN(pkgname, 'SRC_URI', s) - srcpath = d.getVar("S") - if not srcpath.find("{PN}") == -1: - bb.warn("%s: should use BPN instead of PN in S" % pkgname) - if not srcpath.find("{P}") == -1: - bb.warn("%s: should use BP instead of P in S" % pkgname) + checkPN(pkgname, 'S', d.getVar('S')) } |