From: Zac Medico Date: Sun, 22 May 2011 23:48:42 +0000 (-0700) Subject: _add_pkg_dep_string: handle satisfied virt_dep X-Git-Tag: v2.1.9.50~37 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=75b0a8aed8e56f02c0b455b4ee31fdc7e2b464cf;p=portage.git _add_pkg_dep_string: handle satisfied virt_dep This fixes a problem with the asap LIBC_PACKAGE_ATOM test case for bug #303567. --- diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 4cb4593db..8307e8f58 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -1341,6 +1341,17 @@ class depgraph(object): (virt_pkg.cpv, [str(x) for x in atoms]), noiselevel=-1, level=logging.DEBUG) + inst_pkgs = vardb.match_pkgs(atom) + if inst_pkgs: + for inst_pkg in inst_pkgs: + if self._pkg_visibility_check(inst_pkg): + # highest visible + virt_dep.priority.satisfied = inst_pkg + break + if not virt_dep.priority.satisfied: + # none visible, so use highest + virt_dep.priority.satisfied = inst_pkgs[0] + if not self._add_pkg(virt_pkg, virt_dep): return 0 diff --git a/pym/portage/tests/resolver/test_merge_order.py b/pym/portage/tests/resolver/test_merge_order.py index 1b7cdddcd..ee3c7863a 100644 --- a/pym/portage/tests/resolver/test_merge_order.py +++ b/pym/portage/tests/resolver/test_merge_order.py @@ -127,18 +127,22 @@ class MergeOrderTestCase(TestCase): }, "sys-libs/glibc-2.11" : { "DEPEND" : "virtual/os-headers", + "RDEPEND": "", }, "sys-libs/glibc-2.13" : { "DEPEND" : "virtual/os-headers", + "RDEPEND": "", }, "virtual/os-headers-0" : { "RDEPEND" : "sys-kernel/linux-headers", }, "sys-kernel/linux-headers-2.6.38": { "DEPEND" : "app-arch/xz-utils", + "RDEPEND": "", }, "sys-kernel/linux-headers-2.6.39": { "DEPEND" : "app-arch/xz-utils", + "RDEPEND": "", }, "app-arch/xz-utils-5.0.1" : {}, "app-arch/xz-utils-5.0.2" : {}, @@ -182,12 +186,14 @@ class MergeOrderTestCase(TestCase): }, "sys-libs/glibc-2.11" : { "DEPEND" : "virtual/os-headers", + "RDEPEND": "", }, "virtual/os-headers-0" : { "RDEPEND" : "sys-kernel/linux-headers", }, "sys-kernel/linux-headers-2.6.38": { "DEPEND" : "app-arch/xz-utils", + "RDEPEND": "", }, "app-arch/xz-utils-5.0.1" : {}, } @@ -321,14 +327,12 @@ class MergeOrderTestCase(TestCase): # Test that OS_HEADERS_PACKAGE_ATOM and LIBC_PACKAGE_ATOM # are merged asap, in order to account for implicit # dependencies. See bug #303567. - # TODO: optimize this to ensure that glibc comes before xz-utils ResolverPlaygroundTestCase( ["app-arch/xz-utils", "sys-kernel/linux-headers", "sys-libs/glibc"], options = {"--complete-graph" : True}, success = True, all_permutations = True, - ambiguous_merge_order = True, - mergelist = ['sys-kernel/linux-headers-2.6.39', ('app-arch/xz-utils-5.0.2', 'sys-libs/glibc-2.13')]), + mergelist = ['sys-kernel/linux-headers-2.6.39', 'sys-libs/glibc-2.13', 'app-arch/xz-utils-5.0.2']), ) playground = ResolverPlayground(ebuilds=ebuilds, installed=installed)