[bitbake-devel,1/4] lib/bb/data: fix dependency handling for contains and multiple values

Submitted by Paul Eggleton on April 2, 2017, 11:19 p.m. | Patch ID: 138727


Message ID 969d16a740607be9477d19ed9ef04dbbeae2548a.1491175014.git.paul.eggleton@linux.intel.com
State New
Headers show

Commit Message

Paul Eggleton April 2, 2017, 11:19 p.m.
The code that determines variable dependencies uses the codeparser to
find references to "contains" type operations e.g. bb.utils.contains().
That function can take multiple items to check, and all specified items
have to be present. However this code didn't handle that - it assumed
that only one item would be specified and thus it was treating the
multiple items as a single item with spaces in between. Split the value
and check if all words are present in order to determine whether the
check is "set" or "unset".

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
 lib/bb/data.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/lib/bb/data.py b/lib/bb/data.py
index a85cb3a..0403754 100644
--- a/lib/bb/data.py
+++ b/lib/bb/data.py
@@ -296,11 +296,13 @@  def build_dependencies(key, keys, shelldeps, varflagsexcl, d):
             newvalue = ""
             for k in sorted(contains):
                 l = (d.getVar(k) or "").split()
-                for word in sorted(contains[k]):
-                    if word in l:
-                        newvalue += "\n%s{%s} = Set" %  (k, word)
+                for item in sorted(contains[k]):
+                    for word in item.split():
+                        if not word in l:
+                            newvalue += "\n%s{%s} = Unset" % (k, item)
+                            break
-                        newvalue += "\n%s{%s} = Unset" %  (k, word)
+                        newvalue += "\n%s{%s} = Set" % (k, item)
             if not newvalue:
                 return value
             if not value: