summaryrefslogtreecommitdiffstats
path: root/classes/machine-overrides-extender.bbclass
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2017-03-23 11:54:46 -0300
committerOtavio Salvador <otavio@ossystems.com.br>2017-03-27 11:52:44 -0300
commit7dc760ad8b3b8d0f8562d60b9a60114f332abbea (patch)
treed58ad5f8173eb9e4ee8cd8bdbe8377ecbb44d973 /classes/machine-overrides-extender.bbclass
parent4d1bcc052b7565235f1d66af459282089bfde2bf (diff)
downloadmeta-freescale-7dc760ad8b3b8d0f8562d60b9a60114f332abbea.tar.gz
machine-overrides-extender.bbclass: Add filter out support
The allow easier enablement of mainline BSP support, we need to allow for specific overrides to be filtered out, before and during the extending process. The new MACHINEOVERRIDES_EXTENDER_FILTER_OUT variable does exactly this and will be used in a subsequent commit to enable the 'use-mainline-bsp' override. Change-Id: Ieaec9d5eb27ccc73b7b0097cb365c519978bd080 Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
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))