@@ -176,6 +176,7 @@ def __init__(self, target, top_level_dirs = []):
176
176
self .processed_configs = {}
177
177
self .target = target if isinstance (target , str ) else target .name
178
178
self .target_labels = Target .get_target (self .target ).get_labels ()
179
+ self .target_instance = Target .get_target (self .target )
179
180
180
181
# Add one or more configuration files
181
182
def add_config_files (self , flist ):
@@ -221,6 +222,27 @@ def _process_config_and_overrides(self, data, params, unit_name, unit_kind):
221
222
for label , overrides in data .get ("target_overrides" , {}).items ():
222
223
# If the label is defined by the target or it has the special value "*", process the overrides
223
224
if (label == '*' ) or (label in self .target_labels ):
225
+ # Parse out cumulative attributes
226
+ for attr in Target ._Target__cumulative_attributes :
227
+ attrs = getattr (self .target_instance , attr )
228
+
229
+ if attr in overrides :
230
+ del attrs [:]
231
+ attrs .extend (overrides [attr ])
232
+ del overrides [attr ]
233
+
234
+ if attr + '_add' in overrides :
235
+ attrs .extend (overrides [attr + '_add' ])
236
+ del overrides [attr + '_add' ]
237
+
238
+ if attr + '_remove' in overrides :
239
+ for a in overrides [attr + '_remove' ]:
240
+ attrs .remove (a )
241
+ del overrides [attr + '_remove' ]
242
+
243
+ setattr (self .target_instance , attr , attrs )
244
+
245
+ # Consider the others as overrides
224
246
for name , v in overrides .items ():
225
247
# Get the full name of the parameter
226
248
full_name = ConfigParameter .get_full_name (name , unit_name , unit_kind , label )
0 commit comments