public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCH 1/2] Add a unit test which reproduces bug 584626
@ 2016-06-23  7:38 Zac Medico
  2016-06-23  7:38 ` [gentoo-portage-dev] [PATCH 2/2] depgraph: fix missed llvm update (bug 584626) Zac Medico
  0 siblings, 1 reply; 5+ messages in thread
From: Zac Medico @ 2016-06-23  7:38 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Zac Medico

X-Gentoo-Bug: 584626
X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=584626
---
 .../resolver/test_slot_operator_reverse_deps.py    | 109 +++++++++++++++++++++
 1 file changed, 109 insertions(+)
 create mode 100644 pym/portage/tests/resolver/test_slot_operator_reverse_deps.py

diff --git a/pym/portage/tests/resolver/test_slot_operator_reverse_deps.py b/pym/portage/tests/resolver/test_slot_operator_reverse_deps.py
new file mode 100644
index 0000000..72879f8
--- /dev/null
+++ b/pym/portage/tests/resolver/test_slot_operator_reverse_deps.py
@@ -0,0 +1,109 @@
+# Copyright 2016 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 SlotOperatorReverseDepsTestCase(TestCase):
+
+	def testSlotOperatorReverseDeps(self):
+
+		ebuilds = {
+
+			"media-libs/mesa-11.2.2" : {
+				"EAPI": "6",
+				"SLOT": "0",
+				"RDEPEND": ">=sys-devel/llvm-3.6.0:="
+			},
+
+			"sys-devel/clang-3.7.1-r100" : {
+				"EAPI": "6",
+				"SLOT": "0/3.7",
+				"RDEPEND": "~sys-devel/llvm-3.7.1"
+			},
+
+			"sys-devel/clang-3.8.0-r100" : {
+				"EAPI": "6",
+				"SLOT": "0/3.8",
+				"RDEPEND": "~sys-devel/llvm-3.8.0"
+			},
+
+			"sys-devel/llvm-3.7.1-r2" : {
+				"EAPI": "6",
+				"SLOT": "0/3.7.1",
+				"PDEPEND": "=sys-devel/clang-3.7.1-r100"
+			},
+
+			"sys-devel/llvm-3.8.0-r2" : {
+				"EAPI": "6",
+				"SLOT": "0/3.8.0",
+				"PDEPEND": "=sys-devel/clang-3.8.0-r100"
+			},
+
+		}
+
+		installed = {
+
+			"media-libs/mesa-11.2.2" : {
+				"EAPI": "6",
+				"SLOT": "0",
+				"RDEPEND": ">=sys-devel/llvm-3.6.0:0/3.7.1="
+			},
+
+			"sys-devel/clang-3.7.1-r100" : {
+				"EAPI": "6",
+				"SLOT": "0/3.7",
+				"RDEPEND": "~sys-devel/llvm-3.7.1"
+			},
+
+			"sys-devel/llvm-3.7.1-r2" : {
+				"EAPI": "6",
+				"SLOT": "0/3.7.1",
+				"PDEPEND": "=sys-devel/clang-3.7.1-r100"
+			},
+
+		}
+
+		world = ["media-libs/mesa"]
+
+		test_cases = (
+
+			# Test bug #584626, where an llvm update is missed due to
+			# the check_reverse_dependencies function seeing that
+			# updating llvm will break a dependency of the installed
+			# version of clang (though a clang update is available).
+			ResolverPlaygroundTestCase(
+				["@world"],
+				options = {"--update": True, "--deep": True},
+				success = True,
+				mergelist = [],
+			),
+
+			ResolverPlaygroundTestCase(
+				["@world"],
+				options = {
+					"--update": True,
+					"--deep": True,
+					"--ignore-built-slot-operator-deps": "y",
+				},
+				success = True,
+				mergelist = [
+					'sys-devel/llvm-3.8.0-r2',
+					'sys-devel/clang-3.8.0-r100',
+				],
+			),
+
+		)
+
+		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()
-- 
2.7.4



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

* [gentoo-portage-dev] [PATCH 2/2] depgraph: fix missed llvm update (bug 584626)
  2016-06-23  7:38 [gentoo-portage-dev] [PATCH 1/2] Add a unit test which reproduces bug 584626 Zac Medico
@ 2016-06-23  7:38 ` Zac Medico
  2016-06-23  8:03   ` [gentoo-portage-dev] " Zac Medico
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Zac Medico @ 2016-06-23  7:38 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Zac Medico

Fix check_reverse_dependencies to ignore dependencies of parent packages
for which updates are desirable, and add required  _want_update_pkg
support for DependencyArg parents. This solves a missed llvm update by
ignoring a reverse dependency from the installed instance of clang,
since an update to a newer version of clang is desirable.

In order to cope with this change, there are 2 existing unit tests
that require larger --backtrack settings in order to succeed.

X-Gentoo-Bug: 584626
X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=584626
---
 pym/_emerge/depgraph.py                            | 40 ++++++++++++++++++++--
 .../soname/test_slot_conflict_reinstall.py         |  1 +
 .../tests/resolver/test_slot_conflict_rebuild.py   |  2 +-
 .../resolver/test_slot_operator_reverse_deps.py    |  6 +++-
 4 files changed, 44 insertions(+), 5 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index f78f08d..ef3cc5d 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -1822,6 +1822,22 @@ class depgraph(object):
 						# necessarily relevant.
 						continue
 
+					if (not self._frozen_config.excluded_pkgs.
+						findAtomForPackage(parent,
+						modified_use=self._pkg_use_enabled(parent)) and
+						self._upgrade_available(parent)):
+						want_update = False
+						for grandparent in self._dynamic_config.digraph.\
+							parent_nodes(parent):
+							if self._want_update_pkg(grandparent, parent):
+								want_update = True
+								break
+
+						if want_update:
+							# This parent may be irrelevant, since an
+							# update is available (see bug 584626).
+							continue
+
 				atom_set = InternalPackageSet(initial_atoms=(atom,),
 					allow_repo=True)
 				if not atom_set.findAtomForPackage(candidate_pkg,
@@ -2113,6 +2129,19 @@ class depgraph(object):
 
 		self._dynamic_config._need_restart = True
 
+	def _upgrade_available(self, pkg):
+		"""
+		Detect cases where an upgrade of the given package is available
+		within the same slot.
+		"""
+		available_pkg = None
+		for available_pkg in self._iter_similar_available(pkg,
+			pkg.slot_atom):
+			if available_pkg >= pkg:
+				return True
+
+		return False
+
 	def _downgrade_probe(self, pkg):
 		"""
 		Detect cases where a downgrade of the given package is considered
@@ -5382,9 +5411,14 @@ class depgraph(object):
 				# should have been masked before it was selected
 				raise
 
-		depth = parent.depth or 0
-		if isinstance(depth, int):
-			depth += 1
+		if isinstance(parent, Package):
+			depth = parent.depth or 0
+			if isinstance(depth, int):
+				depth += 1
+		elif parent.reset_depth:
+			depth = 0
+		else:
+			depth = self._UNREACHABLE_DEPTH
 
 		if arg_atoms:
 			for arg, atom in arg_atoms:
diff --git a/pym/portage/tests/resolver/soname/test_slot_conflict_reinstall.py b/pym/portage/tests/resolver/soname/test_slot_conflict_reinstall.py
index 40e6995..f474761 100644
--- a/pym/portage/tests/resolver/soname/test_slot_conflict_reinstall.py
+++ b/pym/portage/tests/resolver/soname/test_slot_conflict_reinstall.py
@@ -89,6 +89,7 @@ class SonameSlotConflictReinstallTestCase(TestCase):
 					"--ignore-soname-deps": "n",
 					"--update": True,
 					"--usepkgonly": True,
+					"--backtrack": 10,
 				},
 				success = True,
 				mergelist = [
diff --git a/pym/portage/tests/resolver/test_slot_conflict_rebuild.py b/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
index b39eaf0..2dfa79c 100644
--- a/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
+++ b/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
@@ -91,7 +91,7 @@ class SlotConflictRebuildTestCase(TestCase):
 			# upgrade and we don't want to trigger unnecessary rebuilds.
 			ResolverPlaygroundTestCase(
 				["@world"],
-				options = {"--update": True, "--deep": True},
+				options = {"--update": True, "--deep": True, "--backtrack": 4},
 				success = True,
 				mergelist = ["app-misc/D-2", "app-misc/E-0"]),
 
diff --git a/pym/portage/tests/resolver/test_slot_operator_reverse_deps.py b/pym/portage/tests/resolver/test_slot_operator_reverse_deps.py
index 72879f8..ce614a4 100644
--- a/pym/portage/tests/resolver/test_slot_operator_reverse_deps.py
+++ b/pym/portage/tests/resolver/test_slot_operator_reverse_deps.py
@@ -79,7 +79,11 @@ class SlotOperatorReverseDepsTestCase(TestCase):
 				["@world"],
 				options = {"--update": True, "--deep": True},
 				success = True,
-				mergelist = [],
+				mergelist = [
+					'sys-devel/llvm-3.8.0-r2',
+					'sys-devel/clang-3.8.0-r100',
+					'media-libs/mesa-11.2.2',
+				],
 			),
 
 			ResolverPlaygroundTestCase(
-- 
2.7.4



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

* [gentoo-portage-dev] Re: [PATCH 2/2] depgraph: fix missed llvm update (bug 584626)
  2016-06-23  7:38 ` [gentoo-portage-dev] [PATCH 2/2] depgraph: fix missed llvm update (bug 584626) Zac Medico
@ 2016-06-23  8:03   ` Zac Medico
  2016-06-23  9:24   ` Zac Medico
  2016-06-23 10:11   ` [gentoo-portage-dev] [PATCH 2/2 v2] " Zac Medico
  2 siblings, 0 replies; 5+ messages in thread
From: Zac Medico @ 2016-06-23  8:03 UTC (permalink / raw
  To: gentoo-portage-dev

On 06/23/2016 12:38 AM, Zac Medico wrote:
> @@ -2113,6 +2129,19 @@ class depgraph(object):
>  
>  		self._dynamic_config._need_restart = True
>  
> +	def _upgrade_available(self, pkg):
> +		"""
> +		Detect cases where an upgrade of the given package is available
> +		within the same slot.
> +		"""
> +		available_pkg = None
> +		for available_pkg in self._iter_similar_available(pkg,
> +			pkg.slot_atom):
> +			if available_pkg >= pkg:
> +				return True
> +
> +		return False
> +

I've fixed this method to use the > operator instead of the >= operator.
The latest version is in my branch here:

https://github.com/zmedico/portage/tree/bug_584626

I've also opened this pull request so that travis runs the tests:

https://github.com/gentoo/portage/pull/29
-- 
Thanks,
Zac


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

* [gentoo-portage-dev] Re: [PATCH 2/2] depgraph: fix missed llvm update (bug 584626)
  2016-06-23  7:38 ` [gentoo-portage-dev] [PATCH 2/2] depgraph: fix missed llvm update (bug 584626) Zac Medico
  2016-06-23  8:03   ` [gentoo-portage-dev] " Zac Medico
@ 2016-06-23  9:24   ` Zac Medico
  2016-06-23 10:11   ` [gentoo-portage-dev] [PATCH 2/2 v2] " Zac Medico
  2 siblings, 0 replies; 5+ messages in thread
From: Zac Medico @ 2016-06-23  9:24 UTC (permalink / raw
  To: gentoo-portage-dev

On 06/23/2016 12:38 AM, Zac Medico wrote:
> diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
> index f78f08d..ef3cc5d 100644
> --- a/pym/_emerge/depgraph.py
> +++ b/pym/_emerge/depgraph.py
> @@ -1822,6 +1822,22 @@ class depgraph(object):
>  						# necessarily relevant.
>  						continue
>  
> +					if (not self._frozen_config.excluded_pkgs.
> +						findAtomForPackage(parent,
> +						modified_use=self._pkg_use_enabled(parent)) and
> +						self._upgrade_available(parent)):
> +						want_update = False
> +						for grandparent in self._dynamic_config.digraph.\
> +							parent_nodes(parent):
> +							if self._want_update_pkg(grandparent, parent):
> +								want_update = True
> +								break
> +
> +						if want_update:
> +							# This parent may be irrelevant, since an
> +							# update is available (see bug 584626).
> +							continue
> +

I've simplified this as follows:

	if (not self._too_deep(parent.depth) and
		not self._frozen_config.excluded_pkgs.
		findAtomForPackage(parent,
		modified_use=self._pkg_use_enabled(parent)) and
		self._upgrade_available(parent)):
		# This parent may be irrelevant, since an
		# update is available (see bug 584626).
		continue

-- 
Thanks,
Zac


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

* [gentoo-portage-dev] [PATCH 2/2 v2] depgraph: fix missed llvm update (bug 584626)
  2016-06-23  7:38 ` [gentoo-portage-dev] [PATCH 2/2] depgraph: fix missed llvm update (bug 584626) Zac Medico
  2016-06-23  8:03   ` [gentoo-portage-dev] " Zac Medico
  2016-06-23  9:24   ` Zac Medico
