From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1R5Nfj-0005CS-NL for garchives@archives.gentoo.org; Sun, 18 Sep 2011 20:09:04 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8169C21C12D; Sun, 18 Sep 2011 20:08:56 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 44D8521C12D for ; Sun, 18 Sep 2011 20:08:56 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B7DCE1B400B for ; Sun, 18 Sep 2011 20:08:55 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 2900380048 for ; Sun, 18 Sep 2011 20:08:55 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <57cc4e3e8991e7c4394d1dff7698aa62ed2a286b.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/tests/resolver/, pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/depgraph.py pym/portage/tests/resolver/test_autounmask.py X-VCS-Directories: pym/portage/tests/resolver/ pym/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 57cc4e3e8991e7c4394d1dff7698aa62ed2a286b Date: Sun, 18 Sep 2011 20:08:55 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 66be882e27b3aaa25598303c06652a83 commit: 57cc4e3e8991e7c4394d1dff7698aa62ed2a286b Author: Sebastian Luther gmx de> AuthorDate: Sun Sep 18 19:30:46 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Sun Sep 18 20:02:19 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D57cc4e3e 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, PortageE= xception from portage.output import colorize, create_color_func, \ @@ -2694,6 +2695,37 @@ class depgraph(object): =20 dep_chain.append((pkg_name, node.type_name)) =20 + + # 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 '>=3Dfoo-2', instead 'foo'). + + traversed_nodes.add(start_node) + + start_node_parent_atoms =3D {} + 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=3D(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 =3D best_match_to_list(node.cpv, start_node_parent_atoms) + + child =3D node + for ppkg in start_node_parent_atoms[best_match]: + node =3D 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) =20 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 =20 +from portage.const import _ENABLE_SET_CONFIG from portage.tests import TestCase from portage.tests.resolver.ResolverPlayground import ResolverPlayground= , ResolverPlaygroundTestCase =20 @@ -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 =3D { + #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": ">=3Ddev-libs/A-2" }, + "dev-libs/D-1": { "DEPEND": "dev-libs/A" }, + } + + world_sets =3D [ "@test-set" ] + sets =3D { + "test-set": ( + "dev-libs/A", "dev-libs/B", "dev-libs/C", "dev-libs/D", + ), + } + + test_cases =3D ( + #Test USE changes. + #The simple case. + + ResolverPlaygroundTestCase( + ["dev-libs/B", "dev-libs/C", "dev-libs/D"], + all_permutations=3DTrue, + options =3D {"--autounmask": "y"}, + mergelist=3D["dev-libs/A-2", "dev-libs/B-1", "dev-libs/C-1", "dev-l= ibs/D-1"], + ignore_mergelist_order=3DTrue, + unstable_keywords =3D ["dev-libs/A-2"], + success =3D False), + + ResolverPlaygroundTestCase( + ["@test-set"], + all_permutations=3DTrue, + options =3D {"--autounmask": "y"}, + mergelist=3D["dev-libs/A-2", "dev-libs/B-1", "dev-libs/C-1", "dev-l= ibs/D-1"], + ignore_mergelist_order=3DTrue, + unstable_keywords =3D ["dev-libs/A-2"], + success =3D False), + + ResolverPlaygroundTestCase( + ["@world"], + all_permutations=3DTrue, + options =3D {"--autounmask": "y"}, + mergelist=3D["dev-libs/A-2", "dev-libs/B-1", "dev-libs/C-1", "dev-l= ibs/D-1"], + ignore_mergelist_order=3DTrue, + unstable_keywords =3D ["dev-libs/A-2"], + success =3D False), + ) + + + playground =3D ResolverPlayground(ebuilds=3Debuilds, world_sets=3Dworl= d_sets, sets=3Dsets) + 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()