public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: pym/_emerge/, man/, pym/portage/tests/resolver/
@ 2018-03-28  5:56 Zac Medico
  0 siblings, 0 replies; 3+ messages in thread
From: Zac Medico @ 2018-03-28  5:56 UTC (permalink / raw
  To: gentoo-commits

commit:     1879d3ca019ebe4b870c3ee8d80910a90a8e4408
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 26 20:59:57 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Mar 28 05:51:50 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=1879d3ca

emerge: add --changed-slot [ y | n ] option (bug 631358)

This is similar to --changed-deps, but for SLOT metadata.

Bug: https://bugs.gentoo.org/631358

 man/emerge.1                                          |  7 +++++++
 pym/_emerge/create_depgraph_params.py                 |  6 ++++++
 pym/_emerge/depgraph.py                               | 11 +++++++++++
 pym/_emerge/main.py                                   | 13 +++++++++++++
 .../resolver/test_slot_change_without_revbump.py      | 19 +++++++++++++++++++
 5 files changed, 56 insertions(+)

diff --git a/man/emerge.1 b/man/emerge.1
index 27a1193fe..a3c8dd7cd 100644
--- a/man/emerge.1
+++ b/man/emerge.1
@@ -471,6 +471,13 @@ changed since the installed instance was built. Behavior with respect to
 changed build\-time dependencies is controlled by the
 \fB\-\-with\-bdeps\fR option.
 .TP
+.BR "\-\-changed\-slot [ y | n ]"
+Tells emerge to replace installed packages for which the corresponding
+ebuild SLOT metadata has changed since the packages were built. This
+option also implies the \fB\-\-selective\fR option. This may also result
+in rebuilds for any installed packages that have slot/sub\-slot :=
+operator dependencies that are sensitive to the relevant SLOT metadata.
+.TP
 .BR \-\-changed\-use ", " \-U
 Tells emerge to include installed packages where USE flags have
 changed since installation. This option also implies the

diff --git a/pym/_emerge/create_depgraph_params.py b/pym/_emerge/create_depgraph_params.py
index ff18f3acc..1fd1f5e36 100644
--- a/pym/_emerge/create_depgraph_params.py
+++ b/pym/_emerge/create_depgraph_params.py
@@ -30,6 +30,7 @@ def create_depgraph_params(myopts, myaction):
 	# with_test_deps: pull in test deps for packages matched by arguments
 	# changed_deps: rebuild installed packages with outdated deps
 	# changed_deps_report: report installed packages with outdated deps
+	# changed_slot: rebuild installed packages with outdated SLOT metadata
 	# binpkg_changed_deps: reject binary packages with outdated deps
 	myparams = {"recurse" : True}
 
@@ -64,12 +65,17 @@ def create_depgraph_params(myopts, myaction):
 	if rebuild_if_new_slot is not None:
 		myparams['rebuild_if_new_slot'] = rebuild_if_new_slot
 
+	changed_slot = myopts.get('--changed-slot') is True
+	if changed_slot:
+		myparams["changed_slot"] = True
+
 	if "--update" in myopts or \
 		"--newrepo" in myopts or \
 		"--newuse" in myopts or \
 		"--reinstall" in myopts or \
 		"--noreplace" in myopts or \
 		myopts.get("--changed-deps", "n") != "n" or \
+		changed_slot or \
 		myopts.get("--selective", "n") != "n":
 		myparams["selective"] = True
 

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index ac7ec9d84..6af7d5714 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -2667,6 +2667,10 @@ class depgraph(object):
 
 		return changed
 
+	def _changed_slot(self, pkg):
+		ebuild = self._equiv_ebuild(pkg)
+		return ebuild is not None and (ebuild.slot, ebuild.sub_slot) != (pkg.slot, pkg.sub_slot)
+
 	def _create_graph(self, allow_unsatisfied=False):
 		dep_stack = self._dynamic_config._dep_stack
 		dep_disjunctive_stack = self._dynamic_config._dep_disjunctive_stack
@@ -6474,6 +6478,13 @@ class depgraph(object):
 						modified_use=self._pkg_use_enabled(pkg))):
 						if myeb and "--newrepo" in self._frozen_config.myopts and myeb.repo != pkg.repo:
 							break
