summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-09-07 04:23:26 +0000
committerZac Medico <zmedico@gentoo.org>2009-09-07 04:23:26 +0000
commit86a420552e2c940b789b187699896b2203f73153 (patch)
treece9522a6c9f863ee7f3ceaa80db2aabe3b5cf256 /pym
parent1dfce8bd9a1a64465efa30520ca0f62c58e6f03a (diff)
downloadportage-86a420552e2c940b789b187699896b2203f73153.tar.gz
portage-86a420552e2c940b789b187699896b2203f73153.tar.bz2
portage-86a420552e2c940b789b187699896b2203f73153.zip
Bug #283795 - Make dep_check() filter out expanded indirect virual deps after
they are no longer needed, in order to avoid distortion of the depgraph. svn path=/main/trunk/; revision=14212
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/__init__.py37
1 files changed, 26 insertions, 11 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 255b005bf..fff8fe45d 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -7550,7 +7550,7 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/",
"%s: %s '%s'" % (y[0], mycheck[1], depstring))
# pull in the new-style virtual
- mycheck[1].append(portage.dep.Atom("="+y[0]))
+ mycheck[1].append(dep.Atom('=' + cpv))
a.append(mycheck[1])
# Plain old-style virtuals. New-style virtuals are preferred.
if not pkgs:
@@ -7913,7 +7913,7 @@ def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None,
writemsg("mysplit2: %s\n" % (mysplit2), 1)
try:
- myzaps = dep_zapdeps(mysplit, mysplit2, myroot,
+ selected_atoms = dep_zapdeps(mysplit, mysplit2, myroot,
use_binaries=use_binaries, trees=trees)
except portage.exception.InvalidAtom, e:
if portage.dep._dep_check_strict:
@@ -7922,15 +7922,30 @@ def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None,
# the dependencies of an installed package.
return [0, _("Invalid atom: '%s'") % (e,)]
- mylist = flatten(myzaps)
- writemsg("myzaps: %s\n" % (myzaps), 1)
- writemsg("mylist: %s\n" % (mylist), 1)
- #remove duplicates
- mydict={}
- for x in mylist:
- mydict[x]=1
- writemsg("mydict: %s\n" % (mydict), 1)
- return [1,mydict.keys()]
+ # In order to optimize selection of virtual dependencies,
+ # _expand_new_virtuals() performs a lookahead on new-style
+ # virtuals, which causes expansion of indirect virtual deps.
+ # In order to avoid distorting the dependency graph, we want
+ # to discard the expanded indirect virtual deps after they
+ # are no longer needed, and return only the atom which
+ # corresponds to the virtual package which has been chosen
+ # to satisfy a direct dependency.
+ if ' ' not in depstring:
+ # The depgraph only passes in one virtual atom at at time
+ # here, since it delays evaluation of disjuctive deps.
+ try:
+ virt_atom = dep.Atom(depstring)
+ except exception.InvalidAtom:
+ pass
+ else:
+ # Note: selected_atoms[-1] comes from the following line
+ # inside _expand_new_virtuals():
+ # mycheck[1].append(dep.Atom('=' + cpv))
+ if virt_atom.cp.startswith('virtual/') and \
+ selected_atoms and selected_atoms[-1].cp == virt_atom.cp:
+ selected_atoms = [selected_atoms[-1]]
+
+ return [1, selected_atoms]
def dep_wordreduce(mydeplist,mysettings,mydbapi,mode,use_cache=1):
"Reduces the deplist to ones and zeros"