diff options
author | Zac Medico <zmedico@gentoo.org> | 2011-04-30 13:38:00 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-04-30 13:38:00 -0700 |
commit | d6080afba243844083838b5779afbe0ebbb81626 (patch) | |
tree | 72f7586990af61395e2a2278b4194a15a0429940 | |
parent | 15c7e8bd8c6ee7f57d18de6fb8f931059200dd4c (diff) | |
download | portage-d6080afba243844083838b5779afbe0ebbb81626.tar.gz portage-d6080afba243844083838b5779afbe0ebbb81626.tar.bz2 portage-d6080afba243844083838b5779afbe0ebbb81626.zip |
depgraph: migrate implicit libc deps from Sched
Now all the virtual/libc handling is done by the depgraph, which
will be helpful when fixing bug #364681.
-rw-r--r-- | pym/_emerge/Scheduler.py | 65 | ||||
-rw-r--r-- | pym/_emerge/depgraph.py | 65 |
2 files changed, 65 insertions, 65 deletions
diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py index dfccbc407..df13b6b84 100644 --- a/pym/_emerge/Scheduler.py +++ b/pym/_emerge/Scheduler.py @@ -22,7 +22,6 @@ from portage import os from portage import _encodings from portage import _unicode_decode, _unicode_encode from portage.cache.mappings import slot_dict_class -from portage.const import LIBC_PACKAGE_ATOM from portage.elog.messages import eerror from portage.localization import _ from portage.output import colorize, create_color_func, red @@ -476,7 +475,6 @@ class Scheduler(PollScheduler): self._find_system_deps() self._prune_digraph() self._prevent_builddir_collisions() - self._implicit_libc_deps() if '--debug' in self.myopts: writemsg("\nscheduler digraph:\n\n", noiselevel=-1) self._digraph.debug_print() @@ -542,69 +540,6 @@ class Scheduler(PollScheduler): priority=DepPriority(buildtime=True)) cpv_map[pkg.cpv].append(pkg) - def _implicit_libc_deps(self): - """ - Create implicit dependencies on libc, in order to ensure that libc - is installed as early as possible (see bug #303567). If the merge - list contains both a new-style virtual and an old-style PROVIDE - virtual, the new-style virtual is used. - """ - implicit_libc_roots = set([self._running_root.root]) - libc_set = InternalPackageSet([LIBC_PACKAGE_ATOM]) - norm_libc_pkgs = {} - virt_libc_pkgs = {} - for pkg in self._mergelist: - if not isinstance(pkg, Package): - # a satisfied blocker - continue - if pkg.installed: - continue - if pkg.root in implicit_libc_roots and \ - pkg.operation == 'merge': - if libc_set.findAtomForPackage(pkg): - if pkg.category == 'virtual': - d = virt_libc_pkgs - else: - d = norm_libc_pkgs - if pkg.root in d: - raise AssertionError( - "found 2 libc matches: %s and %s" % \ - (d[pkg.root], pkg)) - d[pkg.root] = pkg - - # Prefer new-style virtuals over old-style PROVIDE virtuals. - libc_pkg_map = norm_libc_pkgs.copy() - libc_pkg_map.update(virt_libc_pkgs) - - # Only add a dep when the version changes. - for libc_pkg in list(libc_pkg_map.values()): - if libc_pkg.root_config.trees['vartree'].dbapi.cpv_exists( - libc_pkg.cpv): - del libc_pkg_map[pkg.root] - - if not libc_pkg_map: - return - - libc_pkgs = set(libc_pkg_map.values()) - earlier_libc_pkgs = set() - - for pkg in self._mergelist: - if not isinstance(pkg, Package): - # a satisfied blocker - continue - if pkg.installed: - continue - if pkg.root in implicit_libc_roots and \ - pkg.operation == 'merge': - if pkg in libc_pkgs: - earlier_libc_pkgs.add(pkg) - else: - my_libc = libc_pkg_map.get(pkg.root) - if my_libc is not None and \ - my_libc in earlier_libc_pkgs: - self._digraph.add(my_libc, pkg, - priority=DepPriority(buildtime=True)) - class _pkg_failure(portage.exception.PortageException): """ An instance of this class is raised by unmerge() when diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 7db5ae3f3..73b81e1d1 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -4203,6 +4203,69 @@ class depgraph(object): retlist.reverse() return retlist + def _implicit_libc_deps(self, mergelist, graph): + """ + Create implicit dependencies on libc, in order to ensure that libc + is installed as early as possible (see bug #303567). If the merge + list contains both a new-style virtual and an old-style PROVIDE + virtual, the new-style virtual is used. + """ + implicit_libc_roots = set([self._frozen_config._running_root.root]) + libc_set = InternalPackageSet([portage.const.LIBC_PACKAGE_ATOM]) + norm_libc_pkgs = {} + virt_libc_pkgs = {} + for pkg in mergelist: + if not isinstance(pkg, Package): + # a satisfied blocker + continue + if pkg.installed: + continue + if pkg.root in implicit_libc_roots and \ + pkg.operation == 'merge': + if libc_set.findAtomForPackage(pkg): + if pkg.category == 'virtual': + d = virt_libc_pkgs + else: + d = norm_libc_pkgs + if pkg.root in d: + raise AssertionError( + "found 2 libc matches: %s and %s" % \ + (d[pkg.root], pkg)) + d[pkg.root] = pkg + + # Prefer new-style virtuals over old-style PROVIDE virtuals. + libc_pkg_map = norm_libc_pkgs.copy() + libc_pkg_map.update(virt_libc_pkgs) + + # Only add a dep when the version changes. + for libc_pkg in list(libc_pkg_map.values()): + if libc_pkg.root_config.trees['vartree'].dbapi.cpv_exists( + libc_pkg.cpv): + del libc_pkg_map[pkg.root] + + if not libc_pkg_map: + return + + libc_pkgs = set(libc_pkg_map.values()) + earlier_libc_pkgs = set() + + for pkg in mergelist: + if not isinstance(pkg, Package): + # a satisfied blocker + continue + if pkg.installed: + continue + if pkg.root in implicit_libc_roots and \ + pkg.operation == 'merge': + if pkg in libc_pkgs: + earlier_libc_pkgs.add(pkg) + else: + my_libc = libc_pkg_map.get(pkg.root) + if my_libc is not None and \ + my_libc in earlier_libc_pkgs: + graph.add(my_libc, pkg, + priority=DepPriority(buildtime=True)) + def schedulerGraph(self): """ The scheduler graph is identical to the normal one except that @@ -4220,6 +4283,8 @@ class depgraph(object): # NOTE: altlist initializes self._dynamic_config._scheduler_graph mergelist = self.altlist() + self._implicit_libc_deps(mergelist, + self._dynamic_config._scheduler_graph) self.break_refs(mergelist) self.break_refs(self._dynamic_config._scheduler_graph.order) |