]> code.ossystems Code Review - openembedded-core.git/commitdiff
utils.py: Add a new extend_deps() to easily merge two dependency lists
authorMark Hatle <mhatle@windriver.com>
Fri, 20 Aug 2010 16:27:22 +0000 (09:27 -0700)
committerRichard Purdie <rpurdie@linux.intel.com>
Fri, 20 Aug 2010 22:46:08 +0000 (23:46 +0100)
Add a new extend_deps function to more easily merge two dependency lists.
This avoids adding duplicates, unless the value of the dependency is
different.

Signed-off-by: Mark Hatle <mhatle@windriver.com>
bitbake/lib/bb/utils.py

index 56577dabe1da02ecfb2d64a322fc9d2934eff515..c8f139b192b33cf22c8fb231307ace05bddc331a 100644 (file)
@@ -287,6 +287,17 @@ def join_deps(deps):
             result.append(dep)
     return ", ".join(result)
 
+def extend_deps(dest, src):
+    """
+    Extend the results from explode_dep_versions by appending all of the items
+    in the second list, avoiding duplicates.
+    """
+    for dep in src:
+        if dep not in dest:
+            dest[dep] = src[dep]
+        elif dest[dep] != src[dep]:
+            dest[dep] = src[dep]
+
 def _print_trace(body, line):
     """
     Print the Environment of a Text Body