+						elif self._dynamic_config.myparams.get("changed_slot") and self._changed_slot(pkg):
+							if installed:
+								break
+							else:
+								# Continue searching for a binary package
+								# with the desired SLOT metadata.
+								continue
 						elif reinstall_use or (not installed and respect_use):
 							iuses = pkg.iuse.all
 							old_use = self._pkg_use_enabled(pkg)

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 147472cbd..4aa9585fa 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -136,6 +136,7 @@ def insert_optional_args(args):
 		'--binpkg-changed-deps'  : y_or_n,
 		'--buildpkg'             : y_or_n,
 		'--changed-deps'         : y_or_n,
+		'--changed-slot'         : y_or_n,
 		'--changed-deps-report'  : y_or_n,
 		'--complete-graph'       : y_or_n,
 		'--deep'       : valid_integers,
@@ -416,6 +417,12 @@ def parse_opts(tmpcmdline, silent=False):
 			"choices" : true_y_or_n
 		},
 
+		"--changed-slot": {
+			"help"    : ("replace installed packages with "
+				"outdated SLOT metadata"),
+			"choices" : true_y_or_n
+		},
+
 		"--config-root": {
 			"help":"specify the location for portage configuration files",
 			"action":"store"
@@ -852,6 +859,12 @@ def parse_opts(tmpcmdline, silent=False):
 		else:
 			myoptions.changed_deps_report = 'n'
 
+	if myoptions.changed_slot is not None:
+		if myoptions.changed_slot in true_y:
+			myoptions.changed_slot = True
+		else:
+			myoptions.changed_slot = None
+
 	if myoptions.changed_use is not False:
 		myoptions.reinstall = "changed-use"
 		myoptions.changed_use = False

diff --git a/pym/portage/tests/resolver/test_slot_change_without_revbump.py b/pym/portage/tests/resolver/test_slot_change_without_revbump.py
index d85ff7e05..5cd8c53d1 100644
--- a/pym/portage/tests/resolver/test_slot_change_without_revbump.py
+++ b/pym/portage/tests/resolver/test_slot_change_without_revbump.py
@@ -57,6 +57,25 @@ class SlotChangeWithoutRevBumpTestCase(TestCase):
 				success = True,
 				mergelist = ['app-arch/libarchive-3.1.1', "kde-base/ark-4.10.0"]),
 
