From: Zac Medico Date: Mon, 10 Oct 2011 18:01:36 +0000 (-0700) Subject: Add emerge --dynamic-deps option. X-Git-Tag: v2.2.0_alpha66~4 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f8e0c75e0952d04cb518ad0914ad440f1b43f52d;p=portage.git Add emerge --dynamic-deps option. This makes it possible to disable the dynamic dependency updates that FakeVartree performs by default. WARNING: If --dynamic-deps is disabled, then it is necessary to ensure that an alternative method is used to handle package moves in dependencies of installed packages. Normally, this is handled by FEATURES="fixpackages", which is enabled by default and may be disabled via make.conf(5). Alternatively, in order to manually apply package moves, run `emaint --fix moveinst` after each emerge --sync operation (see emaint(1)). --- diff --git a/man/emerge.1 b/man/emerge.1 index 62bfd5ecd..10be7895c 100644 --- a/man/emerge.1 +++ b/man/emerge.1 @@ -407,6 +407,22 @@ when FEATURES="preserve\-libs" is enabled in \fBmake.conf\fR(5), since any libraries that have consumers will simply be preserved. .TP +.BR "\-\-dynamic\-deps < y | n >" +In dependency calculations, substitute the dependencies of installed +packages with the dependencies of corresponding unbuilt ebuilds from +source repositories. This causes the effective dependencies of +installed packages to vary dynamically when source ebuild dependencies +are modified. This option is enabled by default. + +\fBWARNING:\fR +If \-\-dynamic\-deps is disabled, then it is necessary to ensure that +an alternative method is used to handle package moves in dependencies +of installed packages. Normally, this is handled by +FEATURES="fixpackages", which is enabled by default and may be +disabled via \fBmake.conf\fR(5). Alternatively, in order to manually +apply package moves, run `emaint \-\-fix moveinst` after each +emerge \-\-sync operation (see \fBemaint\fR(1)). +.TP .BR "\-\-emptytree " (\fB\-e\fR) Reinstalls target atoms and their entire deep dependency tree, as though no packages are currently diff --git a/pym/_emerge/FakeVartree.py b/pym/_emerge/FakeVartree.py index a11966f89..a9c1b90e0 100644 --- a/pym/_emerge/FakeVartree.py +++ b/pym/_emerge/FakeVartree.py @@ -37,8 +37,10 @@ class FakeVartree(vartree): global updates are necessary (updates are performed when necessary if there is not a matching ebuild in the tree). Instances of this class are not populated until the sync() method is called.""" - def __init__(self, root_config, pkg_cache=None, pkg_root_config=None): + def __init__(self, root_config, pkg_cache=None, pkg_root_config=None, + dynamic_deps=True): self._root_config = root_config + self._dynamic_deps = dynamic_deps if pkg_root_config is None: pkg_root_config = self._root_config self._pkg_root_config = pkg_root_config @@ -60,7 +62,8 @@ class FakeVartree(vartree): # metadata. This ensures that the vardb lock is released ASAP, without # being delayed in case cache generation is triggered. self._aux_get = self.dbapi.aux_get - self.dbapi.aux_get = self._aux_get_wrapper + if dynamic_deps: + self.dbapi.aux_get = self._aux_get_wrapper self._match = self.dbapi.match self.dbapi.match = self._match_wrapper self._aux_get_history = set() diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py index a6dd98c28..11a72f358 100644 --- a/pym/_emerge/Scheduler.py +++ b/pym/_emerge/Scheduler.py @@ -304,10 +304,11 @@ class Scheduler(PollScheduler): """ self._set_graph_config(graph_config) self._blocker_db = {} + dynamic_deps = myopts.get("--dynamic-deps", "y") != "n" for root in self.trees: if graph_config is None: fake_vartree = FakeVartree(self.trees[root]["root_config"], - pkg_cache=self._pkg_cache) + pkg_cache=self._pkg_cache, dynamic_deps=dynamic_deps) fake_vartree.sync() else: fake_vartree = graph_config.trees[root]['vartree'] diff --git a/pym/_emerge/create_depgraph_params.py b/pym/_emerge/create_depgraph_params.py index 42983fef3..8f15c6813 100644 --- a/pym/_emerge/create_depgraph_params.py +++ b/pym/_emerge/create_depgraph_params.py @@ -21,6 +21,10 @@ def create_depgraph_params(myopts, myaction): if bdeps is not None: myparams["bdeps"] = bdeps + dynamic_deps = myopts.get("--dynamic-deps") + if dynamic_deps is not None: + myparams["dynamic_deps"] = dynamic_deps + if myaction == "remove": myparams["remove"] = True myparams["complete"] = True diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index a409bedac..ab62dc773 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -109,6 +109,7 @@ class _frozen_depgraph_config(object): # All Package instances self._pkg_cache = {} self._highest_license_masked = {} + dynamic_deps = myopts.get("--dynamic-deps", "y") != "n" for myroot in trees: self.trees[myroot] = {} # Create a RootConfig instance that references @@ -122,7 +123,8 @@ class _frozen_depgraph_config(object): self.trees[myroot]["vartree"] = \ FakeVartree(trees[myroot]["root_config"], pkg_cache=self._pkg_cache, - pkg_root_config=self.roots[myroot]) + pkg_root_config=self.roots[myroot], + dynamic_deps=dynamic_deps) self.pkgsettings[myroot] = portage.config( clone=self.trees[myroot]["vartree"].settings) @@ -514,6 +516,8 @@ class depgraph(object): for myroot in self._frozen_config.trees: + dynamic_deps = self._dynamic_config.myparams.get( + "dynamic_deps", "y") != "n" preload_installed_pkgs = \ "--nodeps" not in self._frozen_config.myopts @@ -535,8 +539,11 @@ class depgraph(object): for pkg in vardb: self._spinner_update() - # This triggers metadata updates via FakeVartree. - vardb.aux_get(pkg.cpv, []) + if dynamic_deps: + # This causes FakeVartree to update the + # Package instance dependencies via + # PackageVirtualDbapi.aux_update() + vardb.aux_get(pkg.cpv, []) fakedb.cpv_inject(pkg) self._dynamic_config._vdb_loaded = True diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py index f4ea36c7b..ed07c092d 100644 --- a/pym/_emerge/main.py +++ b/pym/_emerge/main.py @@ -684,6 +684,12 @@ def parse_opts(tmpcmdline, silent=False): "choices" : true_y_or_n }, + "--dynamic-deps": { + "help": "substitute the dependencies of installed packages with the dependencies of unbuilt ebuilds", + "type": "choice", + "choices": y_or_n + }, + "--exclude": { "help" :"A space separated list of package names or slot atoms. " + \ "Emerge won't install any ebuild or binary package that " + \