Lines 647-672
class depgraph(object):
Link Here
|
647 |
# Go through all slot operator deps and check if one of these deps |
647 |
# Go through all slot operator deps and check if one of these deps |
648 |
# has a parent that is matched by one of the atoms from above. |
648 |
# has a parent that is matched by one of the atoms from above. |
649 |
forced_rebuilds = {} |
649 |
forced_rebuilds = {} |
650 |
for (root, slot_atom), deps in self._dynamic_config._slot_operator_deps.items(): |
|
|
651 |
rebuild_atoms = atoms.get(root, set()) |
652 |
|
650 |
|
653 |
for dep in deps: |
651 |
for root, rebuild_atoms in atoms.items(): |
654 |
if not isinstance(dep.parent, Package): |
|
|
655 |
continue |
656 |
|
652 |
|
657 |
if dep.parent.installed or dep.child.installed or \ |
653 |
for slot_atom in rebuild_atoms: |
658 |
dep.parent.slot_atom not in rebuild_atoms: |
654 |
|
659 |
continue |
655 |
inst_pkg, reinst_pkg = \ |
|
|
656 |
self._select_pkg_from_installed(root, slot_atom) |
660 |
|
657 |
|
661 |
# Make sure the child's slot/subslot has changed. If it hasn't, |
658 |
if inst_pkg is reinst_pkg or reinst_pkg is None: |
662 |
# then another child has forced this rebuild. |
|
|
663 |
installed_pkg = self._select_pkg_from_installed(root, dep.child.slot_atom)[0] |
664 |
if installed_pkg and installed_pkg.slot == dep.child.slot and \ |
665 |
installed_pkg.sub_slot == dep.child.sub_slot: |
666 |
continue |
659 |
continue |
667 |
|
660 |
|
668 |
# The child has forced a rebuild of the parent |
661 |
# Generate pseudo-deps for any slot-operator deps of |
669 |
forced_rebuilds.setdefault(root, {}).setdefault(dep.child, set()).add(dep.parent) |
662 |
# inst_pkg. Its deps aren't in _slot_operator_deps |
|
|
663 |
# because it hasn't been added to the graph, but we |
664 |
# are interested in any rebuilds that it triggered. |
665 |
built_slot_op_atoms = [] |
666 |
if inst_pkg is not None: |
667 |
selected_atoms = self._select_atoms_probe( |
668 |
inst_pkg.root, inst_pkg) |
669 |
for atom in selected_atoms: |
670 |
if atom.slot_operator_built: |
671 |
built_slot_op_atoms.append(atom) |
672 |
|
673 |
if not built_slot_op_atoms: |
674 |
continue |
675 |
|
676 |
# Use a cloned list, since we may append to it below. |
677 |
deps = self._dynamic_config._slot_operator_deps.get( |
678 |
(root, slot_atom), [])[:] |
679 |
|
680 |
if built_slot_op_atoms and reinst_pkg is not None: |
681 |
for child in self._dynamic_config.digraph.child_nodes( |
682 |
reinst_pkg): |
683 |
|
684 |
if child.installed: |
685 |
continue |
686 |
|
687 |
for atom in built_slot_op_atoms: |
688 |
# NOTE: Since atom comes from inst_pkg, and |
689 |
# reinst_pkg is the replacement parent, there's |
690 |
# no guarantee that atom will completely match |
691 |
# child. So, simply use atom.cp and atom.slot |
692 |
# for matching. |
693 |
if atom.cp != child.cp: |
694 |
continue |
695 |
if atom.slot and atom.slot != child.slot: |
696 |
continue |
697 |
deps.append(Dependency(atom=atom, child=child, |
698 |
root=child.root, parent=reinst_pkg)) |
699 |
|
700 |
for dep in deps: |
701 |
if dep.child.installed: |
702 |
# Find the replacement child. |
703 |
child = next((pkg for pkg in |
704 |
self._dynamic_config._package_tracker.match( |
705 |
dep.root, dep.child.slot_atom) |
706 |
if not pkg.installed), None) |
707 |
|
708 |
if child is None: |
709 |
continue |
710 |
|
711 |
inst_child = dep.child.installed |
712 |
|
713 |
else: |
714 |
child = dep.child |
715 |
inst_child = self._select_pkg_from_installed( |
716 |
child.root, child.slot_atom)[0] |
717 |
|
718 |
# Make sure the child's slot/subslot has changed. If it |
719 |
# hasn't, then another child has forced this rebuild. |
720 |
if inst_child and inst_child.slot == child.slot and \ |
721 |
inst_child.sub_slot == child.sub_slot: |
722 |
continue |
723 |
|
724 |
if dep.parent.installed: |
725 |
# Find the replacement parent. |
726 |
parent = next((pkg for pkg in |
727 |
self._dynamic_config._package_tracker.match( |
728 |
dep.parent.root, dep.parent.slot_atom) |
729 |
if not pkg.installed), None) |
730 |
|
731 |
if parent is None: |
732 |
continue |
733 |
|
734 |
else: |
735 |
parent = dep.parent |
736 |
|
737 |
# The child has forced a rebuild of the parent |
738 |
forced_rebuilds.setdefault(root, {} |
739 |
).setdefault(child, set()).add(parent) |
670 |
|
740 |
|
671 |
if debug: |
741 |
if debug: |
672 |
writemsg_level("slot operator dependencies:\n", |
742 |
writemsg_level("slot operator dependencies:\n", |