aboutsummaryrefslogtreecommitdiff
blob: ca09d83acce04c82e9a0b98580af6c0108b86b35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

from _emerge.DepPriority import DepPriority
from _emerge.Package import Package

def _find_deep_system_runtime_deps(graph):
	deep_system_deps = set()
	node_stack = []
	for node in graph:
		if not isinstance(node, Package) or \
			node.operation == 'uninstall':
			continue
		if node.root_config.sets['system'].findAtomForPackage(node):
			node_stack.append(node)

	def ignore_priority(priority):
		"""
		Ignore non-runtime priorities.
		"""
		if isinstance(priority, DepPriority) and \
			(priority.runtime or priority.runtime_post):
			return False
		return True

	while node_stack:
		node = node_stack.pop()
		if node in deep_system_deps:
			continue
		deep_system_deps.add(node)
		for child in graph.child_nodes(node, ignore_priority=ignore_priority):
			if not isinstance(child, Package) or \
				child.operation == 'uninstall':
				continue
			node_stack.append(child)

	return deep_system_deps