-# 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
import tempfile
import textwrap
import time
+import warnings
import weakref
import zlib
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()
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)
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.
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()
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
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()
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()
# 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
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):
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
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