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

commit:     033477d6a4cc1adcabed966b8aa82b51b42af33c
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Jan  4 00:54:47 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Jan  4 23:40:42 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=033477d6

_dep_check_composite_db: select highest in slot conflict (bug 554070)

Fix the _dep_check_composite_db._visible method to select the highest
version involved in a slot conflict, for consistency with the change
in ab07ac68fa1e04ed64e2e0f6c753ff169a32d517. The included unit test
fails without this fix.

Fixes: ab07ac68fa1e ("depgraph: select highest version involved in slot conflict (bug 554070)")
X-Gentoo-Bug: 554070
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=554070
Acked-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/_emerge/depgraph.py                            |  10 +-
 .../resolver/test_imagemagick_graphicsmagick.py    | 104 +++++++++++++++++++++
 2 files changed, 111 insertions(+), 3 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index e298337..7a1427d 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -1,4 +1,4 @@
-# Copyright 1999-2016 Gentoo Foundation
+# Copyright 1999-2017 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 from __future__ import division, print_function, unicode_literals
@@ -9130,8 +9130,12 @@ class _dep_check_composite_db(dbapi):
 			# into the same slot.
 			return True
 
-		in_graph = next(self._depgraph._dynamic_config._package_tracker.match(
-			self._root, pkg.slot_atom, installed=False), None)
+		# Use reversed iteration in order to get descending order here,
+		# so that the highest version involved in a slot conflict is
+		# selected (see bug 554070).
+		in_graph = next(reversed(list(
+			self._depgraph._dynamic_config._package_tracker.match(
+			self._root, pkg.slot_atom, installed=False))), None)
 
 		if in_graph is None:
 			# Mask choices for packages which are not the highest visible

diff --git a/pym/portage/tests/resolver/test_imagemagick_graphicsmagick.py b/pym/portage/tests/resolver/test_imagemagick_graphicsmagick.py
new file mode 100644
index 0000000..e5a3d7d
--- /dev/null
+++ b/pym/portage/tests/resolver/test_imagemagick_graphicsmagick.py
@@ -0,0 +1,104 @@
+# Copyright 2017 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 ImageMagickGraphicsMagickTestCase(TestCase):
+
+	def testImageMagickUpdate(self):
+
+		ebuilds = {
+			"media-gfx/imagemagick-6.9.7.0" : {
+				"EAPI": "6",
+				"SLOT": "0/6.9.7.0",
+			},
+
+			"media-gfx/imagemagick-6.9.6.6" : {
+				"EAPI": "6",
+				"SLOT": "0/6.9.6.6",
+			},
+
+			"media-gfx/inkscape-0.91-r3" : {
+				"EAPI": "6",
+				"DEPEND": "media-gfx/imagemagick:=",
+				"RDEPEND": "media-gfx/imagemagick:=",
+			},
+
+			"media-video/dvdrip-0.98.11-r3" : {
+				"EAPI": "6",
+				"DEPEND": "|| ( media-gfx/graphicsmagick[imagemagick] media-gfx/imagemagick )",
+				"RDEPEND": "|| ( media-gfx/graphicsmagick[imagemagick] media-gfx/imagemagick )",
+			},
+
+			"media-gfx/graphicsmagick-1.3.25" : {
+				"EAPI": "6",
+				"SLOT": "0/1.3",
+				"IUSE": "imagemagick",
+				"RDEPEND": "imagemagick? ( !media-gfx/imagemagick )",
+			},
+		}
+
+		installed = {
+			"media-gfx/imagemagick-6.9.6.6" : {
+				"EAPI": "6",
+				"SLOT": "0/6.9.6.6",
+			},
+
+			"media-gfx/inkscape-0.91-r3" : {
+				"EAPI": "6",
+				"DEPEND": "media-gfx/imagemagick:0/6.9.6.6=",
+				"RDEPEND": "media-gfx/imagemagick:0/6.9.6.6=",
+			},
+
+			"media-video/dvdrip-0.98.11-r3" : {
+				"EAPI": "6",
+				"DEPEND": "|| ( media-gfx/graphicsmagick[imagemagick] media-gfx/imagemagick )",
+				"RDEPEND": "|| ( media-gfx/graphicsmagick[imagemagick] media-gfx/imagemagick )",
+			},
+
+			"media-gfx/graphicsmagick-1.3.25" : {
+				"EAPI": "6",
+				"SLOT": "0/1.3",
+				"IUSE": "imagemagick",
+				"USE": "",
+				"RDEPEND": "imagemagick? ( !media-gfx/imagemagick )",
+			},
+		}
+
+		world = (
+			"media-gfx/inkscape",
+			"media-video/dvdrip",
+			"media-gfx/graphicsmagick",
+		)
+
+		test_cases = (
+
+			# bug #554070: imagemagick upgrade triggered erroneous
+			# autounmask USE change for media-gfx/graphicsmagick[imagemagick]
+			ResolverPlaygroundTestCase(
+				["media-gfx/imagemagick", "@world"],
+				options = {"--update": True, "--deep": True},
+				success = True,
+				mergelist = [
+					"media-gfx/imagemagick-6.9.7.0",
+					"media-gfx/inkscape-0.91-r3"
+				]
+			),
+
+		)
+
+		playground = ResolverPlayground(debug=False,
+			ebuilds=ebuilds, installed=installed, world=world)
+		try:
+			for test_case in test_cases:
+				playground.run_TestCase(test_case)
+				self.assertEqual(test_case.test_success, True,
+					test_case.fail_msg)
+		finally:
+			# Disable debug so that cleanup works.
+			playground.debug = False
+			playground.cleanup()


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

