diff options
author | Otavio Salvador <otavio@ossystems.com.br> | 2016-07-01 12:12:55 -0300 |
---|---|---|
committer | Otavio Salvador <otavio@ossystems.com.br> | 2016-09-08 11:24:24 -0300 |
commit | 9d378923a9fffda7b8794d250c4506169c4e9cae (patch) | |
tree | 7458a7149c9ba4a192d10ea86fcb8d08de8723cc /classes/machine-overrides-extender.bbclass | |
parent | eb4ea11270faebf565c07d5c21f3394a37bf5782 (diff) | |
download | meta-freescale-9d378923a9fffda7b8794d250c4506169c4e9cae.tar.gz |
machine-overrides-extender.bbclass: Automatically set extend the MACHINEOVERRIDES
This allow to grouping of different settings for similar platforms.
To use the class, specify, for example:
MACHINEOVERRIDES_EXTENDER_soc = "group1:group2"
Change-Id: I4a7dcd353b8bedf9d8f213827d7de768783c3d5d
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Diffstat (limited to 'classes/machine-overrides-extender.bbclass')
-rw-r--r-- | classes/machine-overrides-extender.bbclass | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/classes/machine-overrides-extender.bbclass b/classes/machine-overrides-extender.bbclass new file mode 100644 index 00000000..89ff99cf --- /dev/null +++ b/classes/machine-overrides-extender.bbclass | |||
@@ -0,0 +1,29 @@ | |||
1 | # -*- python -*- | ||
2 | # Automatically set extend the MACHINEOVERRIDES | ||
3 | # | ||
4 | # This allow to grouping of different settings for similar platforms. | ||
5 | # | ||
6 | # To use the class, specify, for example: | ||
7 | # | ||
8 | # MACHINEOVERRIDES_EXTENDER_soc = "group1:group2" | ||
9 | # | ||
10 | # Copyright 2016 (C) O.S. Systems Software LTDA. | ||
11 | |||
12 | def machine_overrides_extender(d): | ||
13 | machine_overrides = (d.getVar('MACHINEOVERRIDES', True) or '').split(':') | ||
14 | for o in machine_overrides: | ||
15 | extender = d.getVar('MACHINEOVERRIDES_EXTENDER_%s' % o, True) | ||
16 | if extender: | ||
17 | extender = extender.split(':') | ||
18 | extender.reverse() | ||
19 | if not set(extender).issubset(set(machine_overrides)): | ||
20 | index = machine_overrides.index(o) | ||
21 | for e in extender: | ||
22 | machine_overrides.insert(index, e) | ||
23 | d.setVar('MACHINEOVERRIDES', ':'.join(machine_overrides)) | ||
24 | |||
25 | python machine_overrides_extender_handler() { | ||
26 | machine_overrides_extender(e.data) | ||
27 | } | ||
28 | machine_overrides_extender_handler[eventmask] = "bb.event.ConfigParsed" | ||
29 | addhandler machine_overrides_extender_handler | ||