public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/, pym/portage/tests/resolver/
Date: Wed,  4 Jan 2017 23:53:44 +0000 (UTC)	[thread overview]
Message-ID: <1483573242.033477d6a4cc1adcabed966b8aa82b51b42af33c.zmedico@gentoo> (raw)

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()


             reply	other threads:[~2017-01-04 23:53 UTC|newest]

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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1483573242.033477d6a4cc1adcabed966b8aa82b51b42af33c.zmedico@gentoo \
    --to=zmedico@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox