]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
bitbake: fetch2: Safer check for BB_ORIGENV datastore
authorLeonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
Tue, 3 May 2016 19:55:48 +0000 (14:55 -0500)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 6 May 2016 09:11:58 +0000 (10:11 +0100)
BB_ORIGENV value on the datastore can be NoneType thus raising an AttributeError
exception when calling the getVar method. To avoid this, a check is done before
accesing it.

[YOCTO #9567]

Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/bb/fetch2/__init__.py

index e8fbe89a3a452f9204967a9a3f6e9d3cf6fa5cae..6ef0c6fe7a43f5590203de2146afb9b8fa84032e 100644 (file)
@@ -813,8 +813,9 @@ def runfetchcmd(cmd, d, quiet=False, cleanup=None):
     if not cleanup:
         cleanup = []
 
+    origenv = d.getVar("BB_ORIGENV", False)
     for var in exportvars:
-        val = d.getVar(var, True) or d.getVar("BB_ORIGENV", False).getVar(var, True)
+        val = d.getVar(var, True) or (origenv and origenv.getVar(var, True))
         if val:
             cmd = 'export ' + var + '=\"%s\"; %s' % (val, cmd)