* [gentoo-commits] proj/portage:master commit in: pym/_emerge/, pym/portage/tests/resolver/
@ 2017-03-18  9:38 Zac Medico
  0 siblings, 0 replies; 5+ messages in thread
From: Zac Medico @ 2017-03-18  9:38 UTC (permalink / raw
  To: gentoo-commits

commit:     e309323f156528a8a79a1f755e1326e8880346b7
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 18 03:27:56 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Mar 18 09:30:18 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=e309323f

emerge: fix --use-ebuild-visibility to reject binary packages (bug 612960)

Fix the --use-ebuild-visibility option to reject binary packages for
which ebuilds are either masked or unavailable. The included test case
fails without this fix.

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

 pym/_emerge/depgraph.py                            |  34 +++++-
 .../resolver/test_binary_pkg_ebuild_visibility.py  | 118 +++++++++++++++++++++
 2 files changed, 149 insertions(+), 3 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index e94b96ce8..543f4dc78 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -4889,6 +4889,9 @@ class depgraph(object):
 		vardb = self._frozen_config.roots[root].trees["vartree"].dbapi
 		bindb = self._frozen_config.roots[root].trees["bintree"].dbapi
 		dbs = self._dynamic_config._filtered_trees[root]["dbs"]
+		use_ebuild_visibility = self._frozen_config.myopts.get(
+			'--use-ebuild-visibility', 'n') != 'n'
+
 		for db, pkg_type, built, installed, db_keys in dbs:
 			if installed:
 				continue
@@ -4975,6 +4978,7 @@ class depgraph(object):
 								eapi=pkg.eapi):
 								required_use_unsatisfied.append(pkg)
 								continue
+
 						root_slot = (pkg.root, pkg.slot_atom)
 						if pkg.built and root_slot in self._rebuild.rebuild_list:
 							mreasons = ["need to rebuild from source"]
@@ -4988,6 +4992,21 @@ class depgraph(object):
 							self._dynamic_config.ignored_binaries.get(
 							pkg, {}).get("changed_deps")):
 							mreasons = ["changed deps"]
+						elif (pkg.built and use_ebuild_visibility and
+							not self._equiv_ebuild_visible(pkg)):
+							equiv_ebuild = self._equiv_ebuild(pkg)
+							if equiv_ebuild is None:
+								if portdb.cpv_exists(pkg.cpv):
+									mreasons = ["ebuild corrupt"]
+								else:
+									mreasons = ["ebuild not available"]
+							elif not mreasons:
+								mreasons = get_masking_status(
+									equiv_ebuild, pkgsettings, root_config,
+									use=self._pkg_use_enabled(equiv_ebuild))
+								if mreasons:
+									metadata = equiv_ebuild._metadata
+
 					masked_packages.append(
 						(root_config, pkgsettings, cpv, repo, metadata, mreasons))
 
