summaryrefslogtreecommitdiffstats
path: root/pym/portage/util/__init__.py
diff options
context:
space:
mode:
authorSebastian Luther <SebastianLuther@gmx.de>2010-09-25 16:20:48 +0200
committerZac Medico <zmedico@gentoo.org>2010-09-26 23:50:15 -0700
commit03e4da855927aa69687acad97246be50096b6b00 (patch)
treec719ef4cba20b94ae5127b388324453c116bcbba /pym/portage/util/__init__.py
parent59ac8965f0a914123c7f4f570721070c59ce39d8 (diff)
downloadportage-03e4da855927aa69687acad97246be50096b6b00.tar.gz
portage-03e4da855927aa69687acad97246be50096b6b00.tar.bz2
portage-03e4da855927aa69687acad97246be50096b6b00.zip
Improved profiles/p.mask handling
It's now possible for an repo to revert masks from the master for its own packages.
Diffstat (limited to 'pym/portage/util/__init__.py')
-rw-r--r--pym/portage/util/__init__.py35
1 files changed, 31 insertions, 4 deletions
diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 0b0e0435e..0c2dc3382 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -231,8 +231,19 @@ def stack_dicts(dicts, incremental=0, incrementals=[], ignore_none=0):
final_dict[k] = v
return final_dict
+def append_repo(atom_list, repo_name, remember_source_file=False):
+ """
+ Takes a list of valid atoms without repo spec and appends ::repo_name.
+ """
+ if remember_source_file:
+ return [(Atom(atom + "::" + repo_name, allow_wildcard=True, allow_repo=True), source) \
+ for atom, source in atom_list]
+ else:
+ return [Atom(atom + "::" + repo_name, allow_wildcard=True, allow_repo=True) \
+ for atom in atom_list]
+
def stack_lists(lists, incremental=1, remember_source_file=False,
- warn_for_unmatched_removal=False, strict_warn_for_unmatched_removal=False):
+ warn_for_unmatched_removal=False, strict_warn_for_unmatched_removal=False, ignore_repo=False):
"""Stacks an array of list-types into one array. Optionally removing
distinct values using '-value' notation. Higher index is preferenced.
@@ -255,9 +266,25 @@ def stack_lists(lists, incremental=1, remember_source_file=False,
if token == "-*":
new_list.clear()
elif token[:1] == '-':
- try:
- new_list.pop(token[1:])
- except KeyError:
+ matched = False
+ if ignore_repo and not "::" in token:
+ #Let -cat/pkg remove cat/pkg::repo.
+ to_be_removed = []
+ for atom in new_list:
+ if atom == token[1:] or atom.split("::")[0] == token[1:]:
+ to_be_removed.append(atom)
+ if to_be_removed:
+ matched = True
+ for atom in to_be_removed:
+ new_list.pop(atom)
+ else:
+ try:
+ new_list.pop(token[1:])
+ matched = True
+ except KeyError:
+ pass
+
+ if not matched:
if source_file and \
(strict_warn_for_unmatched_removal or \
token_key not in matched_removals):