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: |
|
|
659 |
continue |
660 |
|
654 |
|
661 |
# Make sure the child's slot/subslot has changed. If it hasn't, |
655 |
inst_pkg, reinst_pkg = self._select_pkg_from_installed(root, slot_atom) |
662 |
# then another child has forced this rebuild. |
656 |
|
663 |
installed_pkg = self._select_pkg_from_installed(root, dep.child.slot_atom)[0] |
657 |
if inst_pkg is reinst_pkg or reinst_pkg is None: |
664 |
if installed_pkg and installed_pkg.slot == dep.child.slot and \ |
|
|
665 |
installed_pkg.sub_slot == dep.child.sub_slot: |
666 |
continue |
658 |
continue |
667 |
|
659 |
|
668 |
# The child has forced a rebuild of the parent |
660 |
deps = self._dynamic_config._slot_operator_deps.get((root, slot_atom), [])[:] |
669 |
forced_rebuilds.setdefault(root, {}).setdefault(dep.child, set()).add(dep.parent) |
661 |
|
|
|
662 |
# Generate pseudo-deps for any slot-operator deps of |
663 |
# inst_pkg. Its deps aren't in _slot_operator_deps |
664 |
# because it hasn't been added to the graph, but we |
665 |
# are interested in any rebuilds that it triggered. |
666 |
built_slot_op_atoms = set() |
667 |
if inst_pkg is not None: |
668 |
selected_atoms = self._select_atoms_probe( |
669 |
inst_pkg.root, inst_pkg) |
670 |
for atom in selected_atoms: |
671 |
if atom.slot_operator_built: |
672 |
built_slot_op_atoms.add(atom) |
673 |
|
674 |
if not built_slot_op_atoms: |
675 |
continue |
676 |
|
677 |
if built_slot_op_atoms and reinst_pkg is not None: |
678 |
for child in self._dynamic_config.digraph.child_nodes(reinst_pkg): |
679 |
if child.installed: |
680 |
continue |
681 |
|
682 |
for atom in built_slot_op_atoms: |
683 |
if atom.cp != child.cp: |
684 |
continue |
685 |
deps.append(Dependency(atom=atom, child=child, |
686 |
root=child.root, parent=reinst_pkg)) |
687 |
|
688 |
for dep in deps: |
689 |
if dep.child.installed: |
690 |
child = next((pkg for pkg in |
691 |
self._dynamic_config._package_tracker.match( |
692 |
dep.root, dep.child.slot_atom) |
693 |
if not pkg.installed), None) |
694 |
if child is None: |
695 |
continue |
696 |
|
697 |
else: |
698 |
child = dep.child |
699 |
|
700 |
# Make sure the child's slot/subslot has changed. If it hasn't, |
701 |
# then another child has forced this rebuild. |
702 |
installed_pkg = self._select_pkg_from_installed(dep.root, child.slot_atom)[0] |
703 |
if installed_pkg and installed_pkg.slot == child.slot and \ |
704 |
installed_pkg.sub_slot == child.sub_slot: |
705 |
continue |
706 |
|
707 |
if dep.parent.installed: |
708 |
parent = next((pkg for pkg in |
709 |
self._dynamic_config._package_tracker.match( |
710 |
dep.parent.root, dep.parent.slot_atom) |
711 |
if not pkg.installed), None) |
712 |
if parent is None: |
713 |
continue |
714 |
|
715 |
else: |
716 |
parent = dep.parent |
717 |
|
718 |
# The child has forced a rebuild of the parent |
719 |
forced_rebuilds.setdefault(root, {}).setdefault(child, set()).add(parent) |
670 |
|
720 |
|
671 |
if debug: |
721 |
if debug: |
672 |
writemsg_level("slot operator dependencies:\n", |
722 |
writemsg_level("slot operator dependencies:\n", |