diff options
Diffstat (limited to 'meta')
-rw-r--r-- | meta/lib/oe/utils.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py index b8224de20b..7173e106f5 100644 --- a/meta/lib/oe/utils.py +++ b/meta/lib/oe/utils.py | |||
@@ -55,6 +55,21 @@ def both_contain(variable1, variable2, checkvalue, d): | |||
55 | else: | 55 | else: |
56 | return "" | 56 | return "" |
57 | 57 | ||
58 | def set_intersect(variable1, variable2, d): | ||
59 | """ | ||
60 | Expand both variables, interpret them as lists of strings, and return the | ||
61 | intersection as a flattened string. | ||
62 | |||
63 | For example: | ||
64 | s1 = "a b c" | ||
65 | s2 = "b c d" | ||
66 | s3 = set_intersect(s1, s2) | ||
67 | => s3 = "b c" | ||
68 | """ | ||
69 | val1 = set(d.getVar(variable1, True).split()) | ||
70 | val2 = set(d.getVar(variable2, True).split()) | ||
71 | return " ".join(val1 & val2) | ||
72 | |||
58 | def prune_suffix(var, suffixes, d): | 73 | def prune_suffix(var, suffixes, d): |
59 | # See if var ends with any of the suffixes listed and | 74 | # See if var ends with any of the suffixes listed and |
60 | # remove it if found | 75 | # remove it if found |