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/_emerge/
Date: Sun, 18 Sep 2011 20:08:55 +0000 (UTC)	[thread overview]
Message-ID: <57cc4e3e8991e7c4394d1dff7698aa62ed2a286b.zmedico@gentoo> (raw)

commit:     57cc4e3e8991e7c4394d1dff7698aa62ed2a286b
Author:     Sebastian Luther <SebastianLuther <AT> gmx <DOT> de>
AuthorDate: Sun Sep 18 19:30:46 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Sep 18 20:02:19 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=57cc4e3e

autounmask: Ensure a suitable parent is displayed in the dep chain

Fixes bug 375265.

---
 pym/_emerge/depgraph.py                       |   34 +++++++++++++-
 pym/portage/tests/resolver/test_autounmask.py |   64 +++++++++++++++++++++++++
 2 files changed, 97 insertions(+), 1 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index fbbae1e..400207e 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -18,7 +18,8 @@ from portage import os, OrderedDict
 from portage import _unicode_decode, _unicode_encode, _encodings
 from portage.const import PORTAGE_PACKAGE_ATOM, USER_CONFIG_PATH
 from portage.dbapi import dbapi
-from portage.dep import Atom, extract_affecting_use, check_required_use, human_readable_required_use, _repo_separator
+from portage.dep import Atom, best_match_to_list, extract_affecting_use, \
+	check_required_use, human_readable_required_use, _repo_separator
 from portage.eapi import eapi_has_strong_blocks, eapi_has_required_use
 from portage.exception import InvalidAtom, InvalidDependString, PortageException
 from portage.output import colorize, create_color_func, \
@@ -2694,6 +2695,37 @@ class depgraph(object):
 
 			dep_chain.append((pkg_name, node.type_name))
 
+
+		# To build a dep chain for the given package we take
+		# "random" parents form the digraph, except for the
+		# first package, because we want a parent that forced
+		# the corresponding change (i.e '>=foo-2', instead 'foo').
+
+		traversed_nodes.add(start_node)
+
+		start_node_parent_atoms = {}
+		for ppkg, patom in all_parents[node]:
+			# Get a list of suitable atoms. For use deps
+			# (aka unsatisfied_dependency is not None) we
+			# need that the start_node doesn't match the atom.
+			if not unsatisfied_dependency or \
+				not InternalPackageSet(initial_atoms=(patom,)).findAtomForPackage(start_node):
+				start_node_parent_atoms.setdefault(patom, []).append(ppkg)
+
+		if start_node_parent_atoms:
+			# If there are parents in all_parents then use one of them.
+			# If not, then this package got pulled in by an Arg and
+			# will be correctly handled by the code that handles later
+			# packages in the dep chain.
+			best_match = best_match_to_list(node.cpv, start_node_parent_atoms)
+
+			child = node
+			for ppkg in start_node_parent_atoms[best_match]:
+				node = ppkg
+				if ppkg in self._dynamic_config._initial_arg_list:
+					# Stop if reached the top level of the dep chain.
+					break
+
 		while node is not None:
 			traversed_nodes.add(node)
 

diff --git a/pym/portage/tests/resolver/test_autounmask.py b/pym/portage/tests/resolver/test_autounmask.py
index 54c435f..ff13789 100644
--- a/pym/portage/tests/resolver/test_autounmask.py
+++ b/pym/portage/tests/resolver/test_autounmask.py
@@ -1,6 +1,7 @@
 # Copyright 2010-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
+from portage.const import _ENABLE_SET_CONFIG
 from portage.tests import TestCase
 from portage.tests.resolver.ResolverPlayground import ResolverPlayground, ResolverPlaygroundTestCase
 
@@ -324,3 +325,66 @@ class AutounmaskTestCase(TestCase):
 				self.assertEqual(test_case.test_success, True, test_case.fail_msg)
 		finally:
 			playground.cleanup()