@ 2016-06-23 10:11   ` Zac Medico
  2 siblings, 0 replies; 5+ messages in thread
From: Zac Medico @ 2016-06-23 10:11 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Zac Medico

Fix check_reverse_dependencies to ignore dependencies of parent packages
for which updates are desirable. This solves a missed llvm update by
ignoring a reverse dependency from the installed instance of clang,
since an update to a newer version of clang is desirable.

In order to cope with this change, there are 2 existing unit tests
that require larger --backtrack settings in order to succeed.

X-Gentoo-Bug: 584626
X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=584626
---
[PATCH 2/2 v2]
* use > operator instead of >= in _upgrade_available
* simplify check_reverse_dependencies changes, using _too_deep

 pym/_emerge/depgraph.py                             | 21 +++++++++++++++++++++
 .../resolver/soname/test_slot_conflict_reinstall.py |  1 +
 .../tests/resolver/test_slot_conflict_rebuild.py    |  2 +-
 .../resolver/test_slot_operator_reverse_deps.py     |  6 +++++-
 4 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index f78f08d..c1c37b4 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -1822,6 +1822,15 @@ class depgraph(object):
 						# necessarily relevant.
 						continue
 
+					if (not self._too_deep(parent.depth) and
+						not self._frozen_config.excluded_pkgs.
+						findAtomForPackage(parent,
+						modified_use=self._pkg_use_enabled(parent)) and
+						self._upgrade_available(parent)):
+						# This parent may be irrelevant, since an
+						# update is available (see bug 584626).
+						continue
+
 				atom_set = InternalPackageSet(initial_atoms=(atom,),
 					allow_repo=True)
 				if not atom_set.findAtomForPackage(candidate_pkg,
@@ -2113,6 +2122,18 @@ class depgraph(object):
 
 		self._dynamic_config._need_restart = True
 
+	def _upgrade_available(self, pkg):
+		"""
+		Detect cases where an upgrade of the given package is available
+		within the same slot.
+		"""
+		for available_pkg in self._iter_similar_available(pkg,
+			pkg.slot_atom):
+			if available_pkg > pkg:
+				return True
+
+		return False
+
 	def _downgrade_probe(self, pkg):
 		"""
 		Detect cases where a downgrade of the given package is considered
diff --git a/pym/portage/tests/resolver/soname/test_slot_conflict_reinstall.py b/pym/portage/tests/resolver/soname/test_slot_conflict_reinstall.py
index 40e6995..f474761 100644
--- a/pym/portage/tests/resolver/soname/test_slot_conflict_reinstall.py
+++ b/pym/portage/tests/resolver/soname/test_slot_conflict_reinstall.py
@@ -89,6 +89,7 @@ class SonameSlotConflictReinstallTestCase(TestCase):
 					"--ignore-soname-deps": "n",
 					"--update": True,
 					"--usepkgonly": True,
+					"--backtrack": 10,
 				},
 				success = True,
 				mergelist = [
diff --git a/pym/portage/tests/resolver/test_slot_conflict_rebuild.py b/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
index b39eaf0..2dfa79c 100644
--- a/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
+++ b/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
@@ -91,7 +91,7 @@ class SlotConflictRebuildTestCase(TestCase):
 			# upgrade and we don't want to trigger unnecessary rebuilds.
 			ResolverPlaygroundTestCase(
 				["@world"],
-				options = {"--update": True, "--deep": True},
+				options = {"--update": True, "--deep": True, "--backtrack": 4},
 				success = True,
 				mergelist = ["app-misc/D-2", "app-misc/E-0"]),
 
diff --git a/pym/portage/tests/resolver/test_slot_operator_reverse_deps.py b/pym/portage/tests/resolver/test_slot_operator_reverse_deps.py
index 72879f8..ce614a4 100644
--- a/pym/portage/tests/resolver/test_slot_operator_reverse_deps.py
+++ b/pym/portage/tests/resolver/test_slot_operator_reverse_deps.py
@@ -79,7 +79,11 @@ class SlotOperatorReverseDepsTestCase(TestCase):
 				["@world"],
 				options = {"--update": True, "--deep": True},
 				success = True,
-				mergelist = [],
+				mergelist = [
+					'sys-devel/llvm-3.8.0-r2',
+					'sys-devel/clang-3.8.0-r100',
+					'media-libs/mesa-11.2.2',
+				],
 			),
 
 			ResolverPlaygroundTestCase(
-- 
2.7.4



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

end of thread, other threads:[~2016-06-23 10:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-23  7:38 [gentoo-portage-dev] [PATCH 1/2] Add a unit test which reproduces bug 584626 Zac Medico
2016-06-23  7:38 ` [gentoo-portage-dev] [PATCH 2/2] depgraph: fix missed llvm update (bug 584626) Zac Medico
2016-06-23  8:03   ` [gentoo-portage-dev] " Zac Medico
2016-06-23  9:24   ` Zac Medico
2016-06-23 10:11   ` [gentoo-portage-dev] [PATCH 2/2 v2] " Zac Medico

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