summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-04-09 00:37:10 +0000
committerZac Medico <zmedico@gentoo.org>2008-04-09 00:37:10 +0000
commit8ec5af26b02cdc3613f2545e4c0be4eee158352e (patch)
treeab84ce947e9cdb4a52c026a2162121c205cb9454
parent54d03621bfb6bc13911a2461ad818aa744285fbe (diff)
downloadportage-8ec5af26b02cdc3613f2545e4c0be4eee158352e.tar.gz
portage-8ec5af26b02cdc3613f2545e4c0be4eee158352e.tar.bz2
portage-8ec5af26b02cdc3613f2545e4c0be4eee158352e.zip
Make depgraph.select_files() detect when a package name given as an argument
is ambiguous due to the existence of a new-style virtual with the same name (cpv_expand() will not always raise a ValueError in cases like this). svn path=/main/trunk/; revision=9762
-rw-r--r--pym/_emerge/__init__.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index 955ab8979..a2b651fe9 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -2204,6 +2204,13 @@ class depgraph(object):
cp not in e[0]:
raise
del e
+ virtual_x = expand_virtual_atom(x)
+ if virtual_x and \
+ self._have_new_virt(root_config.root,
+ portage.dep_getkey(virtual_x)) and \
+ virtual_x != mykey:
+ raise ValueError([portage.dep_getkey(virtual_x),
+ portage.dep_getkey(mykey)])
args.append(AtomArg(arg=x, atom=mykey,
root_config=root_config))
except ValueError, e:
@@ -5492,6 +5499,22 @@ def checkUpdatedNewsItems(portdb, vardb, NEWS_PATH, UNREAD_PATH, repo_id):
manager = NewsManager(portdb, vardb, NEWS_PATH, UNREAD_PATH)
return manager.getUnreadItems( repo_id, update=True )
+def expand_virtual_atom(x):
+ """
+ Take an atom without a category and insert virtual/ for the
+ category. This works correctly with atoms that have operators.
+
+ @param x: an atom without a category
+ @type x: String
+ @returns: the atom with virtual/ inserted for the category, or None
+ """
+ alphanum = re.search(r'\w', x)
+ if alphanum:
+ ret = x[:alphanum.start()] + "virtual/" + x[alphanum.start():]
+ else:
+ ret = None
+ return ret
+
def is_valid_package_atom(x):
if "/" not in x:
alphanum = re.search(r'\w', x)