Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/tests/resolver/, pym/_emerge/
Date: Fri, 30 Sep 2011 11:35:13
Message-Id: d1a3c0f5ab81d1dbf70c0b8e5322cfb2d11b8ce7.zmedico@gentoo
1 commit: d1a3c0f5ab81d1dbf70c0b8e5322cfb2d11b8ce7
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Fri Sep 30 08:30:00 2011 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Fri Sep 30 08:30:00 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d1a3c0f5
7
8 depgraph: pull in new-style virtuals more
9
10 This causes new-style virtuals to get pulled in for virtuals that are
11 already satisfied by installed old-style virtuals. This case is common,
12 due to PROVIDE being (removed without revision bump) from lots of
13 ebuilds.
14
15 ---
16 pym/_emerge/depgraph.py | 6 ++
17 pym/portage/tests/resolver/ResolverPlayground.py | 6 ++
18 .../tests/resolver/test_virtual_transition.py | 51 ++++++++++++++++++++
19 3 files changed, 63 insertions(+), 0 deletions(-)
20
21 diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
22 index da61709..9638ce9 100644
23 --- a/pym/_emerge/depgraph.py
24 +++ b/pym/_emerge/depgraph.py
25 @@ -3953,6 +3953,12 @@ class depgraph(object):
26 e_pkg = self._dynamic_config._slot_pkg_map[root].get(pkg.slot_atom)
27 if not e_pkg:
28 break
29 +
30 + if e_pkg.cp != atom_cp and \
31 + self._have_new_virt(root, atom_cp):
32 + # pull in a new-style virtual instead
33 + break
34 +
35 # Use PackageSet.findAtomForPackage()
36 # for PROVIDE support.
37 if atom_set.findAtomForPackage(e_pkg, modified_use=self._pkg_use_enabled(e_pkg)):
38
39 diff --git a/pym/portage/tests/resolver/ResolverPlayground.py b/pym/portage/tests/resolver/ResolverPlayground.py
40 index a73f632..9630008 100644
41 --- a/pym/portage/tests/resolver/ResolverPlayground.py
42 +++ b/pym/portage/tests/resolver/ResolverPlayground.py
43 @@ -142,6 +142,7 @@ class ResolverPlayground(object):
44 homepage = metadata.pop("HOMEPAGE", None)
45 src_uri = metadata.pop("SRC_URI", None)
46 iuse = metadata.pop("IUSE", "")
47 + provide = metadata.pop("PROVIDE", None)
48 depend = metadata.pop("DEPEND", "")
49 rdepend = metadata.pop("RDEPEND", None)
50 pdepend = metadata.pop("PDEPEND", None)
51 @@ -174,6 +175,8 @@ class ResolverPlayground(object):
52 f.write('SLOT="' + str(slot) + '"\n')
53 f.write('KEYWORDS="' + str(keywords) + '"\n')
54 f.write('IUSE="' + str(iuse) + '"\n')
55 + if provide is not None:
56 + f.write('PROVIDE="%s"\n' % provide)
57 f.write('DEPEND="' + str(depend) + '"\n')
58 if rdepend is not None:
59 f.write('RDEPEND="' + str(rdepend) + '"\n')
60 @@ -224,6 +227,7 @@ class ResolverPlayground(object):
61 keywords = metadata.pop("KEYWORDS", "~x86")
62 iuse = metadata.pop("IUSE", "")
63 use = metadata.pop("USE", "")
64 + provide = metadata.pop("PROVIDE", None)
65 depend = metadata.pop("DEPEND", "")
66 rdepend = metadata.pop("RDEPEND", None)
67 pdepend = metadata.pop("PDEPEND", None)
68 @@ -248,6 +252,8 @@ class ResolverPlayground(object):
69 write_key("KEYWORDS", keywords)
70 write_key("IUSE", iuse)
71 write_key("USE", use)
72 + if provide is not None:
73 + write_key("PROVIDE", provide)
74 write_key("DEPEND", depend)
75 if rdepend is not None:
76 write_key("RDEPEND", rdepend)
77
78 diff --git a/pym/portage/tests/resolver/test_virtual_transition.py b/pym/portage/tests/resolver/test_virtual_transition.py
79 new file mode 100644
80 index 0000000..3f4171e
81 --- /dev/null
82 +++ b/pym/portage/tests/resolver/test_virtual_transition.py
83 @@ -0,0 +1,51 @@
84 +# Copyright 2011 Gentoo Foundation
85 +# Distributed under the terms of the GNU General Public License v2
86 +
87 +from portage.tests import TestCase
88 +from portage.tests.resolver.ResolverPlayground import (ResolverPlayground,
89 + ResolverPlaygroundTestCase)
90 +
91 +class VirtualTransitionTestCase(TestCase):
92 +
93 + def testVirtualTransition(self):
94 + ebuilds = {
95 + "kde-base/kcron-4.7.1" : {"RDEPEND": "virtual/cron" },
96 + "sys-process/vixie-cron-4.1-r11": {},
97 + "virtual/cron-0" : {"RDEPEND": "sys-process/vixie-cron" },
98 + }
99 + installed = {
100 + "kde-base/kcron-4.7.1" : {"RDEPEND": "virtual/cron" },
101 + "sys-process/vixie-cron-4.1-r11" : {"PROVIDE" : "virtual/cron"},
102 + }
103 +
104 + world = ["kde-base/kcron", "sys-process/vixie-cron"]
105 +
106 + test_cases = (
107 +
108 + # Pull in a new-style virtual, even though there is an installed
109 + # old-style virtual to satisfy the virtual/cron dep. This case
110 + # is common, due to PROVIDE being removed (without revision bump)
111 + # from lots of ebuilds.
112 + ResolverPlaygroundTestCase(
113 + ["@world"],
114 + options = {"--update": True, "--deep": True},
115 + success = True,
116 + mergelist = ["virtual/cron-0"]),
117 +
118 + # Make sure that depclean is satisfied with the installed
119 + # old-style virutal.
120 + ResolverPlaygroundTestCase(
121 + [],
122 + options = {"--depclean": True},
123 + success = True,
124 + cleanlist = []),
125 + )
126 +
127 + playground = ResolverPlayground(ebuilds=ebuilds,
128 + installed=installed, world=world)
129 + try:
130 + for test_case in test_cases:
131 + playground.run_TestCase(test_case)
132 + self.assertEqual(test_case.test_success, True, test_case.fail_msg)
133 + finally:
134 + playground.cleanup()