@@ -5548,6 +5567,14 @@ class depgraph(object):
 		"""
 		return depth + n if isinstance(depth, int) else depth
 
+	def _equiv_ebuild(self, pkg):
+		try:
+			return self._pkg(
+				pkg.cpv, "ebuild", pkg.root_config, myrepo=pkg.repo)
+		except portage.exception.PackageNotFound:
+			return next(self._iter_match_pkgs(pkg.root_config,
+				"ebuild", Atom("=%s" % (pkg.cpv,))), None)
+
 	def _equiv_ebuild_visible(self, pkg, autounmask_level=None):
 		try:
 			pkg_eb = self._pkg(
@@ -6021,11 +6048,11 @@ class depgraph(object):
 						# reinstall the same exact version only due
 						# to a KEYWORDS mask. See bug #252167.
 
+						identical_binary = False
 						if pkg.type_name != "ebuild" and matched_packages:
 							# Don't re-install a binary package that is
 							# identical to the currently installed package
 							# (see bug #354441).
-							identical_binary = False
 							if usepkg and pkg.installed:
 								for selected_pkg in matched_packages:
 									if selected_pkg.type_name == "binary" and \
@@ -6035,12 +6062,13 @@ class depgraph(object):
 										identical_binary = True
 										break
 
-							if not identical_binary:
+						if not identical_binary and pkg.built:
 								# If the ebuild no longer exists or it's
 								# keywords have been dropped, reject built
 								# instances (installed or binary).
 								# If --usepkgonly is enabled, assume that
-								# the ebuild status should be ignored.
+								# the ebuild status should be ignored unless
+								# --use-ebuild-visibility has been specified.
 								if not use_ebuild_visibility and (usepkgonly or useoldpkg):
 									if pkg.installed and pkg.masks:
 										continue

diff --git a/pym/portage/tests/resolver/test_binary_pkg_ebuild_visibility.py b/pym/portage/tests/resolver/test_binary_pkg_ebuild_visibility.py
new file mode 100644
index 000000000..ea65abded
--- /dev/null
+++ b/pym/portage/tests/resolver/test_binary_pkg_ebuild_visibility.py
@@ -0,0 +1,118 @@
+# Copyright 2017 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 BinaryPkgEbuildVisibilityTestCase(TestCase):
+
+	def testBinaryPkgEbuildVisibility(self):
+
+		binpkgs = {
+			"app-misc/foo-3" : {},
+			"app-misc/foo-2" : {},
+			"app-misc/foo-1" : {},
+		}
+
+		ebuilds = {
+			"app-misc/foo-2" : {},
+			"app-misc/foo-1" : {},
+		}
+
+		installed = {
+			"app-misc/foo-1" : {},
+		}
+
+		world = ["app-misc/foo"]
+
+		test_cases = (
+
+			# Test bug #612960, where --use-ebuild-visibility failed
+			# to reject binary packages for which ebuilds were not
+			# available.
+			ResolverPlaygroundTestCase(
+				["@world"],
+				options = {
+					"--update": True,
+					"--deep": True,
+					"--use-ebuild-visibility": 'y',
+					"--usepkgonly": True,
+				},
+				success = True,
+				mergelist = [
+					'[binary]app-misc/foo-2',
+				],
+			),
+
+			ResolverPlaygroundTestCase(
+				["@world"],
+				options = {
+					"--update": True,
+					"--deep": True,
+					"--usepkgonly": True,
+				},
+				success = True,
+				mergelist = [
+					'[binary]app-misc/foo-3',
+				],
+			),
+
+			ResolverPlaygroundTestCase(
+				["@world"],
+				options = {
+					"--update": True,
+					"--deep": True,
+					"--usepkg": True,
+				},
+				success = True,
+				mergelist = [
+					'[binary]app-misc/foo-2',
+				],
+			),
+
+			ResolverPlaygroundTestCase(
+				["=app-misc/foo-3"],
+				options = {
+					"--use-ebuild-visibility": 'y',
+					"--usepkgonly": True,
+				},
+				success = False,
+			),
+
+			ResolverPlaygroundTestCase(
+				["app-misc/foo"],
+				options = {
+					"--use-ebuild-visibility": 'y',
+					"--usepkgonly": True,
+				},
+				success = True,
+				mergelist = [
+					'[binary]app-misc/foo-2',
+				],
+			),
+
+			ResolverPlaygroundTestCase(
+				["app-misc/foo"],
+				options = {
+					"--usepkgonly": True,
+				},
+				success = True,
+				mergelist = [
+					'[binary]app-misc/foo-3',
+				],
+			),
+		)
+
+		playground = ResolverPlayground(binpkgs=binpkgs, ebuilds=ebuilds,
+			installed=installed, world=world)
+		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()
+


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

* [gentoo-commits] proj/portage:master commit in: pym/_emerge/, pym/portage/tests/resolver/
@ 2017-10-02 19:03 Zac Medico
  0 siblings, 0 replies; 5+ messages in thread
From: Zac Medico @ 2017-10-02 19:03 UTC (permalink / raw
  To: gentoo-commits

commit:     d39e0532674d78436e78c035143163001dbb198f
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Oct  1 01:13:50 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Oct  2 19:03:03 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=d39e0532

want_restart_for_use_change: backtrack only if needed (bug 632598)

Only backtrack if changes break a USE dependency. Prior
to this fix, the included test case succeeded only with
a --backtrack setting of 3 or more, but now it succeeds
with a --backtrack setting of 2.

X-Gentoo-bug: 632598
X-Gentoo-bug-url: https://bugs.gentoo.org/632598
Acked-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/_emerge/depgraph.py                            | 13 +++-
 .../resolver/test_autounmask_use_backtrack.py      | 86 ++++++++++++++++++++++
 2 files changed, 95 insertions(+), 4 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index b0149c4dc..0b9b98dbb 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -5972,11 +5972,16 @@ class depgraph(object):
 
 			new_use, changes = self._dynamic_config._needed_use_config_changes.get(pkg)
 			for ppkg, atom in parent_atoms:
-				if not atom.use or \
-					not any(x in atom.use.required for x in changes):
+				if not atom.use:
 					continue
-				else:
-					return True
+
+				# Backtrack only if changes break a USE dependency.
+				enabled = atom.use.enabled
+				disabled = atom.use.disabled
+				for k, v in changes.items():
+					want_enabled = k in enabled
+					if (want_enabled or k in disabled) and want_enabled != v:
+						return True
 
 			return False
 

diff --git a/pym/portage/tests/resolver/test_autounmask_use_backtrack.py b/pym/portage/tests/resolver/test_autounmask_use_backtrack.py
new file mode 100644
index 000000000..83edeafa4
--- /dev/null
+++ b/pym/portage/tests/resolver/test_autounmask_use_backtrack.py
@@ -0,0 +1,86 @@
+# Copyright 2017 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 AutounmaskUseBacktrackTestCase(TestCase):
+
+	def testAutounmaskUseBacktrack(self):
+		ebuilds = {
+			'dev-libs/A-1': {
+				'EAPI': '6',
+				'RDEPEND': 'dev-libs/C',
+			},
+			'dev-libs/A-2': {
+				'EAPI': '6',
+				'RDEPEND': 'dev-libs/C[y]',
+			},
+			'dev-libs/A-3': {
+				'EAPI': '6',
+				'RDEPEND': 'dev-libs/C',
+			},
+			'dev-libs/B-1': {
+				'EAPI': '6',
+				'RDEPEND': '<dev-libs/A-3',
+			},
+			'dev-libs/C-1': {
+				'EAPI': '6',
+				'IUSE': 'x y z',
+			},
+			'dev-libs/D-1': {
+				'EAPI': '6',
+				'RDEPEND': '>=dev-libs/A-2 dev-libs/C[x]',
+			},
+		}
+
+		installed = {
+			'dev-libs/A-1': {
+				'EAPI': '6',
+				'RDEPEND': 'dev-libs/C',
+			},
+			'dev-libs/B-1': {
+				'EAPI': '6',
+				'RDEPEND': '<dev-libs/A-3',
+			},
+			'dev-libs/C-1': {
+				'EAPI': '6',
+				'IUSE': 'x y z',
+			},
+		}
+
+		world = ['dev-libs/B']
+
+		test_cases = (
+			# Test bug 632598, where autounmask USE changes triggered
+			# unnecessary backtracking. The following case should
+			# require a --backtrack setting no larger than 2.
+			ResolverPlaygroundTestCase(
+				['dev-libs/D'],
+				options={
+					'--autounmask-backtrack': 'y',
+					'--backtrack': 2,
+				},
+				success=False,
+				ambiguous_merge_order=True,
+				mergelist=[
+					('dev-libs/C-1', 'dev-libs/A-2'),
+					'dev-libs/D-1',
+				],
+				use_changes={'dev-libs/C-1': {'y': True, 'x': True}},
+			),
+		)
+
+		playground = ResolverPlayground(
+			ebuilds=ebuilds, installed=installed, world=world)
+
+		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()


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

* [gentoo-commits] proj/portage:master commit in: pym/_emerge/, pym/portage/tests/resolver/
@ 2017-12-07 19:09 Zac Medico
  0 siblings, 0 replies; 5+ messages in thread
From: Zac Medico @ 2017-12-07 19:09 UTC (permalink / raw
  To: gentoo-commits

commit:     09185309aad49b83f29ef94b11318998e520e138
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Dec  3 22:36:45 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Dec  7 19:08:21 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=09185309

depgraph: eval disjunctive build deps earlier (bug 639346)

Since built-time deps tend to be a superset of run-time deps, evaluate
disjunctive build-time deps before run-time deps, so that choices for
build-time deps influence choices for run-time deps.

Also, fix OnlydepsMinimalTestCase to specify ambiguous_merge_order,
since the merge order is affected by the order of evaluation.

Bug: https://bugs.gentoo.org/639346
Acked-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/_emerge/depgraph.py                            | 12 ++-
 .../resolver/test_disjunctive_depend_order.py      | 87 ++++++++++++++++++++++
 .../tests/resolver/test_onlydeps_minimal.py        |  5 +-
 3 files changed, 98 insertions(+), 6 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index f54acdc26..6e5ca6508 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -3234,7 +3234,15 @@ class depgraph(object):
 			if ignore_hdepend_deps:
 				edepend["HDEPEND"] = ""
 
+		# Since build-time deps tend to be a superset of run-time deps, order
+		# dep processing such that build-time deps are popped from
+		# _dep_disjunctive_stack first, so that choices for build-time
+		# deps influence choices for run-time deps (bug 639346).
 		deps = (
+			(myroot, edepend["RDEPEND"],
+				self._priority(runtime=True)),
+			(myroot, edepend["PDEPEND"],
+				self._priority(runtime_post=True)),
 			(depend_root, edepend["DEPEND"],
 				self._priority(buildtime=True,
 				optional=(pkg.built or ignore_depend_deps),
@@ -3243,10 +3251,6 @@ class depgraph(object):
 				self._priority(buildtime=True,
 				optional=(pkg.built or ignore_hdepend_deps),
 				ignored=ignore_hdepend_deps)),
-			(myroot, edepend["RDEPEND"],
-				self._priority(runtime=True)),
-			(myroot, edepend["PDEPEND"],
-				self._priority(runtime_post=True))
 		)
 
 		debug = "--debug" in self._frozen_config.myopts

diff --git a/pym/portage/tests/resolver/test_disjunctive_depend_order.py b/pym/portage/tests/resolver/test_disjunctive_depend_order.py
new file mode 100644
index 000000000..88f6dac2d
--- /dev/null
+++ b/pym/portage/tests/resolver/test_disjunctive_depend_order.py
@@ -0,0 +1,87 @@
+# Copyright 2017 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 DisjunctiveDependOrderTestCase(TestCase):
+
+	def testDisjunctiveDependOrderTestCase(self):
+		ebuilds = {
+			'virtual/jre-1.8': {
+				'EAPI': '6',
+				'SLOT' : '1.8',
+				'RDEPEND' : '|| ( dev-java/oracle-jre-bin:1.8 virtual/jdk:1.8 )',
+			},
+			'virtual/jdk-1.8': {
+				'EAPI': '6',
+				'SLOT' : '1.8',
+				'RDEPEND' : '|| ( dev-java/icedtea:8 dev-java/oracle-jdk-bin:1.8 )',
+			},
+			'dev-java/icedtea-3.6': {
+				'SLOT' : '8',
+			},
+			'dev-java/oracle-jdk-bin-1.8': {
+				'SLOT' : '1.8',
+			},
+			'dev-java/oracle-jre-bin-1.8': {
+				'SLOT' : '1.8',
+			},
+			'dev-db/hsqldb-1.8'       : {
+				'DEPEND' : 'virtual/jdk',
+				'RDEPEND' : 'virtual/jre',
+			},
+		}
+
+		binpkgs = {
+			'dev-db/hsqldb-1.8'       : {
+				'DEPEND' : 'virtual/jdk',
+				'RDEPEND' : 'virtual/jre',
+			},
+		}
+
+		test_cases = (
+			# Test bug 639346, where a redundant jre implementation
+			# was pulled in because DEPEND was evaluated after
+			# RDEPEND.
+			ResolverPlaygroundTestCase(
+				['dev-db/hsqldb'],
+				success=True,
+				mergelist=[
+					'dev-java/icedtea-3.6',
+					'virtual/jdk-1.8',
+					'virtual/jre-1.8',
+					'dev-db/hsqldb-1.8',
+				],
+			),
+
+			# The jdk is not needed with --usepkg, so the jre should
+			# be preferred in this case.
+			ResolverPlaygroundTestCase(
+				['dev-db/hsqldb'],
+				options = {
+					'--usepkg': True
+				},
+				success=True,
+				mergelist=[
+					'dev-java/oracle-jre-bin-1.8',
+					'virtual/jre-1.8',
+					'[binary]dev-db/hsqldb-1.8',
+				],
+			),
+		)
+
+		playground = ResolverPlayground(debug=False,
+			binpkgs=binpkgs, ebuilds=ebuilds)
+
+		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.debug = False
+			playground.cleanup()

diff --git a/pym/portage/tests/resolver/test_onlydeps_minimal.py b/pym/portage/tests/resolver/test_onlydeps_minimal.py
index 13c79ed55..efda02c59 100644
--- a/pym/portage/tests/resolver/test_onlydeps_minimal.py
+++ b/pym/portage/tests/resolver/test_onlydeps_minimal.py
@@ -25,9 +25,10 @@ class OnlydepsMinimalTestCase(TestCase):
 				success = True,
 				options = { "--onlydeps": True,
 				            "--onlydeps-with-rdeps": "y" },
-				mergelist = ["dev-libs/B-1",
+				ambiguous_merge_order = True,
+				mergelist = [("dev-libs/B-1",
 				             "dev-libs/C-1",
-				             "dev-libs/D-1"]),
+				             "dev-libs/D-1")]),
 			ResolverPlaygroundTestCase(
 				["dev-libs/A"],
 				all_permutations = True,


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

* [gentoo-commits] proj/portage:master commit in: pym/_emerge/, pym/portage/tests/resolver/
@ 2018-03-27 16:58 Zac Medico
  0 siblings, 0 replies; 5+ messages in thread
From: Zac Medico @ 2018-03-27 16:58 UTC (permalink / raw
  To: gentoo-commits

commit:     d7f2fbd4a649fc81f00a22eb1633a193a988b5da
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 26 07:11:19 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Mar 27 16:56:03 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=d7f2fbd4

emerge --autounmask: prevent unmask due to unsatisfied REQUIRED_USE (bug 622462)

Fix autounmask to generate USE changes that violate REQUIRED_USE, in
order to prevent it from trying to create inappropriate keywords or
package.unmask. This solves the problem reported in bug 622462, where
it inappropriately unmasked a newer version of qscintilla. With this
fix, it will generate USE changes that violate REQUIRED_USE, and then
report the issue as follows:

emerge: there are no ebuilds built with USE flags to satisfy ">=x11-libs/qscintilla-2.9.3-r2:=[qt5(+)]".
!!! One of the following packages is required to complete your request:
- x11-libs/qscintilla-2.9.4::test_repo (Change USE: +qt5, this change violates use flag constraints defined by x11-libs/qscintilla-2.9.4: 'exactly-one-of ( qt4 qt5 )')

Note that it may be possible for autounmask to try harder to solve
REQUIRED_USE in cases like this, but that it beyond the scope of this
bug fix. The only goal of this patch is to correctly handle the case
where satisfaction of REQUIRED_USE has failed.

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

 pym/_emerge/depgraph.py                       | 20 +++++++++++++++++---
 pym/portage/tests/resolver/test_autounmask.py | 25 ++++++++++++++++++++++++-
 2 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index f7ea27c37..ac7ec9d84 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -358,6 +358,13 @@ class _rebuild_config(object):
 		return need_restart
 
 
+class _use_changes(tuple):
+	def __new__(cls, new_use, new_changes, required_use_satisfied=True):
+		obj = tuple.__new__(cls, [new_use, new_changes])
+		obj.required_use_satisfied = required_use_satisfied
+		return obj
+
+
 class _dynamic_depgraph_config(object):
 
 	"""