+			ResolverPlaygroundTestCase(
+				["app-arch/libarchive"],
+				options = {"--noreplace": True, "--usepkg": True},
+				success = True,
+				mergelist = []),
+
+			ResolverPlaygroundTestCase(
+				["app-arch/libarchive"],
+				options = {"--usepkg": True},
+				success = True,
+				mergelist = ["[binary]app-arch/libarchive-3.1.1"]),
+
+			# Test --changed-slot
+			ResolverPlaygroundTestCase(
+				["app-arch/libarchive"],
+				options = {"--changed-slot": True, "--usepkg": True},
+				success = True,
+				mergelist = ["app-arch/libarchive-3.1.1", "kde-base/ark-4.10.0"]),
+
 		)
 
 		playground = ResolverPlayground(ebuilds=ebuilds, binpkgs=binpkgs,


^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/_emerge/, man/, pym/portage/tests/resolver/
@ 2017-12-19 22:46 Michał Górny
  0 siblings, 0 replies; 3+ messages in thread
From: Michał Górny @ 2017-12-19 22:46 UTC (permalink / raw
  To: gentoo-commits

commit:     2905e1c2c28db495b74fde7d9b3bfdd4e7515dbd
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 15 22:48:33 2017 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Dec 19 22:45:16 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=2905e1c2

Disable dynamic-deps by default

We have prepared for this for quite a while and it's time to pull
the plug. Disable dynamic-deps by default and restore the standard
PMS behavior. This will cause some one-time pain but eventually will
result in improvement of ebuild quality, especially when developers
start experiencing the need for revbumps first hand.

Acked-by: Alexander Berntsen <bernalex <AT> gentoo.org>
Reviewed-by: Zac Medico <zmedico <AT> gentoo.org>

 man/emerge.1                                    | 2 +-
 pym/_emerge/FakeVartree.py                      | 2 +-
 pym/_emerge/Scheduler.py                        | 2 +-
 pym/_emerge/depgraph.py                         | 4 ++--
 pym/portage/tests/resolver/test_changed_deps.py | 1 +
 pym/portage/tests/resolver/test_virtual_slot.py | 2 +-
 6 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/man/emerge.1 b/man/emerge.1
index 3198ba028..b292954a3 100644
--- a/man/emerge.1
+++ b/man/emerge.1
@@ -547,7 +547,7 @@ 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.
+are modified. This option is disabled by default.
 
 \fBWARNING:\fR
 If you want to disable \-\-dynamic\-deps, then it may be necessary to

diff --git a/pym/_emerge/FakeVartree.py b/pym/_emerge/FakeVartree.py
index ebe07bba2..3f82e97e9 100644
--- a/pym/_emerge/FakeVartree.py
+++ b/pym/_emerge/FakeVartree.py
@@ -54,7 +54,7 @@ class FakeVartree(vartree):
 	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,
-		dynamic_deps=True, ignore_built_slot_operator_deps=False,
+		dynamic_deps=False, ignore_built_slot_operator_deps=False,
 		soname_deps=False):
 		self._root_config = root_config
 		self._dynamic_deps = dynamic_deps

diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py
index 3a38cbafd..9bbc48e0a 100644
--- a/pym/_emerge/Scheduler.py
+++ b/pym/_emerge/Scheduler.py
@@ -352,7 +352,7 @@ class Scheduler(PollScheduler):
 		"""
 		self._set_graph_config(graph_config)
 		self._blocker_db = {}
-		dynamic_deps = self.myopts.get("--dynamic-deps", "y") != "n"
+		dynamic_deps = self.myopts.get("--dynamic-deps", "n") != "n"
 		ignore_built_slot_operator_deps = self.myopts.get(
 			"--ignore-built-slot-operator-deps", "n") == "y"
 		for root in self.trees:

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 6e5ca6508..27bec3b32 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -137,7 +137,7 @@ class _frozen_depgraph_config(object):
 		self.soname_deps_enabled = (
 			("--usepkgonly" in myopts or "remove" in params) and
 			params.get("ignore_soname_deps") != "y")
-		dynamic_deps = myopts.get("--dynamic-deps", "y") != "n"
+		dynamic_deps = myopts.get("--dynamic-deps", "n") != "n"
 		ignore_built_slot_operator_deps = myopts.get(
 			"--ignore-built-slot-operator-deps", "n") == "y"
 		for myroot in trees:
@@ -627,7 +627,7 @@ class depgraph(object):
 		for myroot in self._frozen_config.trees:
 
 			dynamic_deps = self._dynamic_config.myparams.get(
-				"dynamic_deps", "y") != "n"
+				"dynamic_deps", "n") != "n"
 			preload_installed_pkgs = \
 				"--nodeps" not in self._frozen_config.myopts
 

diff --git a/pym/portage/tests/resolver/test_changed_deps.py b/pym/portage/tests/resolver/test_changed_deps.py
index 2421c531f..420a00172 100644
--- a/pym/portage/tests/resolver/test_changed_deps.py
+++ b/pym/portage/tests/resolver/test_changed_deps.py
@@ -52,6 +52,7 @@ class ChangedDepsTestCase(TestCase):
 				options = {
 					"--update": True,
 					"--deep": True,
+					"--dynamic-deps": "y",
 					"--usepkg": True,
 				},
 				mergelist = ["app-misc/B-0"]

diff --git a/pym/portage/tests/resolver/test_virtual_slot.py b/pym/portage/tests/resolver/test_virtual_slot.py
index cee1a2373..ef4bd367a 100644
--- a/pym/portage/tests/resolver/test_virtual_slot.py
+++ b/pym/portage/tests/resolver/test_virtual_slot.py
@@ -142,7 +142,7 @@ class VirtualSlotResolverTestCase(TestCase):
 			# bug 526160 - test for missed pypy sub-slot update
 			ResolverPlaygroundTestCase(
 				["@world"],
-				options = {"--update": True, "--deep": True},
+				options = {"--update": True, "--deep": True, "--dynamic-deps": "y"},
 				success=True,
 				mergelist = ['dev-python/pypy-2.4.0',
 					'virtual/pypy-2.4.0',


^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/_emerge/, man/, pym/portage/tests/resolver/
@ 2017-05-14 18:12 Zac Medico
  0 siblings, 0 replies; 3+ messages in thread
From: Zac Medico @ 2017-05-14 18:12 UTC (permalink / raw
  To: gentoo-commits

commit:     40505ceeadc769f4f01c66e52a19ce0bf2f59761
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed May 10 03:44:56 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun May 14 18:11:45 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=40505cee

emerge: terminate backtracking early for autounmask changes (bug 615680)

Since autounmask changes are a strong indicator that backtracking
will ultimately fail to produce a solution, terminate early for
autounmask changes, and add a --autounmask-backtrack=<y|n> option
to modify this behavior. The --autounmask-continue option implies
--autounmask-backtrack=y behavior, for backward compatibility.

When backtracking terminates early, the following warning message
is displayed after the autounmask change(s):

 * In order to avoid wasting time, backtracking has terminated early
 * due to the above autounmask change(s). The --autounmask-backtrack=y
 * option can be used to force further backtracking, but there is no
 * guarantee that it will produce a solution.

With this change, five of the existing cases fail unless
--autounmask-backtrack=y is added to the options. For each of
these cases, comments below the test case document how it behaves
with and without --autounmask-backtrack=y enabled.

X-Gentoo-bug: 615680
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=615680
Acked-by: Brian Dolbec <dolsen <AT> gentoo.org>

 man/emerge.1                                       | 10 ++-
 pym/_emerge/depgraph.py                            | 80 ++++++++++++++++++----
 pym/_emerge/main.py                                |  6 ++
 pym/portage/tests/resolver/test_autounmask.py      | 57 ++++++++++++++-
 .../tests/resolver/test_autounmask_use_breakage.py | 40 +++++++++++
 .../test_slot_conflict_unsatisfied_deep_deps.py    | 61 +++++++++++++++++
 6 files changed, 237 insertions(+), 17 deletions(-)

diff --git a/man/emerge.1 b/man/emerge.1
index f1a9d4f3f..94edc9095 100644
--- a/man/emerge.1
+++ b/man/emerge.1
@@ -363,12 +363,20 @@ the specified configuration file(s), or enable the
 \fBEMERGE_DEFAULT_OPTS\fR variable may be used to
 disable this option by default in \fBmake.conf\fR(5).
 .TP
+.BR "\-\-autounmask\-backtrack < y | n >"
+Allow backtracking after autounmask has detected that
+configuration changes are necessary. This option is not
+recommended, since it can cause a large amount of time to
+be wasted by backtracking calculations, even though there
+is no guarantee that it will produce a solution. This
+option is disabled by default.
+.TP
 .BR "\-\-autounmask\-continue [ y | n ]"
 Automatically apply autounmask changes to configuration
 files, and continue to execute the specified command. If
 the dependency calculation is not entirely successful, then
 emerge will simply abort without modifying any configuration
-files.
+files. This option implies \fB\-\-autounmask\-backtrack=y\fR.
 \fBWARNING:\fR
 This option is intended to be used only with great caution,
 since it is possible for it to make nonsensical configuration

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index e1119af3c..53910dd25 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -444,6 +444,7 @@ class _dynamic_depgraph_config(object):
 		self._autounmask = depgraph._frozen_config.myopts.get('--autounmask') != 'n'
 		self._displayed_autounmask = False
 		self._success_without_autounmask = False
+		self._autounmask_backtrack_disabled = False
 		self._required_use_unsatisfied = False
 		self._traverse_ignored_deps = False
 		self._complete_mode = False
@@ -1129,7 +1130,8 @@ class depgraph(object):
 
 		self._show_merge_list()
 
-		self._dynamic_config._slot_conflict_handler = slot_conflict_handler(self)
+		if self._dynamic_config._slot_conflict_handler is None:
+			self._dynamic_config._slot_conflict_handler = slot_conflict_handler(self)
 		handler = self._dynamic_config._slot_conflict_handler
 
 		conflict = handler.get_conflict()
@@ -4243,17 +4245,7 @@ class depgraph(object):
 		# set below is reserved for cases where there are *zero* other
 		# problems. For reference, see backtrack_depgraph, where it skips the
 		# get_best_run() call when success_without_autounmask is True.
-
-		digraph_nodes = self._dynamic_config.digraph.nodes
-
-		if any(x in digraph_nodes for x in
-			self._dynamic_config._needed_unstable_keywords) or \
-			any(x in digraph_nodes for x in
-			self._dynamic_config._needed_p_mask_changes) or \
-			any(x in digraph_nodes for x in
-			self._dynamic_config._needed_use_config_changes) or \
-			any(x in digraph_nodes for x in
-			self._dynamic_config._needed_license_changes) :
+		if self._have_autounmask_changes():
 			#We failed if the user needs to change the configuration
 			self._dynamic_config._success_without_autounmask = True
 			if (self._frozen_config.myopts.get("--autounmask-continue") is True and
@@ -8564,6 +8556,17 @@ class depgraph(object):
 				"experimental or unstable packages.\n",
 				noiselevel=-1)
 
+		if self._dynamic_config._autounmask_backtrack_disabled:
+			msg = [
+				"In order to avoid wasting time, backtracking has terminated early",
+				"due to the above autounmask change(s). The --autounmask-backtrack=y",
+				"option can be used to force further backtracking, but there is no",
+				"guarantee that it will produce a solution.",
+			]
+			writemsg("\n", noiselevel=-1)
+			for line in msg:
+				writemsg(" %s %s\n" % (colorize("WARN", "*"), line),
+					noiselevel=-1)
 
 	def display_problems(self):
 		"""
@@ -9072,8 +9075,57 @@ class depgraph(object):
 			not self._dynamic_config._skip_restart
 
 	def need_config_change(self):
-		return self._dynamic_config._success_without_autounmask or \
-			self._dynamic_config._required_use_unsatisfied
+		"""
+		Returns true if backtracking should terminate due to a needed
+		configuration change.
+		"""
+		if (self._dynamic_config._success_without_autounmask or
+			self._dynamic_config._required_use_unsatisfied):
+			return True
+
+		if (self._dynamic_config._slot_conflict_handler is None and
+			not self._accept_blocker_conflicts() and
+			any(self._dynamic_config._package_tracker.slot_conflicts())):
+			self._dynamic_config._slot_conflict_handler = slot_conflict_handler(self)
+			if self._dynamic_config._slot_conflict_handler.changes:
+				# Terminate backtracking early if the slot conflict
+				# handler finds some changes to suggest. The case involving
+				# sci-libs/L and sci-libs/M in SlotCollisionTestCase will
+				# otherwise fail with --autounmask-backtrack=n, since
+				# backtracking will eventually lead to some autounmask
+				# changes. Changes suggested by the slot conflict handler
+				# are more likely to be useful.
+				return True
+
+		if (self._dynamic_config._allow_backtracking and
+			self._frozen_config.myopts.get("--autounmask-backtrack") != 'y' and
+			self._have_autounmask_changes()):
+
+			if (self._frozen_config.myopts.get("--autounmask-continue") is True and
+				self._frozen_config.myopts.get("--autounmask-backtrack") != 'n'):
+				# --autounmask-continue implies --autounmask-backtrack=y behavior,
+				# for backward compatibility.
+				return False
+
+			# This disables backtracking when there are autounmask
+			# config changes. The display_problems method will notify
+			# the user that --autounmask-backtrack=y can be used to
+			# force backtracking in this case.
+			self._dynamic_config._autounmask_backtrack_disabled = True
+			return True
+
+		return False
+
+	def _have_autounmask_changes(self):
+		digraph_nodes = self._dynamic_config.digraph.nodes
+		return (any(x in digraph_nodes for x in
+			self._dynamic_config._needed_unstable_keywords) or
+			any(x in digraph_nodes for x in
+			self._dynamic_config._needed_p_mask_changes) or
+			any(x in digraph_nodes for x in
+			self._dynamic_config._needed_use_config_changes) or
+			any(x in digraph_nodes for x in
+			self._dynamic_config._needed_license_changes))
 
 	def need_config_reload(self):
 		return self._dynamic_config._need_config_reload

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 76e963ac9..808496722 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -326,6 +326,12 @@ def parse_opts(tmpcmdline, silent=False):
 			"choices" : true_y_or_n
 		},
 
