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

login
register
mail settings
Submitter Chong.Lu@windriver.com
Date Aug. 1, 2014, 7:15 a.m.
Message ID <26c2d48cccb6fb2dfe6dd00dbb4ab191b7bd2b4d.1406876955.git.Chong.Lu@windriver.com>
Download mbox | patch
Permalink /patch/77075/
State Accepted
Commit 268688a489add5ac3f378cf69d39f6c8c769549a
Headers show

Comments

Chong.Lu@windriver.com - Aug. 1, 2014, 7:15 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 | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
Robert P. J. Day - Aug. 1, 2014, 7:37 a.m.
On Fri, 1 Aug 2014, Chong Lu wrote:

> 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 | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
>
> diff --git a/meta/classes/oelint.bbclass b/meta/classes/oelint.bbclass
> index 0bed74a..685a88d 100644
> --- a/meta/classes/oelint.bbclass
> +++ b/meta/classes/oelint.bbclass
> @@ -62,4 +62,24 @@ python do_lint() {
>                      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)
> +
> +
> +    ##############################
> +    # Check for ${PN} or ${P} usage in SRC_URI or S
> +    # Should use ${BPN} or ${BP} instead to avoid breaking multilib
> +    #
> +    s = d.getVar("SRC_URI").split()
> +
> +    for srcurl in s:
> +        if not srcurl.startswith("file://"):
> +            if not srcurl.find("{PN}") == -1:
> +                bb.warn("${PN}: Should use BPN instead to PN in SRC_URI")
> +            if not srcurl.find("{P}") == -1:

  should you not say, "use BPN instead of PN ..."?

rday
Chong.Lu@windriver.com - Aug. 1, 2014, 7:57 a.m.
On 08/01/2014 03:37 PM, Robert P. J. Day wrote:
> On Fri, 1 Aug 2014, Chong Lu wrote:
>
>> 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 | 20 ++++++++++++++++++++
>>   1 file changed, 20 insertions(+)
>>
>> diff --git a/meta/classes/oelint.bbclass b/meta/classes/oelint.bbclass
>> index 0bed74a..685a88d 100644
>> --- a/meta/classes/oelint.bbclass
>> +++ b/meta/classes/oelint.bbclass
>> @@ -62,4 +62,24 @@ python do_lint() {
>>                       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)
>> +
>> +
>> +    ##############################
>> +    # Check for ${PN} or ${P} usage in SRC_URI or S
>> +    # Should use ${BPN} or ${BP} instead to avoid breaking multilib
>> +    #
>> +    s = d.getVar("SRC_URI").split()
>> +
>> +    for srcurl in s:
>> +        if not srcurl.startswith("file://"):
>> +            if not srcurl.find("{PN}") == -1:
>> +                bb.warn("${PN}: Should use BPN instead to PN in SRC_URI")
>> +            if not srcurl.find("{P}") == -1:
>    should you not say, "use BPN instead of PN ..."?
>
> rday
OK, thanks.
I will change this and resend a V2.

Best Regards
Chong

Patch

diff --git a/meta/classes/oelint.bbclass b/meta/classes/oelint.bbclass
index 0bed74a..685a88d 100644
--- a/meta/classes/oelint.bbclass
+++ b/meta/classes/oelint.bbclass
@@ -62,4 +62,24 @@  python do_lint() {
                     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)
+
+
+    ##############################
+    # Check for ${PN} or ${P} usage in SRC_URI or S
+    # Should use ${BPN} or ${BP} instead to avoid breaking multilib
+    #
+    s = d.getVar("SRC_URI").split()
+
+    for srcurl in s:
+        if not srcurl.startswith("file://"):
+            if not srcurl.find("{PN}") == -1:
+                bb.warn("${PN}: Should use BPN instead to PN in SRC_URI")
+            if not srcurl.find("{P}") == -1:
+                bb.warn("${PN}: Should use BP instead to P in SRC_URI")
+
+    srcpath = d.getVar("S")
+    if not srcpath.find("{PN}") == -1:
+        bb.warn("${PN}: Should use BPN instead to PN in S")
+    if not srcpath.find("{P}") == -1:
+        bb.warn("${PN}: Should use BP instead to P in S")
 }