@@ -6133,22 +6140,25 @@ class depgraph(object):
 
 		if new_changes != old_changes:
 			#Don't do the change if it violates REQUIRED_USE.
+			required_use_satisfied = True
 			required_use = pkg._metadata.get("REQUIRED_USE")
 			if required_use and check_required_use(required_use, old_use,
 				pkg.iuse.is_valid_flag, eapi=pkg.eapi) and \
 				not check_required_use(required_use, new_use,
 				pkg.iuse.is_valid_flag, eapi=pkg.eapi):
-				return old_use
+				required_use_satisfied = False
 
 			if any(x in pkg.use.mask for x in new_changes) or \
 				any(x in pkg.use.force for x in new_changes):
 				return old_use
 
-			self._dynamic_config._needed_use_config_changes[pkg] = (new_use, new_changes)
+			changes = _use_changes(new_use, new_changes,
+				required_use_satisfied=required_use_satisfied)
+			self._dynamic_config._needed_use_config_changes[pkg] = changes
 			backtrack_infos = self._dynamic_config._backtrack_infos
 			backtrack_infos.setdefault("config", {})
 			backtrack_infos["config"].setdefault("needed_use_config_changes", [])
-			backtrack_infos["config"]["needed_use_config_changes"].append((pkg, (new_use, new_changes)))
+			backtrack_infos["config"]["needed_use_config_changes"].append((pkg, changes))
 			if want_restart_for_use_change(pkg, new_use):
 				self._dynamic_config._need_restart = True
 		return new_use
