Patchwork [3/3,V2] oelint.bbclass: Check for ${PN} or ${P} usage

login
register
mail settings
Submitter Chong.Lu@windriver.com
Date Aug. 1, 2014, 9:03 a.m.
Message ID <0fdb514ba5f34fbd679717a1b4ebc475eee9d3a2.1406883469.git.Chong.Lu@windriver.com>
Download mbox | patch
Permalink /patch/77087/
State Accepted
Commit 268688a489add5ac3f378cf69d39f6c8c769549a
Headers show

Comments

Chong.Lu@windriver.com - Aug. 1, 2014, 9:03 a.m.
Check for ${PN} or ${P} usage in SRC_URI or S.
We should use ${BPN} or ${BP} instead to avoid breaking multilib.

[YOCTO #5427]

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

Patch

diff --git a/meta/classes/oelint.bbclass b/meta/classes/oelint.bbclass
index 07a7ed9..d00f468 100644
--- a/meta/classes/oelint.bbclass
+++ b/meta/classes/oelint.bbclass
@@ -64,4 +64,22 @@  python do_lint() {
                     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))
+
+
+    ##############################
+    # Check for ${PN} or ${P} usage in SRC_URI or S
+    # Should use ${BPN} or ${BP} instead to avoid breaking multilib
+    #
+    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)
+
+    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)
 }