+		"--autounmask-backtrack": {
+			"help": ("continue backtracking when there are autounmask "
+				"configuration changes"),
+			"choices":("y", "n")
+		},
+
 		"--autounmask-continue": {
 			"help"    : "write autounmask changes and continue",
 			"choices" : true_y_or_n

diff --git a/pym/portage/tests/resolver/test_autounmask.py b/pym/portage/tests/resolver/test_autounmask.py
index 75fb36843..e2a7de028 100644
--- a/pym/portage/tests/resolver/test_autounmask.py
+++ b/pym/portage/tests/resolver/test_autounmask.py
@@ -81,20 +81,73 @@ class AutounmaskTestCase(TestCase):
 				#Make sure we restart if needed.
 				ResolverPlaygroundTestCase(
 					["dev-libs/A:1", "dev-libs/B"],
-					options={"--autounmask": True},
+					options={"--autounmask": True, "--autounmask-backtrack": "y"},
 					all_permutations=True,
 					success=False,
 					mergelist=["dev-libs/C-1", "dev-libs/B-1", "dev-libs/A-1"],
 					use_changes={ "dev-libs/B-1": {"foo": True} }),
+
+				# With --autounmask-backtrack=y:
+				#[ebuild  N     ] dev-libs/C-1
+				#[ebuild  N     ] dev-libs/B-1  USE="foo -bar"
+				#[ebuild  N     ] dev-libs/A-1
+				#
+				#The following USE changes are necessary to proceed:
+				# (see "package.use" in the portage(5) man page for more details)
+				## required by dev-libs/A-1::test_repo
+				## required by dev-libs/A:1 (argument)
+				#>=dev-libs/B-1 foo
+
+				# Without --autounmask-backtrack=y:
+				#[ebuild  N     ] dev-libs/B-1  USE="foo -bar"
+				#[ebuild  N     ] dev-libs/A-1
+				#
+				#The following USE changes are necessary to proceed:
+				# (see "package.use" in the portage(5) man page for more details)
+				## required by dev-libs/A-1::test_repo
+				## required by dev-libs/A:1 (argument)
+				#>=dev-libs/B-1 foo
+
 				ResolverPlaygroundTestCase(
 					["dev-libs/A:1", "dev-libs/A:2", "dev-libs/B"],
-					options={"--autounmask": True},
+					options={"--autounmask": True, "--autounmask-backtrack": "y"},
 					all_permutations=True,
 					success=False,
 					mergelist=["dev-libs/D-1", "dev-libs/C-1", "dev-libs/B-1", "dev-libs/A-1", "dev-libs/A-2"],
 					ignore_mergelist_order=True,
 					use_changes={ "dev-libs/B-1": {"foo": True, "bar": True} }),
 
+				# With --autounmask-backtrack=y:
+				#[ebuild  N     ] dev-libs/C-1
+				#[ebuild  N     ] dev-libs/D-1
+				#[ebuild  N     ] dev-libs/B-1  USE="bar foo"
+				#[ebuild  N     ] dev-libs/A-2
+				#[ebuild  N     ] dev-libs/A-1
+				#
+				#The following USE changes are necessary to proceed:
+				# (see "package.use" in the portage(5) man page for more details)
+				## required by dev-libs/A-2::test_repo
+				## required by dev-libs/A:2 (argument)
+				#>=dev-libs/B-1 bar foo
+
+				# Without --autounmask-backtrack=y:
+				#[ebuild  N     ] dev-libs/B-1  USE="bar foo"
+				#[ebuild  N     ] dev-libs/A-1
+				#[ebuild  N     ] dev-libs/A-2
+				#
+				#The following USE changes are necessary to proceed:
+				# (see "package.use" in the portage(5) man page for more details)
+				## required by dev-libs/A-1::test_repo
+				## required by dev-libs/A:1 (argument)
+				#>=dev-libs/B-1 foo bar
+
+				# NOTE: The --autounmask-backtrack=n behavior is acceptable, but
+				# it would be nicer if it added the dev-libs/C-1 and dev-libs/D-1
+				# deps to the depgraph without backtracking. It could add two
+				# instances of dev-libs/B-1 to the graph with different USE flags,
+				# and then use _solve_non_slot_operator_slot_conflicts to eliminate
+				# the redundant instance.
+
 				#Test keywording.
 				#The simple case.
 

diff --git a/pym/portage/tests/resolver/test_autounmask_use_breakage.py b/pym/portage/tests/resolver/test_autounmask_use_breakage.py
index 3654aa6a3..173941629 100644
--- a/pym/portage/tests/resolver/test_autounmask_use_breakage.py
+++ b/pym/portage/tests/resolver/test_autounmask_use_breakage.py
@@ -46,12 +46,52 @@ class AutounmaskUseBreakageTestCase(TestCase):
 			# due to autounmask USE breakage.
 			ResolverPlaygroundTestCase(
 				["app-misc/C", "app-misc/B", "app-misc/A"],
+				options={"--autounmask-backtrack": "y"},
 				all_permutations = True,
 				success = False,
 				ambiguous_slot_collision_solutions = True,
 				slot_collision_solutions = [None, []]
 			),
 
+			# With --autounmask-backtrack=y:
+			#emerge: there are no ebuilds built with USE flags to satisfy "app-misc/D[foo]".
+			#!!! One of the following packages is required to complete your request:
+			#- app-misc/D-0::test_repo (Change USE: +foo)
+			#(dependency required by "app-misc/B-0::test_repo" [ebuild])
+			#(dependency required by "app-misc/B" [argument])
+
+			# Without --autounmask-backtrack=y:
+			#[ebuild  N     ] app-misc/D-0  USE="foo"
+			#[ebuild  N     ] app-misc/D-1  USE="-bar"
+			#[ebuild  N     ] app-misc/C-0
+			#[ebuild  N     ] app-misc/B-0
+			#[ebuild  N     ] app-misc/A-0
+			#
+			#!!! Multiple package instances within a single package slot have been pulled
+			#!!! into the dependency graph, resulting in a slot conflict:
+			#
+			#app-misc/D:0
+			#
+			#  (app-misc/D-0:0/0::test_repo, ebuild scheduled for merge) pulled in by
+			#    app-misc/D[-foo] required by (app-misc/A-0:0/0::test_repo, ebuild scheduled for merge)
+			#               ^^^^
+			#    app-misc/D[foo] required by (app-misc/B-0:0/0::test_repo, ebuild scheduled for merge)
+			#               ^^^
+			#
+			#  (app-misc/D-1:0/0::test_repo, ebuild scheduled for merge) pulled in by
+			#    >=app-misc/D-1 required by (app-misc/C-0:0/0::test_repo, ebuild scheduled for merge)
+			#    ^^           ^
+			#
+			#The following USE changes are necessary to proceed:
+			# (see "package.use" in the portage(5) man page for more details)
+			## required by app-misc/B-0::test_repo
+			## required by app-misc/B (argument)
+			#=app-misc/D-0 foo
+
+			# NOTE: The --autounmask-backtrack=n output is preferable here,
+			# because it highlights the unsolvable dependency conflict.
+			# It would be better if it eliminated the autounmask suggestion,
+			# since that suggestion won't solve the conflict.
 		)
 
 		playground = ResolverPlayground(ebuilds=ebuilds, debug=False)