@@ -9388,6 +9398,10 @@ class depgraph(object):
 		return self._dynamic_config._need_config_reload
 
 	def autounmask_breakage_detected(self):
+		# Check for REQUIRED_USE violations.
+		for changes in self._dynamic_config._needed_use_config_changes.values():
+			if getattr(changes, 'required_use_satisfied', None) is False:
+				return True
 		try:
 			for pargs, kwargs in self._dynamic_config._unsatisfied_deps_for_display:
 				self._show_unsatisfied_dep(

diff --git a/pym/portage/tests/resolver/test_autounmask.py b/pym/portage/tests/resolver/test_autounmask.py
index e2a7de028..9042349ea 100644
--- a/pym/portage/tests/resolver/test_autounmask.py
+++ b/pym/portage/tests/resolver/test_autounmask.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2012 Gentoo Foundation
+# Copyright 2010-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 from portage.tests import TestCase
@@ -61,6 +61,21 @@ class AutounmaskTestCase(TestCase):
 
 			"app-portage/B-1": { "IUSE": "foo +bar", "REQUIRED_USE": "^^ ( foo bar )", "EAPI": "4" },
 			"app-portage/C-1": { "IUSE": "+foo +bar", "REQUIRED_USE": "^^ ( foo bar )", "EAPI": "4" },
+
+			"sci-mathematics/octave-4.2.2": {
+				"EAPI": 6,
+				"RDEPEND": ">=x11-libs/qscintilla-2.9.3-r2:=[qt5(+)]",
+			},
+			"x11-libs/qscintilla-2.9.4": {
+				"EAPI": 6,
+				"IUSE": "+qt4 qt5",
+				"REQUIRED_USE": "^^ ( qt4 qt5 )",
+			},
+			"x11-libs/qscintilla-2.10": {
+				"EAPI": 6,
+				"KEYWORDS": "~x86",
+				"IUSE": "qt4 +qt5",
+			},
 			}
 
 		test_cases = (
@@ -252,6 +267,14 @@ class AutounmaskTestCase(TestCase):
 					use_changes=None,
 					success=False),
 
+				# Test bug 622462, where it inappropriately unmasked a newer
+				# version rather than report unsatisfied REQUIRED_USE.
+				ResolverPlaygroundTestCase(
+					["sci-mathematics/octave"],
+					options={"--autounmask": True},
+					use_changes=None,
+					success=False),
+
 				#Make sure we don't change masked/forced flags.
 				ResolverPlaygroundTestCase(
 					["dev-libs/E:1"],


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

end of thread, other threads:[~2018-03-27 16:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-27 16:58 [gentoo-commits] proj/portage:master commit in: pym/_emerge/, pym/portage/tests/resolver/ Zac Medico
  -- strict thread matches above, loose matches on Subject: below --
2017-12-07 19:09 Zac Medico
2017-10-02 19:03 Zac Medico
2017-03-18  9:38 Zac Medico
2017-01-04 23:53 Zac Medico

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