summaryrefslogtreecommitdiffstats
path: root/classes/machine-overrides-extender.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'classes/machine-overrides-extender.bbclass')
-rw-r--r--classes/machine-overrides-extender.bbclass29
1 files changed, 24 insertions, 5 deletions
diff --git a/classes/machine-overrides-extender.bbclass b/classes/machine-overrides-extender.bbclass
index 89ff99cf..f333a0fc 100644
--- a/classes/machine-overrides-extender.bbclass
+++ b/classes/machine-overrides-extender.bbclass
@@ -3,21 +3,40 @@
3# 3#
4# This allow to grouping of different settings for similar platforms. 4# This allow to grouping of different settings for similar platforms.
5# 5#
6# To use the class, specify, for example: 6# To indicate that a SoC contains following set of overrides, you can use:
7# 7#
8# MACHINEOVERRIDES_EXTENDER_soc = "group1:group2" 8# MACHINEOVERRIDES_EXTENDER_soc = "group1:group2"
9# 9#
10# Copyright 2016 (C) O.S. Systems Software LTDA. 10# However to indicate that an override replaces a set of other
11# overrides, you can use:
12#
13# MACHINEOVERRIDES_EXTENDER_FILTER_OUT_override = "group1 group2"
14#
15# Copyright 2016-2017 (C) O.S. Systems Software LTDA.
11 16
12def machine_overrides_extender(d): 17def machine_overrides_extender(d):
13 machine_overrides = (d.getVar('MACHINEOVERRIDES', True) or '').split(':') 18 machine_overrides = (d.getVar('MACHINEOVERRIDES', True) or '').split(':')
14 for o in machine_overrides: 19
15 extender = d.getVar('MACHINEOVERRIDES_EXTENDER_%s' % o, True) 20 # Gather the list of overrides to filter out
21 machine_overrides_filter_out = []
22 for override in machine_overrides:
23 machine_overrides_filter_out += (d.getVar('MACHINEOVERRIDES_EXTENDER_FILTER_OUT_%s' % override, True) or '').split()
24
25 # Drop any overrides of filter_out prior extending
26 machine_overrides = [o for o in machine_overrides if o not in machine_overrides_filter_out]
27
28 for override in machine_overrides:
29 extender = d.getVar('MACHINEOVERRIDES_EXTENDER_%s' % override, True)
30
16 if extender: 31 if extender:
17 extender = extender.split(':') 32 extender = extender.split(':')
33
34 # Drop any extension if in filter_out
35 extender = [e for e in extender if e not in machine_overrides_filter_out]
36
18 extender.reverse() 37 extender.reverse()
19 if not set(extender).issubset(set(machine_overrides)): 38 if not set(extender).issubset(set(machine_overrides)):
20 index = machine_overrides.index(o) 39 index = machine_overrides.index(override)
21 for e in extender: 40 for e in extender:
22 machine_overrides.insert(index, e) 41 machine_overrides.insert(index, e)
23 d.setVar('MACHINEOVERRIDES', ':'.join(machine_overrides)) 42 d.setVar('MACHINEOVERRIDES', ':'.join(machine_overrides))