summaryrefslogtreecommitdiffstats
path: root/pym/portage.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-04-15 06:32:24 +0000
committerZac Medico <zmedico@gentoo.org>2008-04-15 06:32:24 +0000
commiteb4c6ccebbd23f958679478fdafc847854330ba6 (patch)
treec0ece356f95a0f65ee31b3a0c707a47b905f6f51 /pym/portage.py
parent7e7449b67bc628f57d5fa5dcbc4ddf8a269b8dd3 (diff)
downloadportage-eb4c6ccebbd23f958679478fdafc847854330ba6.tar.gz
portage-eb4c6ccebbd23f958679478fdafc847854330ba6.tar.bz2
portage-eb4c6ccebbd23f958679478fdafc847854330ba6.zip
Add support to depgraph._select_atoms() to take a "parent" parameter
and use that to try and avoid unresolvable direct circular dependencies when necessary. Also, make atom selection more consistent with the graph to solve some cases of bug #1343. This improves the fix from bug #141118 to work in cases when a virtual is not yet installed but it has been pulled into the graph. For example, see the case of Bug #163801#c17, where we want kaffe to satisfy virtual/jdk-1.4 without an extra jvm being pulled in unnecessarily. (trunk r9901) svn path=/main/branches/2.1.2/; revision=9903
Diffstat (limited to 'pym/portage.py')
-rw-r--r--pym/portage.py39
1 files changed, 38 insertions, 1 deletions
diff --git a/pym/portage.py b/pym/portage.py
index 063acc5f7..3bb6451ee 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -5464,6 +5464,8 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
other = []
# Alias the trees we'll be checking availability against
+ parent = trees[myroot].get("parent")
+ graph_db = trees[myroot].get("graph_db")
vardb = None
if "vartree" in trees[myroot]:
vardb = trees[myroot]["vartree"].dbapi
@@ -5525,8 +5527,43 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
preferred.append(this_choice)
else:
preferred_any_slot.append(this_choice)
- else:
+ elif graph_db is None:
possible_upgrades.append(this_choice)
+ else:
+ all_in_graph = True
+ for slot_atom in versions:
+ # New-style virtuals have zero cost to install.
+ if not graph_db.match(slot_atom) and \
+ not slot_atom.startswith("virtual/"):
+ all_in_graph = False
+ break
+ if all_in_graph:
+ if parent is None:
+ preferred.append(this_choice)
+ else:
+ # Check if the atom would result in a direct circular
+ # dependency and try to avoid that if it seems likely
+ # to be unresolvable.
+ cpv_slot_list = [parent.cpv_slot]
+ circular_atom = None
+ for atom in atoms:
+ if "!" == atom[:1]:
+ continue
+ if vardb.match(atom):
+ # If the atom is satisfied by an installed
+ # version then it's not a circular dep.
+ continue
+ if dep_getkey(atom) != parent.cp:
+ continue
+ if match_from_list(atom, cpv_slot_list):
+ circular_atom = atom
+ break
+ if circular_atom is None:
+ preferred.append(this_choice)
+ else:
+ other.append(this_choice)
+ else:
+ possible_upgrades.append(this_choice)
else:
other.append(this_choice)