Gentoo Archives: gentoo-commits

From: Thomas Sachau <tommy@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:multilib commit in: pym/portage/tests/resolver/, pym/_emerge/
Date: Sun, 06 Feb 2011 13:16:10
Message-Id: 3e343a2e66053dc6375ba7ea04c6966afef995f7.tommy@gentoo
1 commit: 3e343a2e66053dc6375ba7ea04c6966afef995f7
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Wed Feb 2 21:29:42 2011 +0000
4 Commit: Thomas Sachau <tommy <AT> gentoo <DOT> org>
5 CommitDate: Wed Feb 2 21:29:42 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3e343a2e
7
8 Make || choices independent of REQUIRED_USE.
9
10 ---
11 pym/_emerge/depgraph.py | 71 +++++++++++------------
12 pym/portage/tests/resolver/test_required_use.py | 26 ++++++++-
13 2 files changed, 60 insertions(+), 37 deletions(-)
14
15 diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
16 index bcbc41d..957f447 100644
17 --- a/pym/_emerge/depgraph.py
18 +++ b/pym/_emerge/depgraph.py
19 @@ -197,8 +197,6 @@ class _dynamic_depgraph_config(object):
20 self._initially_unsatisfied_deps = []
21 self._ignored_deps = []
22 self._highest_pkg_cache = {}
23 -
24 - self._unsat_req_use = {}
25 self._pkg_config_issues = {}
26
27 self._needed_unstable_keywords = backtrack_parameters.needed_unstable_keywords
28 @@ -827,6 +825,34 @@ class depgraph(object):
29 raise
30 del e
31
32 + # NOTE: REQUIRED_USE checks are delayed until after
33 + # package selection, since want to prompt the user
34 + # for USE adjustment rather than have REQUIRED_USE
35 + # affect package selection and || dep choices.
36 + if not pkg.built and pkg.metadata["REQUIRED_USE"] and \
37 + eapi_has_required_use(pkg.metadata["EAPI"]):
38 + required_use_is_sat = check_required_use(
39 + pkg.metadata["REQUIRED_USE"],
40 + self._pkg_use_enabled(pkg),
41 + pkg.iuse.is_valid_flag)
42 + if not required_use_is_sat:
43 + if dep.atom is not None and dep.parent is not None:
44 + self._add_parent_atom(pkg, (dep.parent, dep.atom))
45 +
46 + if arg_atoms:
47 + for parent_atom in arg_atoms:
48 + parent, atom = parent_atom
49 + self._add_parent_atom(pkg, parent_atom)
50 +
51 + config_issues = \
52 + self._dynamic_config._pkg_config_issues.setdefault(pkg, {})
53 + parent_atoms = config_issues.setdefault("required use", set())
54 + all_parent_atoms = self._dynamic_config._parent_atoms.get(pkg)
55 + if all_parent_atoms is not None:
56 + for parent, atom in all_parent_atoms:
57 + parent_atoms.add((parent, pkg.root, atom))
58 + return 0
59 +
60 if not pkg.onlydeps:
61 if not pkg.installed and \
62 "empty" not in self._dynamic_config.myparams and \
63 @@ -1902,14 +1928,8 @@ class depgraph(object):
64 self._dynamic_config._unsatisfied_deps_for_display.append(
65 ((myroot, atom), {"myparent" : arg}))
66 return 0, myfavorites
67 - pkg = self._dynamic_config._unsat_req_use.get((myroot, atom))
68 - if pkg is not None:
69 - config_issues = \
70 - self._dynamic_config._pkg_config_issues.setdefault(pkg, {})
71 - parent_atoms = config_issues.setdefault("required use", set())
72 - parent_atoms.add((arg, myroot, atom))
73 - else:
74 - self._dynamic_config._missing_args.append((arg, atom))
75 +
76 + self._dynamic_config._missing_args.append((arg, atom))
77 continue
78 if atom.cp != pkg.cp:
79 # For old-style virtuals, we need to repeat the
80 @@ -1942,12 +1962,13 @@ class depgraph(object):
81 if self._dynamic_config._need_restart:
82 pass
83 elif isinstance(arg, SetArg):
84 - sys.stderr.write(("\n\n!!! Problem resolving " + \
85 + writemsg(("\n\n!!! Problem resolving " + \
86 "dependencies for %s from %s\n") % \
87 - (atom, arg.arg))
88 + (atom, arg.arg), noiselevel=-1)
89 else:
90 - sys.stderr.write(("\n\n!!! Problem resolving " + \
91 - "dependencies for %s\n") % atom)
92 + writemsg(("\n\n!!! Problem resolving " + \
93 + "dependencies for %s\n") % \
94 + (atom,), noiselevel=-1)
95 return 0, myfavorites
96
97 except portage.exception.MissingSignature as e:
98 @@ -3051,7 +3072,6 @@ class depgraph(object):
99 # represented by the found_available_arg flag.
100 found_available_arg = False
101 packages_with_invalid_use_config = []
102 - pkgs_with_unsat_req_use = []
103 for find_existing_node in True, False:
104 if existing_node:
105 break
106 @@ -3252,24 +3272,6 @@ class depgraph(object):
107 packages_with_invalid_use_config.append(pkg)
108 continue
109
110 - #check REQUIRED_USE constraints
111 - if not pkg.built and pkg.metadata["REQUIRED_USE"] and \
112 - eapi_has_required_use(pkg.metadata["EAPI"]):
113 - required_use = pkg.metadata["REQUIRED_USE"]
114 - use = self._pkg_use_enabled(pkg)
115 - try:
116 - required_use_is_sat = check_required_use(
117 - pkg.metadata["REQUIRED_USE"], use, pkg.iuse.is_valid_flag)
118 - except portage.exception.InvalidDependString as e:
119 - portage.writemsg("!!! Invalid REQUIRED_USE specified by " + \
120 - "'%s': %s\n" % (pkg.cpv, str(e)), noiselevel=-1)
121 - del e
122 - continue
123 - if not required_use_is_sat:
124 - packages_with_invalid_use_config.append(pkg)
125 - pkgs_with_unsat_req_use.append(pkg)
126 - continue
127 -
128 if pkg.cp == atom_cp:
129 if highest_version is None:
130 highest_version = pkg
131 @@ -3351,9 +3353,6 @@ class depgraph(object):
132 break
133
134 if not matched_packages:
135 - if pkgs_with_unsat_req_use:
136 - self._dynamic_config._unsat_req_use[(root, atom)] = \
137 - pkgs_with_unsat_req_use[0]
138 return None, None
139
140 if "--debug" in self._frozen_config.myopts:
141
142 diff --git a/pym/portage/tests/resolver/test_required_use.py b/pym/portage/tests/resolver/test_required_use.py
143 index 90ccb3d..c8810fa 100644
144 --- a/pym/portage/tests/resolver/test_required_use.py
145 +++ b/pym/portage/tests/resolver/test_required_use.py
146 @@ -1,4 +1,4 @@
147 -# Copyright 2010 Gentoo Foundation
148 +# Copyright 2010-2011 Gentoo Foundation
149 # Distributed under the terms of the GNU General Public License v2
150
151 from portage.tests import TestCase
152 @@ -88,3 +88,27 @@ class RequiredUSETestCase(TestCase):
153 self.assertEqual(test_case.test_success, True, test_case.fail_msg)
154 finally:
155 playground.cleanup()
156 +
157 + def testRequiredUseOrDeps(self):
158 +
159 + ebuilds = {
160 + "dev-libs/A-1": { "IUSE": "+x +y", "REQUIRED_USE": "^^ ( x y )", "EAPI": "4" },
161 + "dev-libs/B-1": { "IUSE": "+x +y", "REQUIRED_USE": "", "EAPI": "4" },
162 + "app-misc/p-1": { "RDEPEND": "|| ( =dev-libs/A-1 =dev-libs/B-1 )" },
163 + }
164 +
165 + test_cases = (
166 + # This should fail and show a REQUIRED_USE error for
167 + # dev-libs/A-1, since this choice it preferred.
168 + ResolverPlaygroundTestCase(
169 + ["=app-misc/p-1"],
170 + success = False),
171 + )
172 +
173 + playground = ResolverPlayground(ebuilds=ebuilds)
174 + try:
175 + for test_case in test_cases:
176 + playground.run_TestCase(test_case)
177 + self.assertEqual(test_case.test_success, True, test_case.fail_msg)
178 + finally:
179 + playground.cleanup()