Lines 8474-8485
class _dep_check_composite_db(dbapi):
Link Here
|
8474 |
ret.append(pkg) |
8474 |
ret.append(pkg) |
8475 |
|
8475 |
|
8476 |
if pkg is not None and \ |
8476 |
if pkg is not None and \ |
8477 |
atom.slot is None and \ |
8477 |
atom.sub_slot is None and \ |
8478 |
pkg.cp.startswith("virtual/") and \ |
8478 |
pkg.cp.startswith("virtual/") and \ |
8479 |
(("remove" not in self._depgraph._dynamic_config.myparams and |
8479 |
(("remove" not in self._depgraph._dynamic_config.myparams and |
8480 |
"--update" not in self._depgraph._frozen_config.myopts) or |
8480 |
"--update" not in self._depgraph._frozen_config.myopts) or |
8481 |
not ret or |
8481 |
not ret): |
8482 |
not self._depgraph._virt_deps_visible(pkg, ignore_use=True)): |
|
|
8483 |
# For new-style virtual lookahead that occurs inside dep_check() |
8482 |
# For new-style virtual lookahead that occurs inside dep_check() |
8484 |
# for bug #141118, examine all slots. This is needed so that newer |
8483 |
# for bug #141118, examine all slots. This is needed so that newer |
8485 |
# slots will not unnecessarily be pulled in when a satisfying lower |
8484 |
# slots will not unnecessarily be pulled in when a satisfying lower |
Lines 8487-8520
class _dep_check_composite_db(dbapi):
Link Here
|
8487 |
# satisfied via gcj-jdk then there's no need to pull in a newer |
8486 |
# satisfied via gcj-jdk then there's no need to pull in a newer |
8488 |
# slot to satisfy a virtual/jdk dependency, unless --update is |
8487 |
# slot to satisfy a virtual/jdk dependency, unless --update is |
8489 |
# enabled. |
8488 |
# enabled. |
8490 |
slots = set() |
8489 |
sub_slots = set() |
8491 |
slots.add(pkg.slot) |
8490 |
resolved_sub_slots = set() |
8492 |
for virt_pkg in self._depgraph._iter_match_pkgs_any( |
8491 |
for virt_pkg in self._depgraph._iter_match_pkgs_any( |
8493 |
self._depgraph._frozen_config.roots[self._root], atom): |
8492 |
self._depgraph._frozen_config.roots[self._root], atom): |
8494 |
if virt_pkg.cp != pkg.cp: |
8493 |
if virt_pkg.cp != pkg.cp: |
8495 |
continue |
8494 |
continue |
8496 |
slots.add(virt_pkg.slot) |
8495 |
sub_slots.add((virt_pkg.slot, virt_pkg.sub_slot)) |
|
|
8496 |
|
8497 |
sub_slot_key = (pkg.slot, pkg.sub_slot) |
8498 |
if ret: |
8499 |
# We've added pkg to ret already, and only one package |
8500 |
# per slot/sub_slot is desired here. |
8501 |
sub_slots.discard(sub_slot_key) |
8502 |
resolved_sub_slots.add(sub_slot_key) |
8503 |
else: |
8504 |
sub_slots.add(sub_slot_key) |
8497 |
|
8505 |
|
8498 |
slots.remove(pkg.slot) |
8506 |
while sub_slots: |
8499 |
while slots: |
8507 |
slot, sub_slot = sub_slots.pop() |
8500 |
slot_atom = atom.with_slot(slots.pop()) |
8508 |
slot_atom = atom.with_slot("%s/%s" % (slot, sub_slot)) |
8501 |
pkg, existing = self._depgraph._select_package( |
8509 |
pkg, existing = self._depgraph._select_package( |
8502 |
self._root, slot_atom) |
8510 |
self._root, slot_atom) |
8503 |
if not pkg: |
8511 |
if not pkg: |
8504 |
continue |
8512 |
continue |
8505 |
if not self._visible(pkg, atom_set): |
8513 |
if not self._visible(pkg, atom_set, |
8506 |
continue |
8514 |
avoid_slot_conflict=False): |
|
|
8515 |
# Try to force a virtual update to be pulled in |
8516 |
# when appropriate for bug #526160. |
8517 |
selected = pkg |
8518 |
for candidate in \ |
8519 |
self._iter_virt_update(pkg, atom_set): |
8520 |
|
8521 |
if candidate.slot != slot: |
8522 |
continue |
8523 |
|
8524 |
if (candidate.slot, candidate.sub_slot) in \ |
8525 |
resolved_sub_slots: |
8526 |
continue |
8527 |
|
8528 |
if selected is None or \ |
8529 |
selected < candidate: |
8530 |
selected = candidate |
8531 |
|
8532 |
if selected is pkg: |
8533 |
continue |
8534 |
pkg = selected |
8535 |
|
8536 |
resolved_sub_slots.add((pkg.slot, pkg.sub_slot)) |
8507 |
ret.append(pkg) |
8537 |
ret.append(pkg) |
8508 |
|
8538 |
|
8509 |
if len(ret) > 1: |
8539 |
if len(ret) > 1: |
8510 |
ret.sort() |
8540 |
ret = sorted(set(ret)) |
8511 |
|
8541 |
|
8512 |
self._match_cache[cache_key] = ret |
8542 |
self._match_cache[cache_key] = ret |
8513 |
for pkg in ret: |
8543 |
for pkg in ret: |
8514 |
self._cpv_pkg_map[pkg.cpv] = pkg |
8544 |
self._cpv_pkg_map[pkg.cpv] = pkg |
8515 |
return ret[:] |
8545 |
return ret[:] |
8516 |
|
8546 |
|
8517 |
def _visible(self, pkg, atom_set): |
8547 |
def _visible(self, pkg, atom_set, avoid_slot_conflict=True, |
|
|
8548 |
probe_virt_update=True): |
8518 |
if pkg.installed and not self._depgraph._want_installed_pkg(pkg): |
8549 |
if pkg.installed and not self._depgraph._want_installed_pkg(pkg): |
8519 |
return False |
8550 |
return False |
8520 |
if pkg.installed and \ |
8551 |
if pkg.installed and \ |
Lines 8536-8557
class _dep_check_composite_db(dbapi):
Link Here
|
8536 |
return False |
8567 |
return False |
8537 |
|
8568 |
|
8538 |
if pkg.cp.startswith("virtual/"): |
8569 |
if pkg.cp.startswith("virtual/"): |
8539 |
# Force virtual updates to be pulled in when appropriate |
8570 |
|
8540 |
# for bug #526160. |
8571 |
if not self._depgraph._virt_deps_visible( |
8541 |
want_update = False |
8572 |
pkg, ignore_use=True): |
8542 |
if self._depgraph._select_atoms_parent is not None: |
8573 |
return False |
8543 |
want_update = \ |
8574 |
|
8544 |
self._depgraph._want_update_pkg( |
8575 |
if probe_virt_update and \ |
8545 |
self._depgraph._select_atoms_parent, pkg) |
8576 |
self._have_virt_update(pkg, atom_set): |
8546 |
|
8577 |
# Force virtual updates to be pulled in when appropriate |
8547 |
if want_update: |
8578 |
# for bug #526160. |
8548 |
for new_child in self._depgraph._iter_similar_available( |
8579 |
return False |
8549 |
pkg, next(iter(atom_set))): |
8580 |
|
8550 |
if not self._depgraph._virt_deps_visible( |
8581 |
if not avoid_slot_conflict: |
8551 |
new_child, ignore_use=True): |
8582 |
# This is useful when trying to pull in virtual updates, |
8552 |
continue |
8583 |
# since we don't want another instance that was previously |
8553 |
if pkg < new_child: |
8584 |
# pulled in to mask an update that we're trying to pull |
8554 |
return False |
8585 |
# into the same slot. |
|
|
8586 |
return True |
8555 |
|
8587 |
|
8556 |
in_graph = next(self._depgraph._dynamic_config._package_tracker.match( |
8588 |
in_graph = next(self._depgraph._dynamic_config._package_tracker.match( |
8557 |
self._root, pkg.slot_atom, installed=False), None) |
8589 |
self._root, pkg.slot_atom, installed=False), None) |
Lines 8578-8583
class _dep_check_composite_db(dbapi):
Link Here
|
8578 |
return False |
8610 |
return False |
8579 |
return True |
8611 |
return True |
8580 |
|
8612 |
|
|
|
8613 |
def _iter_virt_update(self, pkg, atom_set): |
8614 |
|
8615 |
if self._depgraph._select_atoms_parent is not None and \ |
8616 |
self._depgraph._want_update_pkg( |
8617 |
self._depgraph._select_atoms_parent, pkg): |
8618 |
|
8619 |
for new_child in self._depgraph._iter_similar_available( |
8620 |
pkg, next(iter(atom_set))): |
8621 |
|
8622 |
if not self._depgraph._virt_deps_visible( |
8623 |
new_child, ignore_use=True): |
8624 |
continue |
8625 |
|
8626 |
if not self._visible(new_child, atom_set, |
8627 |
avoid_slot_conflict=False, |
8628 |
probe_virt_update=False): |
8629 |
continue |
8630 |
|
8631 |
yield new_child |
8632 |
|
8633 |
def _have_virt_update(self, pkg, atom_set): |
8634 |
|
8635 |
for new_child in self._iter_virt_update(pkg, atom_set): |
8636 |
if pkg < new_child: |
8637 |
return True |
8638 |
|
8639 |
return False |
8640 |
|
8581 |
def aux_get(self, cpv, wants): |
8641 |
def aux_get(self, cpv, wants): |
8582 |
metadata = self._cpv_pkg_map[cpv]._metadata |
8642 |
metadata = self._cpv_pkg_map[cpv]._metadata |
8583 |
return [metadata.get(x, "") for x in wants] |
8643 |
return [metadata.get(x, "") for x in wants] |