Patchwork classes/native*.bbclass: fix error during parse with bitbake master

login
register
mail settings
Submitter Paul Eggleton
Date June 22, 2011, 9:13 a.m.
Message ID <1308733994-3571-1-git-send-email-paul.eggleton@linux.intel.com>
Download mbox | patch
Permalink /patch/6237/
State Superseded
Headers show

Comments

Paul Eggleton - June 22, 2011, 9:13 a.m.
Fixes "AttributeError: 'NoneType' object has no attribute 'split'" during
parsing with bitbake master. We should not be calling explode_deps with
None as the argument, so check for that before calling it.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 classes/native.bbclass    |    5 ++++-
 classes/nativesdk.bbclass |    5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
Koen Kooi - June 22, 2011, 9:27 a.m.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 22-06-11 11:13, Paul Eggleton wrote:
> Fixes "AttributeError: 'NoneType' object has no attribute 'split'" during
> parsing with bitbake master. We should not be calling explode_deps with
> None as the argument, so check for that before calling it.
> 
> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>

Looks good to me:

Acked-by: Koen Kooi <koen@dominion.thruhere.net>


> ---
>  classes/native.bbclass    |    5 ++++-
>  classes/nativesdk.bbclass |    5 ++++-
>  2 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/classes/native.bbclass b/classes/native.bbclass
> index 1e7a6ec..e9d48a3 100644
> --- a/classes/native.bbclass
> +++ b/classes/native.bbclass
> @@ -116,7 +116,10 @@ python __anonymous () {
>      if "native" in (bb.data.getVar('BBCLASSEXTEND', d, True) or ""):
>          pn = bb.data.getVar("PN", d, True)
>          depends = bb.data.getVar("DEPENDS_virtclass-native", d, True)
> -        deps = bb.utils.explode_deps(depends)
> +        if depends:
> +            deps = bb.utils.explode_deps(depends)
> +        else:
> +            deps = []
>          newdeps = []
>          for dep in deps:
>              if dep.endswith("-cross"):
> diff --git a/classes/nativesdk.bbclass b/classes/nativesdk.bbclass
> index 6689399..7a8f385 100644
> --- a/classes/nativesdk.bbclass
> +++ b/classes/nativesdk.bbclass
> @@ -59,7 +59,10 @@ OVERRIDES =. "virtclass-nativesdk:"
>  python __anonymous () {
>      pn = bb.data.getVar("PN", d, True)
>      depends = bb.data.getVar("DEPENDS_virtclass-nativesdk", d, True)
> -    deps = bb.utils.explode_deps(depends)
> +    if depends:
> +        deps = bb.utils.explode_deps(depends)
> +    else:
> +        deps = []
>      newdeps = []
>      for dep in deps:
>          if dep.endswith("-native") or dep.endswith("-cross"):

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iD8DBQFOAbV/MkyGM64RGpERAmpPAJ9OxqPqnYkcACLshJHBf2B2ta1FQgCfRadV
O+QuQwiB6rHxDcDeUkwydew=
=fWJI
-----END PGP SIGNATURE-----
Phil Blundell - June 22, 2011, 9:48 a.m.
On Wed, 2011-06-22 at 10:13 +0100, Paul Eggleton wrote:
>          depends = bb.data.getVar("DEPENDS_virtclass-native", d, True)
> -        deps = bb.utils.explode_deps(depends)
> +        if depends:
> +            deps = bb.utils.explode_deps(depends)
> +        else:
> +            deps = []

Can't you just make the first line be something like

depends = bb.data.getVar("DEPENDS_virtclass-native", d, True) or ""

?

p.

Patch

diff --git a/classes/native.bbclass b/classes/native.bbclass
index 1e7a6ec..e9d48a3 100644
--- a/classes/native.bbclass
+++ b/classes/native.bbclass
@@ -116,7 +116,10 @@  python __anonymous () {
     if "native" in (bb.data.getVar('BBCLASSEXTEND', d, True) or ""):
         pn = bb.data.getVar("PN", d, True)
         depends = bb.data.getVar("DEPENDS_virtclass-native", d, True)
-        deps = bb.utils.explode_deps(depends)
+        if depends:
+            deps = bb.utils.explode_deps(depends)
+        else:
+            deps = []
         newdeps = []
         for dep in deps:
             if dep.endswith("-cross"):
diff --git a/classes/nativesdk.bbclass b/classes/nativesdk.bbclass
index 6689399..7a8f385 100644
--- a/classes/nativesdk.bbclass
+++ b/classes/nativesdk.bbclass
@@ -59,7 +59,10 @@  OVERRIDES =. "virtclass-nativesdk:"
 python __anonymous () {
     pn = bb.data.getVar("PN", d, True)
     depends = bb.data.getVar("DEPENDS_virtclass-nativesdk", d, True)
-    deps = bb.utils.explode_deps(depends)
+    if depends:
+        deps = bb.utils.explode_deps(depends)
+    else:
+        deps = []
     newdeps = []
     for dep in deps:
         if dep.endswith("-native") or dep.endswith("-cross"):