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/portage/tests/resolver/, pym/portage/dep/
Date: Sun, 21 Jan 2018 00:22:15 +0000 (UTC)	[thread overview]
Message-ID: <1516493351.74d0f516a346c7fb6c52a2508ca16b8949b3b65f.zmedico@gentoo> (raw)

commit:     74d0f516a346c7fb6c52a2508ca16b8949b3b65f
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 21 00:00:02 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Jan 21 00:09:11 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=74d0f516

dep_zapdeps: exclude virtuals from new_slot_count (bug 645190)

Fix new_slot_count to exclude virtual packages, since they are considered
to have zero-cost. This solves an issue where the catalyst stage1 build
would unexpectedly pull in static-dev to satisfy virtual/dev-manager,
but eudev is the preferred choice.

Bug: https://bugs.gentoo.org/645190
Fixes: 9fdaf9bdbdf5 ("dep_check: use DNF to optimize overlapping virtual || deps (bug 632026)")
Reported-by: Ben Kohler <bkohler <AT> gmail.com>

 pym/portage/dep/dep_check.py                       |  3 +-
 .../resolver/test_virtual_minimize_children.py     | 61 ++++++++++++++++++++++
 2 files changed, 63 insertions(+), 1 deletion(-)

diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
index 7cf338819..c56f545ec 100644
--- a/pym/portage/dep/dep_check.py
+++ b/pym/portage/dep/dep_check.py
@@ -499,7 +499,8 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
 				cp_map[avail_pkg.cp] = avail_pkg
 
 		new_slot_count = (len(slot_map) if graph_db is None else
-			sum(not graph_db.match_pkgs(slot_atom) for slot_atom in slot_map))
+			sum(not graph_db.match_pkgs(slot_atom) for slot_atom in slot_map
+			if not slot_atom.cp.startswith("virtual/")))
 
 		this_choice = _dep_choice(atoms=atoms, slot_map=slot_map,
 			cp_map=cp_map, all_available=all_available,

diff --git a/pym/portage/tests/resolver/test_virtual_minimize_children.py b/pym/portage/tests/resolver/test_virtual_minimize_children.py
index 6eb0409f2..287445e58 100644
--- a/pym/portage/tests/resolver/test_virtual_minimize_children.py
+++ b/pym/portage/tests/resolver/test_virtual_minimize_children.py
@@ -226,3 +226,64 @@ class VirtualMinimizeChildrenTestCase(TestCase):
 		finally:
 			playground.debug = False
 			playground.cleanup()
+
+	def testVirtualDevManager(self):
+		ebuilds = {
+			'sys-fs/eudev-3.1.5': {},
+			'sys-fs/static-dev-0.1': {},
+			'sys-fs/udev-233': {},
+			'virtual/dev-manager-0': {
+				'RDEPEND': '''
+					|| (
+						virtual/udev
+						sys-fs/static-dev
+					)'''
+			},
+			'virtual/udev-0': {
+				'RDEPEND': '''
+					|| (
+						>=sys-fs/eudev-2.1.1
+						>=sys-fs/udev-217
+					)'''
+			},
+		}
+
+		test_cases = (
+			# Test bug 645190, where static-dev was pulled in instead
+			# of eudev.
+			ResolverPlaygroundTestCase(
+				[
+					'virtual/dev-manager',
+				],
+				success=True,
+				mergelist=(
+					'sys-fs/eudev-3.1.5',
+					'virtual/udev-0',
+					'virtual/dev-manager-0',
+				),
+			),
+			# Test static-dev preference.
+			ResolverPlaygroundTestCase(
+				[
+					'sys-fs/static-dev',
+					'virtual/dev-manager',
+				],
+				all_permutations=True,
+				success=True,
+				mergelist=(
+					'sys-fs/static-dev-0.1',
+					'virtual/dev-manager-0',
+				),
+			),
+		)
+
+		playground = ResolverPlayground(debug=False, 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()


             reply	other threads:[~2018-01-21  0:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-21  0:22 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-03-04 21:05 [gentoo-commits] proj/portage:master commit in: pym/portage/tests/resolver/, pym/portage/dep/ Michał Górny
2018-01-20 23:14 Zac Medico
2018-01-11 19:24 Zac Medico
2014-09-15  5:00 Brian Dolbec
2013-08-22  1:34 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=1516493351.74d0f516a346c7fb6c52a2508ca16b8949b3b65f.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