diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-02-05 20:45:23 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-02-05 20:45:23 +0000 |
commit | 7be94181e5d5d7e88f0e50912512203d36a8aaf5 (patch) | |
tree | dde419bcd50f6defe3611a0c68a3a93c4d2af95e | |
parent | efe12d3c985caa4d41db0349fb1e0cdb76a94980 (diff) | |
download | portage-7be94181e5d5d7e88f0e50912512203d36a8aaf5.tar.gz portage-7be94181e5d5d7e88f0e50912512203d36a8aaf5.tar.bz2 portage-7be94181e5d5d7e88f0e50912512203d36a8aaf5.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. (trunk r5889:5891)
svn path=/main/branches/2.1.2/; revision=5896
-rw-r--r-- | pym/portage.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/pym/portage.py b/pym/portage.py index d9b283e94..5c4389c9c 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -4434,8 +4434,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] |