summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/utils.py
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2015-05-22 12:30:26 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-05-24 07:19:19 +0100
commita60aeca3f50edead5445aa83fb9cf0b9cc3e9a6a (patch)
treef8a512f8103b04b01319c1927fd2cc82a68c035c /meta/lib/oe/utils.py
parenta497998f9ea2533c3ac19afcc05e4628c4decfd7 (diff)
downloadpoky-a60aeca3f50edead5445aa83fb9cf0b9cc3e9a6a.tar.gz
utils: add helper to perform the intersection of two string lists
Useful for e.g. generating a COMBINED_FEATURES list from DISTRO_FEATURES and MACHINE_FEATURES. (From OE-Core rev: c5b6f672b88f5f42fe0bd59d28104b8dc9ee9a6e) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/utils.py')
-rw-r--r--meta/lib/oe/utils.py15
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
58def 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
58def prune_suffix(var, suffixes, d): 73def 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