summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/_emerge/Scheduler.py38
-rw-r--r--pym/_emerge/actions.py16
-rw-r--r--pym/_emerge/depgraph.py11
3 files changed, 39 insertions, 26 deletions
diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py
index 400ce1940..d911671b6 100644
--- a/pym/_emerge/Scheduler.py
+++ b/pym/_emerge/Scheduler.py
@@ -1,4 +1,4 @@
-# Copyright 1999-2009 Gentoo Foundation
+# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import print_function
@@ -11,6 +11,7 @@ import sys
import tempfile
import textwrap
import time
+import warnings
import weakref
import zlib
@@ -137,15 +138,21 @@ class Scheduler(PollScheduler):
portage.exception.PortageException.__init__(self, value)
def __init__(self, settings, trees, mtimedb, myopts,
- spinner, mergelist, favorites, graph_config):
+ spinner, mergelist=None, favorites=None, graph_config=None):
PollScheduler.__init__(self)
+
+ if mergelist is not None:
+ warnings.warn("The mergelist parameter of the " + \
+ "_emerge.Scheduler constructor is now unused. Use " + \
+ "the graph_config parameter instead.",
+ DeprecationWarning, stacklevel=2)
+
self.settings = settings
self.target_root = settings["ROOT"]
self.trees = trees
self.myopts = myopts
self._spinner = spinner
self._mtimedb = mtimedb
- self._mergelist = mergelist
self._favorites = favorites
self._args_set = InternalPackageSet(favorites)
self._build_opts = self._build_opts_class()
@@ -228,7 +235,8 @@ class Scheduler(PollScheduler):
self._failed_pkgs_die_msgs = []
self._post_mod_echo_msgs = []
self._parallel_fetch = False
- merge_count = len([x for x in mergelist \
+ self._init_graph(graph_config)
+ merge_count = len([x for x in self._mergelist \
if isinstance(x, Package) and x.operation == "merge"])
self._pkg_count = self._pkg_count_class(
curval=0, maxval=merge_count)
@@ -242,8 +250,6 @@ class Scheduler(PollScheduler):
self._job_delay_exp = 1.5
self._previous_job_start_time = None
- self._init_graph(graph_config)
-
# This is used to memoize the _choose_pkg() result when
# no packages can be chosen until one of the existing
# jobs completes.
@@ -377,16 +383,25 @@ class Scheduler(PollScheduler):
return interactive_tasks
def _set_graph_config(self, graph_config):
- if "--nodeps" in self.myopts or \
- graph_config is None or \
- (self._max_jobs is not True and self._max_jobs < 2):
- # save some memory
+
+ if graph_config is None:
self._graph_config = None
self._digraph = None
+ self._mergelist = []
return
self._graph_config = graph_config
self._digraph = graph_config.graph
+ self._mergelist = graph_config.mergelist
+
+ if "--nodeps" in self.myopts or \
+ (self._max_jobs is not True and self._max_jobs < 2):
+ # save some memory
+ self._digraph = None
+ graph_config.graph = None
+ graph_config.pkg_cache.clear()
+ return
+
self._find_system_deps()
self._prune_digraph()
self._prevent_builddir_collisions()
@@ -1796,9 +1811,6 @@ class Scheduler(PollScheduler):
mydepgraph.display_problems()
mylist = mydepgraph.altlist()
- mydepgraph.break_refs(mylist)
- mydepgraph.break_refs(dropped_tasks)
- self._mergelist = mylist
self._init_graph(mydepgraph.schedulerGraph())
msg_width = 75
diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index 473f6fb7a..606d685ce 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -410,11 +410,10 @@ def action_build(settings, trees, mtimedb,
if ("--resume" in myopts):
favorites=mtimedb["resume"]["favorites"]
- mymergelist = mydepgraph.altlist()
- mydepgraph.break_refs(mymergelist)
mergetask = Scheduler(settings, trees, mtimedb, myopts,
- spinner, mymergelist, favorites, mydepgraph.schedulerGraph())
- del mydepgraph, mymergelist
+ spinner, favorites=favorites,
+ graph_config=mydepgraph.schedulerGraph())
+ del mydepgraph
clear_caches(trees)
retval = mergetask.merge()
@@ -427,12 +426,11 @@ def action_build(settings, trees, mtimedb,
del mtimedb["resume"]
mtimedb.commit()
- pkglist = mydepgraph.altlist()
mydepgraph.saveNomergeFavorites()
- mydepgraph.break_refs(pkglist)
mergetask = Scheduler(settings, trees, mtimedb, myopts,
- spinner, pkglist, favorites, mydepgraph.schedulerGraph())
- del mydepgraph, pkglist
+ spinner, favorites=favorites,
+ graph_config=mydepgraph.schedulerGraph())
+ del mydepgraph
clear_caches(trees)
retval = mergetask.merge()
@@ -2460,7 +2458,7 @@ def action_uninstall(settings, trees, ldpath_mtimes,
# redirection of ebuild phase output to logs as required for
# options such as --quiet.
sched = Scheduler(settings, trees, None, opts,
- spinner, [], [], None)
+ spinner)
sched._background = sched._background_mode()
sched._status_display.quiet = True
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index d2b64c4b0..a87119dd8 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -64,10 +64,11 @@ if sys.hexversion >= 0x3000000:
long = int
class _scheduler_graph_config(object):
- def __init__(self, trees, pkg_cache, graph):
+ def __init__(self, trees, pkg_cache, graph, mergelist):
self.trees = trees
self.pkg_cache = pkg_cache
self.graph = graph
+ self.mergelist = mergelist
class _frozen_depgraph_config(object):
@@ -3485,8 +3486,10 @@ class depgraph(object):
internal Package instances such that this depgraph instance should
not be used to perform any more calculations.
"""
- if self._dynamic_config._scheduler_graph is None:
- self.altlist()
+
+ # NOTE: altlist initializes self._dynamic_config._scheduler_graph
+ mergelist = self.altlist()
+ self.break_refs(mergelist)
self.break_refs(self._dynamic_config._scheduler_graph.order)
# Break DepPriority.satisfied attributes which reference
@@ -3513,7 +3516,7 @@ class depgraph(object):
self.break_refs(pruned_pkg_cache)
sched_config = \
- _scheduler_graph_config(trees, pruned_pkg_cache, graph)
+ _scheduler_graph_config(trees, pruned_pkg_cache, graph, mergelist)
return sched_config