diff options
Diffstat (limited to 'bitbake/lib/bb/data_smart.py')
-rw-r--r-- | bitbake/lib/bb/data_smart.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py index 26f69d105a..75e22f9c45 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/lib/bb/data_smart.py | |||
@@ -312,6 +312,31 @@ class VariableHistory(object): | |||
312 | lines.append(line) | 312 | lines.append(line) |
313 | return lines | 313 | return lines |
314 | 314 | ||
315 | def get_variable_items_files(self, var, d): | ||
316 | """ | ||
317 | Use variable history to map items added to a list variable and | ||
318 | the files in which they were added. | ||
319 | """ | ||
320 | history = self.variable(var) | ||
321 | finalitems = (d.getVar(var, True) or '').split() | ||
322 | filemap = {} | ||
323 | isset = False | ||
324 | for event in history: | ||
325 | if 'flag' in event: | ||
326 | continue | ||
327 | if event['op'] == '_remove': | ||
328 | continue | ||
329 | if isset and event['op'] == 'set?': | ||
330 | continue | ||
331 | isset = True | ||
332 | items = d.expand(event['detail']).split() | ||
333 | for item in items: | ||
334 | # This is a little crude but is belt-and-braces to avoid us | ||
335 | # having to handle every possible operation type specifically | ||
336 | if item in finalitems and not item in filemap: | ||
337 | filemap[item] = event['file'] | ||
338 | return filemap | ||
339 | |||
315 | def del_var_history(self, var, f=None, line=None): | 340 | def del_var_history(self, var, f=None, line=None): |
316 | """If file f and line are not given, the entire history of var is deleted""" | 341 | """If file f and line are not given, the entire history of var is deleted""" |
317 | if var in self.variables: | 342 | if var in self.variables: |