summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-02-05 06:27:35 +0000
committerZac Medico <zmedico@gentoo.org>2007-02-05 06:27:35 +0000
commitbf32173b3aa1f47a6467561892938369133b2a4e (patch)
tree343ec493b2761acf7c749dabe3fe41d416bf99e3
parentc51752616495d8e5d521cb2ecb558813859365bb (diff)
downloadportage-bf32173b3aa1f47a6467561892938369133b2a4e.tar.gz
portage-bf32173b3aa1f47a6467561892938369133b2a4e.tar.bz2
portage-bf32173b3aa1f47a6467561892938369133b2a4e.zip
For bug #165382, don't raise a ValueError in cpv_expand() if there are only two matches and one of them is a virtual. Prefer the non-virtual instead.
svn path=/main/trunk/; revision=5890
-rw-r--r--pym/portage/__init__.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 43649ab45..913c70563 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -4446,8 +4446,18 @@ def cpv_expand(mycpv, mydb=None, use_cache=1, settings=None):
for x in settings.categories:
if mydb.cp_list(x+"/"+myp,use_cache=use_cache):
matches.append(x+"/"+myp)
- if (len(matches)>1):
- raise ValueError, matches
+ if len(matches) > 1:
+ if len(matches) == 2:
+ for x in matches:
+ if not x.startswith("virtual/"):
+ # Assume that the non-virtual is desired. This helps
+ # avoid the ValueError for invalid deps that come from
+ # installed packages (during reverse blocker detection,
+ # for example).
+ mykey = x
+ break
+ if mykey is None:
+ raise ValueError, matches
elif matches:
mykey=matches[0]