]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
data.py: Add a warning when expandKeys overwrites an existing key
authorMark Hatle <mark.hatle@windriver.com>
Tue, 19 Mar 2013 20:28:51 +0000 (15:28 -0500)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 10 Apr 2013 12:06:30 +0000 (13:06 +0100)
When two variables are defined as:

${var} = "bar"
foo = "foobar"

The value of 'foo' when ${var} == foo becomes indeterminate.  We
want to warn a user when this situation has been encountered so they
can take corrective actions.

In the above example usually foo == bar, unless multilibs are enabled.
Then ml-foo = "ml-foobar".

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/bb/data.py

index 7047f489349a8c5f83d1dd6faf56ce9275ddb973..110666ca2bc12c84e03458f2f5920070d3401be3 100644 (file)
@@ -158,6 +158,11 @@ def expandKeys(alterdata, readdata = None):
 
     for key in todolist:
         ekey = todolist[key]
+        if ekey in keys(alterdata):
+            val = alterdata.getVar(key, 0)
+            newval = alterdata.getVar(ekey, 0)
+            if val is not None and newval is not None:
+                bb.warn("Variable key %s (%s) replaces original key %s (%s)." % (key, val, ekey, newval))
         alterdata.renameVar(key, ekey)
 
 def inheritFromOS(d, savedenv, permitted):