summaryrefslogtreecommitdiffstats
path: root/bin/emerge
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-04-09 07:29:34 +0000
committerZac Medico <zmedico@gentoo.org>2008-04-09 07:29:34 +0000
commit41ee55e300a512df549caadd7b598917ab23c3c2 (patch)
tree9e18d85b88780a5cecbe6e422e4a1f3c6658df3d /bin/emerge
parentbaa4d15aa184196604c496dc4fb091feacfcb165 (diff)
downloadportage-41ee55e300a512df549caadd7b598917ab23c3c2.tar.gz
portage-41ee55e300a512df549caadd7b598917ab23c3c2.tar.bz2
portage-41ee55e300a512df549caadd7b598917ab23c3c2.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). (trunk r9762) svn path=/main/branches/2.1.2/; revision=9767
Diffstat (limited to 'bin/emerge')
-rwxr-xr-xbin/emerge23
1 files changed, 23 insertions, 0 deletions
diff --git a/bin/emerge b/bin/emerge
index e14d7f283..a747dce3f 100755
--- a/bin/emerge
+++ b/bin/emerge
@@ -2343,6 +2343,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:
@@ -5493,6 +5500,22 @@ def chk_updated_cfg_files(target_root, config_protect):
" section of the " + bold("emerge")
print " "+yellow("*")+" man page to learn how to update config files."
+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)