summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/portage/util/__init__.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 961743ce2..5577a7ecd 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -231,11 +231,13 @@ def stack_dicts(dicts, incremental=0, incrementals=[], ignore_none=0):
final_dict[k] = v
return final_dict
-def stack_lists(lists, incremental=1, remember_source_file=False, warn_for_unmatched_removal=False):
+def stack_lists(lists, incremental=1, remember_source_file=False,
+ warn_for_unmatched_removal=False, strict_warn_for_unmatched_removal=False):
"""Stacks an array of list-types into one array. Optionally removing
distinct values using '-value' notation. Higher index is preferenced.
all elements must be hashable."""
+ matched_removals = set()
unmatched_removals = {}
new_list = {}
for sub_list in lists:
@@ -256,7 +258,11 @@ def stack_lists(lists, incremental=1, remember_source_file=False, warn_for_unmat
try:
new_list.pop(token[1:])
except KeyError:
- unmatched_removals.setdefault(source_file, set()).add(token)
+ if strict_warn_for_unmatched_removal or \
+ not (source_file and token_key in matched_removals):
+ unmatched_removals.setdefault(source_file, set()).add(token)
+ else:
+ matched_removals.add(token_key)
else:
new_list[token] = source_file
else: