Fix random python backtrace in mutlilib handling code.

newval is not defined in all cases. Set to None and check if it is set.

  File
"/local/foo/builds/x86/layers/openembedded-core/meta/classes/multilib_global.bbclass",
line 90, in preferred_ml_updates(d=<bb.data_smart.DataSmart object at
0xf6fd528c>):
                 if not d.getVar(newname, False):
    >                d.setVar(newname, localdata.expand(newval))
             # Avoid future variable key expansion
UnboundLocalError: local variable 'newval' referenced before assignment

(From OE-Core rev: 25ebd3bbc1f9f4b1b6147d98dd43690c3bf03ee7)

Signed-off-by: Jeremy Puhlman <jpuhlman@mvista.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Jeremy Puhlman 2016-08-01 09:02:54 -07:00 committed by Richard Purdie
parent 44ae8284d0
commit 8b5f369726
1 changed files with 2 additions and 1 deletions

View File

@ -72,6 +72,7 @@ def preferred_ml_updates(d):
pkg = pkg.replace("virtual/", "")
virt = "virtual/"
for p in prefixes:
newval = None
if pkg != "kernel":
newval = p + "-" + val
@ -86,7 +87,7 @@ def preferred_ml_updates(d):
# implement alternative multilib name
newname = localdata.expand("PREFERRED_PROVIDER_" + virt + p + "-" + pkg)
if not d.getVar(newname, False):
if not d.getVar(newname, False) and newval != None:
d.setVar(newname, localdata.expand(newval))
# Avoid future variable key expansion
provexp = d.expand(prov)