Add emerge --dynamic-deps <y|n> option.
authorZac Medico <zmedico@gentoo.org>
Mon, 10 Oct 2011 18:01:36 +0000 (11:01 -0700)
committerZac Medico <zmedico@gentoo.org>
Mon, 10 Oct 2011 18:01:36 +0000 (11:01 -0700)
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)).

man/emerge.1
pym/_emerge/FakeVartree.py
pym/_emerge/Scheduler.py
pym/_emerge/create_depgraph_params.py
pym/_emerge/depgraph.py
pym/_emerge/main.py

index 62bfd5ecd3ff8e74d98fbbad2e8128dee0e2aafe..10be7895c04920f75e0b406a7e959f419b30a0fc 100644 (file)
@@ -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
index a11966f894bbbe87394307e4113f1fe795f2f2ad..a9c1b90e0dd5c96372d17f460de6f08d5eb56f96 100644 (file)
@@ -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()
index a6dd98c2865671524abe7cd2368738126ffafbf9..11a72f358967bc0b563ec259269cf9a4f574f559 100644 (file)
@@ -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']
index 42983fef3f23fe13c5d7c5588a66d6b8c0bfb370..8f15c681312f69619a6b964397cadcc986d638e7 100644 (file)
@@ -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
index a409bedacc5d153ab2782499459f5d4e96da50f5..ab62dc773485ce1d1839902ed9147c45152eabd7 100644 (file)
@@ -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
index f4ea36c7b24abf752b9bcf4dd003ec3ee3344b40..ed07c092dbd6c3f178928413b49fccf7b5c173e2 100644 (file)
@@ -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 " + \