+
+
+	def testAutounmaskAndSets(self):
+
+		if not _ENABLE_SET_CONFIG:
+			return
+
+		ebuilds = {
+			#ebuilds to test use changes
+			"dev-libs/A-1": { },
+			"dev-libs/A-2": { "KEYWORDS": "~x86" },
+			"dev-libs/B-1": { "DEPEND": "dev-libs/A" },
+			"dev-libs/C-1": { "DEPEND": ">=dev-libs/A-2" },
+			"dev-libs/D-1": { "DEPEND": "dev-libs/A" },
+			}
+
+		world_sets = [ "@test-set" ]
+		sets = {
+			"test-set": (
+					"dev-libs/A", "dev-libs/B", "dev-libs/C", "dev-libs/D",
+				),
+			}
+
+		test_cases = (
+				#Test USE changes.
+				#The simple case.
+
+				ResolverPlaygroundTestCase(
+					["dev-libs/B", "dev-libs/C", "dev-libs/D"],
+					all_permutations=True,
+					options = {"--autounmask": "y"},
+					mergelist=["dev-libs/A-2", "dev-libs/B-1", "dev-libs/C-1", "dev-libs/D-1"],
+					ignore_mergelist_order=True,
+					unstable_keywords = ["dev-libs/A-2"],
+					success = False),
+
+				ResolverPlaygroundTestCase(
+					["@test-set"],
+					all_permutations=True,
+					options = {"--autounmask": "y"},
+					mergelist=["dev-libs/A-2", "dev-libs/B-1", "dev-libs/C-1", "dev-libs/D-1"],
+					ignore_mergelist_order=True,
+					unstable_keywords = ["dev-libs/A-2"],
+					success = False),
+
+				ResolverPlaygroundTestCase(
+					["@world"],
+					all_permutations=True,
+					options = {"--autounmask": "y"},
+					mergelist=["dev-libs/A-2", "dev-libs/B-1", "dev-libs/C-1", "dev-libs/D-1"],
+					ignore_mergelist_order=True,
+					unstable_keywords = ["dev-libs/A-2"],
+					success = False),
+			)
+
+
+		playground = ResolverPlayground(ebuilds=ebuilds, world_sets=world_sets, sets=sets)
+		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()



             reply	other threads:[~2011-09-18 20:09 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-18 20:08 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-05-04 17:12 [gentoo-commits] proj/portage:master commit in: pym/portage/tests/resolver/, pym/_emerge/ Zac Medico
2018-04-12  2:45 Zac Medico
2017-09-29 17:24 Zac Medico
2017-06-02  5:41 Zac Medico
2017-04-01  5:48 Zac Medico
2017-03-22  8:59 Zac Medico
2017-03-16  4:51 Zac Medico
2017-03-09 19:36 Zac Medico
2016-08-07 17:55 Zac Medico
2015-11-24 16:45 Zac Medico
2014-11-16  9:04 Zac Medico
2014-10-27  9:26 Zac Medico
2014-09-19  9:28 Zac Medico
2014-09-19  9:17 Zac Medico
2014-09-17 16:35 Zac Medico
2014-09-16 21:04 Brian Dolbec
2014-09-11 21:37 Zac Medico
2014-04-26 19:44 Sebastian Luther
2014-02-16 17:25 Sebastian Luther
2014-02-15 12:40 Sebastian Luther
2014-02-05 19:42 Sebastian Luther
2014-01-07 22:22 Arfrever Frehtes Taifersar Arahesis
2013-12-05 15:38 Brian Dolbec
2013-12-01 10:19 Brian Dolbec
2013-11-27  7:44 Mike Frysinger
2013-08-02  8:26 Zac Medico
2013-07-07 19:16 Zac Medico
2013-07-06 21:45 Zac Medico
2013-03-19 21:06 Zac Medico
2013-03-05  0:56 Zac Medico
2013-02-14  4:45 Zac Medico
2013-02-12  2:50 Zac Medico
2013-02-11 22:51 Zac Medico
2013-02-11  1:58 Zac Medico
2012-12-01 23:23 Zac Medico
2012-10-26  6:06 Zac Medico
2012-10-26  4:57 Zac Medico
2012-07-05  3:16 Zac Medico
2012-06-15 23:04 Zac Medico
2012-02-26 10:00 Zac Medico
2011-11-18  1:26 Zac Medico
2011-09-30  8:30 Zac Medico
2011-09-19  3:05 Zac Medico
2011-09-18 19:42 Zac Medico
2011-09-15  5:10 Zac Medico
2011-09-11 20:43 Zac Medico
2011-06-12 22:13 Zac Medico
2011-05-24 23:59 Zac Medico
2011-05-23  5:40 Zac Medico
2011-05-22 23:49 Zac Medico
2011-05-21  3:49 Zac Medico
2011-05-03 22:59 Zac Medico
2011-04-27 20:40 Zac Medico
2011-02-13 13:55 Zac Medico
2011-02-13 10:23 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=57cc4e3e8991e7c4394d1dff7698aa62ed2a286b.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