Using \fB\-\-with\-bdeps=y\fR together with \fB\-\-complete\-graph\fR makes
the graph as complete as possible.
.TP
+.BR "\-\-complete\-graph\-if\-new\-ver < y | n >"
+Trigger the \fB\-\-complete\-graph\fR behavior if an installed package
+version will change (upgrade or downgrade). This option is enabled by default.
+.TP
.BR \-\-config\-root=DIR
Set the \fBPORTAGE_CONFIGROOT\fR environment variable.
.TP
deep = myopts.get("--deep")
if deep is not None and deep != 0:
myparams["deep"] = deep
+
+ complete_if_new_ver = \
+ myopts.get("--complete-graph-if-new-ver")
+ if complete_if_new_ver is not None:
+ myparams["complete_if_new_ver"] = complete_if_new_ver
+
if ("--complete-graph" in myopts or "--rebuild-if-new-rev" in myopts or
"--rebuild-if-new-ver" in myopts or "--rebuild-if-unbuilt" in myopts):
myparams["complete"] = True
"recurse" not in self._dynamic_config.myparams:
return 1
- if "complete" not in self._dynamic_config.myparams:
- # Automatically enable complete mode if there are any
- # downgrades, since they often break dependencies
- # (like in bug #353613).
- have_downgrade = False
+ if "complete" not in self._dynamic_config.myparams and \
+ self._dynamic_config.myparams.get("complete_if_new_ver", "y") == "y":
+ # Enable complete mode if an installed package version will change.
+ version_change = False
for node in self._dynamic_config.digraph:
if not isinstance(node, Package) or \
node.operation != "merge":
vardb = self._frozen_config.roots[
node.root].trees["vartree"].dbapi
inst_pkg = vardb.match_pkgs(node.slot_atom)
- if inst_pkg and inst_pkg[0] > node:
- have_downgrade = True
+ if inst_pkg and (inst_pkg[0] > node or inst_pkg[0] < node):
+ version_change = True
break
- if have_downgrade:
+ if version_change:
self._dynamic_config.myparams["complete"] = True
- else:
- # Skip complete graph mode, in order to avoid consuming
- # enough time to disturb users.
- return 1
+
+ if "complete" not in self._dynamic_config.myparams:
+ return 1
self._load_vdb()
])
longopt_aliases = {"--cols":"--columns", "--skip-first":"--skipfirst"}
+ y_or_n = ("y", "n")
true_y_or_n = ("True", "y", "n")
true_y = ("True", "y")
argument_options = {
"choices" : true_y_or_n
},
+ "--complete-graph-if-new-ver": {
+ "help" : "trigger --complete-graph behavior if an installed package version will change (upgrade or downgrade)",
+ "type" : "choice",
+ "choices" : y_or_n
+ },
+
"--deep": {
"shortopt" : "-D",
--- /dev/null
+# Copyright 2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+from portage.tests import TestCase
+from portage.tests.resolver.ResolverPlayground import (ResolverPlayground,
+ ResolverPlaygroundTestCase)
+
+class CompleteGraphTestCase(TestCase):
+
+ def testCompleteGraphVersionChange(self):
+ """
+ Prevent reverse dependency breakage triggered by version changes.
+ """
+
+ ebuilds = {
+ "sys-libs/x-0.1": {},
+ "sys-libs/x-1": {},
+ "sys-libs/x-2": {},
+ "sys-apps/a-1": {"RDEPEND" : ">=sys-libs/x-1 <sys-libs/x-2"},
+ }
+
+ installed = {
+ "sys-libs/x-1": {},
+ "sys-apps/a-1": {"RDEPEND" : ">=sys-libs/x-1 <sys-libs/x-2"},
+ }
+
+ world = ["sys-apps/a"]
+
+ test_cases = (
+ ResolverPlaygroundTestCase(
+ [">=sys-libs/x-2"],
+ options = {"--complete-graph-if-new-ver" : "n"},
+ mergelist = ["sys-libs/x-2"],
+ success = True,
+ ),
+ ResolverPlaygroundTestCase(
+ [">=sys-libs/x-2"],
+ options = {"--complete-graph-if-new-ver" : "y"},
+ mergelist = ["sys-libs/x-2"],
+ slot_collision_solutions = [],
+ success = False,
+ ),
+ ResolverPlaygroundTestCase(
+ ["<sys-libs/x-1"],
+ options = {"--complete-graph-if-new-ver" : "n"},
+ mergelist = ["sys-libs/x-0.1"],
+ success = True,
+ ),
+ ResolverPlaygroundTestCase(
+ ["<sys-libs/x-1"],
+ options = {"--complete-graph-if-new-ver" : "y"},
+ mergelist = ["sys-libs/x-0.1"],
+ slot_collision_solutions = [],
+ success = False,
+ ),
+ )
+
+ playground = ResolverPlayground(ebuilds=ebuilds,
+ installed=installed, world=world, debug=False)
+
+ try:
+ for test_case in test_cases:
+ playground.run_TestCase(test_case)
+ self.assertEqual(test_case.test_success, True, test_case.fail_msg)
+ finally:
+ playground.cleanup()