diff --git a/pym/portage/tests/resolver/test_slot_conflict_unsatisfied_deep_deps.py b/pym/portage/tests/resolver/test_slot_conflict_unsatisfied_deep_deps.py
index 13f7e67e3..846ba0e59 100644
--- a/pym/portage/tests/resolver/test_slot_conflict_unsatisfied_deep_deps.py
+++ b/pym/portage/tests/resolver/test_slot_conflict_unsatisfied_deep_deps.py
@@ -79,6 +79,7 @@ class SlotConflictUnsatisfiedDeepDepsTestCase(TestCase):
 				["@world"],
 				options={
 					"--autounmask": "y",
+					"--autounmask-backtrack": "y",
 					"--complete-graph": True,
 					"--selective": True,
 					"--deep": 1
@@ -89,11 +90,63 @@ class SlotConflictUnsatisfiedDeepDepsTestCase(TestCase):
 				unsatisfied_deps=["dev-libs/initially-unsatisfied"],
 				success=False),
 
+			# With --autounmask-backtrack=y:
+			#[ebuild  N    ~] dev-libs/A-2 
+			#[ebuild  N     ] dev-libs/C-1 
+			#[ebuild  N     ] dev-libs/D-1 
+			#[ebuild  N     ] dev-libs/B-1 
+			#
+			#The following keyword changes are necessary to proceed:
+			# (see "package.accept_keywords" in the portage(5) man page for more details)
+			## required by dev-libs/C-1::test_repo
+			## required by @selected
+			## required by @world (argument)
+			#=dev-libs/A-2 ~x86
+			#
+			#!!! Problems have been detected with your world file
+			#!!! Please run emaint --check world
+			#
+			#
+			#!!! Ebuilds for the following packages are either all
+			#!!! masked or don't exist:
+			#dev-libs/broken
+			#
+			#emerge: there are no ebuilds to satisfy "dev-libs/initially-unsatisfied".
+			#(dependency required by "dev-libs/broken-1::test_repo" [installed])
+			#(dependency required by "@selected" [set])
+			#(dependency required by "@world" [argument])
+
+			# Without --autounmask-backtrack=y:
+			#!!! Multiple package instances within a single package slot have been pulled
+			#!!! into the dependency graph, resulting in a slot conflict:
+			#
+			#dev-libs/A:0
+			#
+			#  (dev-libs/A-1:0/0::test_repo, ebuild scheduled for merge) pulled in by
+			#    (no parents that aren't satisfied by other packages in this slot)
+			#
+			#  (dev-libs/A-2:0/0::test_repo, ebuild scheduled for merge) pulled in by
+			#    >=dev-libs/A-2 required by (dev-libs/C-1:0/0::test_repo, ebuild scheduled for merge)
+			#    ^^           ^
+			#
+			#The following keyword changes are necessary to proceed:
+			# (see "package.accept_keywords" in the portage(5) man page for more details)
+			## required by dev-libs/C-1::test_repo
+			## required by @selected
+			## required by @world (argument)
+			#=dev-libs/A-2 ~x86
+			#
+			#emerge: there are no ebuilds to satisfy "dev-libs/initially-unsatisfied".
+			#(dependency required by "dev-libs/broken-1::test_repo" [installed])
+			#(dependency required by "@selected" [set])
+			#(dependency required by "@world" [argument])
+
 			# Test --deep = True
 			ResolverPlaygroundTestCase(
 				["@world"],
 				options={
 					"--autounmask": "y",
+					"--autounmask-backtrack": "y",
 					"--complete-graph": True,
 					"--selective": True,
 					"--deep": True
@@ -103,6 +156,14 @@ class SlotConflictUnsatisfiedDeepDepsTestCase(TestCase):
 				unstable_keywords=["dev-libs/A-2"],
 				unsatisfied_deps=["dev-libs/initially-unsatisfied"],
 				success=False),
+
+			# The effects of --autounmask-backtrack are the same as the previous test case.
+			# Both test cases can randomly succeed with --autounmask-backtrack=n, when
+			# "backtracking due to unsatisfied dep" randomly occurs before the autounmask
+			# unstable keyword change. It would be possible to eliminate backtracking here
+			# by recognizing that there are no alternatives to satisfy the dev-libs/broken
+			# atom in the world file. Then the test cases will consistently succeed with
+			# --autounmask-backtrack=n.
 		)
 
 		playground = ResolverPlayground(ebuilds=ebuilds, installed=installed,


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-28  5:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-28  5:56 [gentoo-commits] proj/portage:master commit in: pym/_emerge/, man/, pym/portage/tests/resolver/ Zac Medico
  -- strict thread matches above, loose matches on Subject: below --
2017-12-19 22:46 Michał Górny
2017-05-14 18:12 Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox