_add_pkg_dep_string: handle satisfied virt_dep
authorZac Medico <zmedico@gentoo.org>
Sun, 22 May 2011 23:48:42 +0000 (16:48 -0700)
committerZac Medico <zmedico@gentoo.org>
Thu, 26 May 2011 04:24:53 +0000 (21:24 -0700)
This fixes a problem with the asap LIBC_PACKAGE_ATOM test case for
bug #303567.

pym/_emerge/depgraph.py
pym/portage/tests/resolver/test_merge_order.py

index 4cb4593db2928b389fbe92f2398157dc7b9fa7a8..8307e8f58b07d5773fab48aece7363227872c8f5 100644 (file)
@@ -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
 
index 1b7cdddcdc6012eaa04d63e2f460e81538fa15d5..ee3c7863a8334479720cc4c04f14a134c1fd4747 100644 (file)
@@ -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)