1 |
commit: 16e795f105f5e2e2d3b6f2ab36b85fa11ecf55af |
2 |
Author: Magnus Granberg <zorry <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Jun 3 22:17:16 2012 +0000 |
4 |
Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jun 3 22:17:16 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=16e795f1 |
7 |
|
8 |
update dep handling |
9 |
|
10 |
--- |
11 |
gobs/pym/build_queru.py | 105 +++++++++++++++++++---------------------------- |
12 |
gobs/pym/depgraph.py | 49 ++++++++++++++-------- |
13 |
2 files changed, 74 insertions(+), 80 deletions(-) |
14 |
|
15 |
diff --git a/gobs/pym/build_queru.py b/gobs/pym/build_queru.py |
16 |
index 8b33440..46d815c 100644 |
17 |
--- a/gobs/pym/build_queru.py |
18 |
+++ b/gobs/pym/build_queru.py |
19 |
@@ -150,68 +150,45 @@ class queruaction(object): |
20 |
root_config = trees[settings["ROOT"]]["root_config"] |
21 |
display_missing_pkg_set(root_config, e.value) |
22 |
build_dict['type_fail'] = "depgraph fail" |
23 |
- build_dict['check_fail'] = True |
24 |
- use_changes = None |
25 |
- if not success: |
26 |
- mydepgraph.display_problems() |
27 |
- settings, trees, mtimedb = load_emerge_config() |
28 |
- myparams = create_depgraph_params(myopts, myaction) |
29 |
- try: |
30 |
- success, mydepgraph, favorites = backtrack_depgraph( |
31 |
- settings, trees, myopts, myparams, myaction, myfiles, spinner) |
32 |
- except portage.exception.PackageSetNotFound as e: |
33 |
- root_config = trees[settings["ROOT"]]["root_config"] |
34 |
- display_missing_pkg_set(root_config, e.value) |
35 |
- build_dict['type_fail'] = "depgraph fail" |
36 |
- build_dict['check_fail'] = True |
37 |
- if not success: |
38 |
- mydepgraph.display_problems() |
39 |
- build_dict['type_fail'] = "depgraph fail" |
40 |
- build_dict['check_fail'] = True |
41 |
- |
42 |
- """if mydepgraph._dynamic_config._needed_use_config_changes: |
43 |
- use_changes = {} |
44 |
- for pkg, needed_use_config_changes in mydepgraph._dynamic_config._needed_use_config_changes.items(): |
45 |
- new_use, changes = needed_use_config_changes |
46 |
- use_changes[pkg.cpv] = changes |
47 |
- iteritems_packages = {} |
48 |
- for k, v in use_changes.iteritems(): |
49 |
- k_package = portage.versions.cpv_getkey(k) |
50 |
- iteritems_packages[ k_package ] = v |
51 |
- logging.info('iteritems_packages %s', iteritems_packages) |
52 |
- build_cpv_dict = iteritems_packages |
53 |
- if use_changes is not None: |
54 |
- for k, v in build_cpv_dict.iteritems(): |
55 |
- build_use_flags_list = [] |
56 |
- for x, y in v.iteritems(): |
57 |
- if y is True: |
58 |
- build_use_flags_list.append(x) |
59 |
- if y is False: |
60 |
- build_use_flags_list.append("-" + x) |
61 |
- logging.info("k: %s, build_use_flags_list: %s", k, build_use_flags_list) |
62 |
- if not build_use_flags_list == []: |
63 |
- build_use_flags = "" |
64 |
- for flags in build_use_flags_list: |
65 |
- build_use_flags = build_use_flags + flags + ' ' |
66 |
- filetext = k + ' ' + build_use_flags |
67 |
- logging.info('filetext %s', filetext) |
68 |
- with open("/etc/portage/package.use/gobs.use", "a") as f: |
69 |
- f.write(filetext) |
70 |
- f.write('\n') |
71 |
- settings, trees, mtimedb = load_emerge_config() |
72 |
- myparams = create_depgraph_params(myopts, myaction) |
73 |
- try: |
74 |
- success, mydepgraph, favorites = backtrack_depgraph( |
75 |
- settings, trees, myopts, myparams, myaction, myfiles, spinner) |
76 |
- except portage.exception.PackageSetNotFound as e: |
77 |
- root_config = trees[settings["ROOT"]]["root_config"] |
78 |
- display_missing_pkg_set(root_config, e.value) |
79 |
- build_dict['type_fail'] = "depgraph fail" |
80 |
- build_dict['check_fail'] = True |
81 |
- if not success: |
82 |
- mydepgraph.display_problems() |
83 |
- build_dict['type_fail'] = "depgraph fail" |
84 |
- build_dict['check_fail'] = True""" |
85 |
+ if not success: |
86 |
+ if mydepgraph._dynamic_config._needed_p_mask_changes: |
87 |
+ build_dict['type_fail'] = "Mask packages" |
88 |
+ build_dict['check_fail'] = True |
89 |
+ mydepgraph.display_problems() |
90 |
+ self.log_fail_queru(build_dict, settings) |
91 |
+ return 1, settings, trees, mtimedb |
92 |
+ if mydepgraph._dynamic_config._needed_use_config_changes: |
93 |
+ repeat = True |
94 |
+ repeat_times = 0 |
95 |
+ while repeat: |
96 |
+ mydepgraph._display_autounmask() |
97 |
+ settings, trees, mtimedb = load_emerge_config() |
98 |
+ myparams = create_depgraph_params(myopts, myaction) |
99 |
+ try: |
100 |
+ success, mydepgraph, favorites = backtrack_depgraph( |
101 |
+ settings, trees, myopts, myparams, myaction, myfiles, spinner) |
102 |
+ except portage.exception.PackageSetNotFound as e: |
103 |
+ root_config = trees[settings["ROOT"]]["root_config"] |
104 |
+ display_missing_pkg_set(root_config, e.value) |
105 |
+ if not success and mydepgraph._dynamic_config._needed_use_config_changes: |
106 |
+ print("repaet_times:", repeat_times) |
107 |
+ if repeat_times is 2: |
108 |
+ build_dict['type_fail'] = "Need use change" |
109 |
+ build_dict['check_fail'] = True |
110 |
+ mydepgraph.display_problems() |
111 |
+ repeat = False |
112 |
+ repeat = False |
113 |
+ else: |
114 |
+ repeat_times = repeat_times + 1 |
115 |
+ else: |
116 |
+ repeat = False |
117 |
+ |
118 |
+ if mydepgraph._dynamic_config._unsolvable_blockers: |
119 |
+ mydepgraph.display_problems() |
120 |
+ build_dict['type_fail'] = "Blocking packages" |
121 |
+ build_dict['check_fail'] = True |
122 |
+ self.log_fail_queru(build_dict, settings) |
123 |
+ return 1, settings, trees, mtimedb |
124 |
|
125 |
if build_dict['check_fail'] is True: |
126 |
self.log_fail_queru(build_dict, settings) |
127 |
@@ -693,7 +670,9 @@ class queruaction(object): |
128 |
if not "noclean" in build_dict['post_message']: |
129 |
depclean_fail = main_depclean() |
130 |
try: |
131 |
- os.remove("/etc/portage/package.use/gobs.use") |
132 |
+ os.remove("/etc/portage/package.use/99_autounmask") |
133 |
+ with open("/etc/portage/package.use/99_autounmask", "a") as f: |
134 |
+ f.close |
135 |
except: |
136 |
pass |
137 |
if build_fail is False or depclean_fail is False: |
138 |
|
139 |
diff --git a/gobs/pym/depgraph.py b/gobs/pym/depgraph.py |
140 |
index 0e8200c..cf5a106 100644 |
141 |
--- a/gobs/pym/depgraph.py |
142 |
+++ b/gobs/pym/depgraph.py |
143 |
@@ -3776,7 +3776,7 @@ class depgraph(object): |
144 |
self._dynamic_config._need_restart = True |
145 |
return new_use |
146 |
|
147 |
- def check_required_use2(required_use, use, iuse_match): |
148 |
+ def change_required_use(self, pkg): |
149 |
""" |
150 |
Checks if the use flags listed in 'use' satisfy all |
151 |
constraints specified in 'constraints'. |
152 |
@@ -3792,6 +3792,10 @@ class depgraph(object): |
153 |
@return: Indicates if REQUIRED_USE constraints are satisfied |
154 |
""" |
155 |
|
156 |
+ required_use = pkg.metadata["REQUIRED_USE"] |
157 |
+ use =self._pkg_use_enabled(pkg) |
158 |
+ iuse_match = pkg.iuse.is_valid_flag |
159 |
+ |
160 |
def is_active(token): |
161 |
if token.startswith("!"): |
162 |
flag = token[1:] |
163 |
@@ -3824,14 +3828,15 @@ class depgraph(object): |
164 |
mysplit = required_use.split() |
165 |
level = 0 |
166 |
stack = [[]] |
167 |
- tree = _RequiredUseBranch() |
168 |
+ tree = portage.dep._RequiredUseBranch() |
169 |
node = tree |
170 |
need_bracket = False |
171 |
+ target_use = {} |
172 |
|
173 |
for token in mysplit: |
174 |
if token == "(": |
175 |
if not need_bracket: |
176 |
- child = _RequiredUseBranch(parent=node) |
177 |
+ child = portage.dep._RequiredUseBranch(parent=node) |
178 |
node._children.append(child) |
179 |
node = child |
180 |
|
181 |
@@ -3883,7 +3888,7 @@ class depgraph(object): |
182 |
"node is not last child of parent") |
183 |
for child in node._children: |
184 |
node._parent._children.append(child) |
185 |
- if isinstance(child, _RequiredUseBranch): |
186 |
+ if isinstance(child, portage.dep._RequiredUseBranch): |
187 |
child._parent = node._parent |
188 |
|
189 |
elif not node._children: |
190 |
@@ -3898,7 +3903,7 @@ class depgraph(object): |
191 |
raise AssertionError( |
192 |
"node is not last child of parent") |
193 |
node._parent._children.append(node._children[0]) |
194 |
- if isinstance(node._children[0], _RequiredUseBranch): |
195 |
+ if isinstance(node._children[0], portage.dep._RequiredUseBranch): |
196 |
node._children[0]._parent = node._parent |
197 |
node = node._children[0] |
198 |
if node._operator is None and \ |
199 |
@@ -3909,7 +3914,7 @@ class depgraph(object): |
200 |
"node is not last child of parent") |
201 |
for child in node._children: |
202 |
node._parent._children.append(child) |
203 |
- if isinstance(child, _RequiredUseBranch): |
204 |
+ if isinstance(child, portage.dep._RequiredUseBranch): |
205 |
child._parent = node._parent |
206 |
|
207 |
node = node._parent |
208 |
@@ -3922,7 +3927,7 @@ class depgraph(object): |
209 |
_("malformed syntax: '%s'") % required_use) |
210 |
need_bracket = True |
211 |
stack[level].append(token) |
212 |
- child = _RequiredUseBranch(operator=token, parent=node) |
213 |
+ child = portage.dep._RequiredUseBranch(operator=token, parent=node) |
214 |
node._children.append(child) |
215 |
node = child |
216 |
else: |
217 |
@@ -3934,20 +3939,30 @@ class depgraph(object): |
218 |
if token[-1] == "?": |
219 |
need_bracket = True |
220 |
stack[level].append(token) |
221 |
- child = _RequiredUseBranch(operator=token, parent=node) |
222 |
+ child = portage.dep._RequiredUseBranch(operator=token, parent=node) |
223 |
node._children.append(child) |
224 |
node = child |
225 |
else: |
226 |
satisfied = is_active(token) |
227 |
+ if satisfied is False: |
228 |
+ new_changes = {} |
229 |
+ new_changes[token] = True |
230 |
+ if not pkg.use.mask.intersection(new_changes) or not \ |
231 |
+ pkg.use.force.intersection(new_changes): |
232 |
+ if token in pkg.use.enabled: |
233 |
+ target_use[token] = False |
234 |
+ elif not token in pkg.use.enabled: |
235 |
+ target_use[token] = True |
236 |
+ |
237 |
stack[level].append(satisfied) |
238 |
- node._children.append(_RequiredUseLeaf(token, satisfied)) |
239 |
+ node._children.append(portage.dep._RequiredUseLeaf(token, satisfied)) |
240 |
|
241 |
if level != 0 or need_bracket: |
242 |
raise InvalidDependString( |
243 |
_("malformed syntax: '%s'") % required_use) |
244 |
|
245 |
tree._satisfied = False not in stack[0] |
246 |
- return tree |
247 |
+ return target_use |
248 |
|
249 |
def _wrapped_select_pkg_highest_available_imp(self, root, atom, onlydeps=False, autounmask_level=None): |
250 |
root_config = self._frozen_config.roots[root] |
251 |
@@ -4152,13 +4167,13 @@ class depgraph(object): |
252 |
if pkg.metadata.get("REQUIRED_USE") and eapi_has_required_use(pkg.metadata["EAPI"]): |
253 |
required_use_is_sat = check_required_use(pkg.metadata["REQUIRED_USE"], |
254 |
self._pkg_use_enabled(pkg), pkg.iuse.is_valid_flag) |
255 |
- if not required_use_is_sat: |
256 |
- if autounmask_level and autounmask_level.allow_use_changes and not pkg.built: |
257 |
- # pers the required_use to get the needed use flags |
258 |
- required_use = foo() |
259 |
- else: |
260 |
- pass |
261 |
- |
262 |
+ if not required_use_is_sat: |
263 |
+ if autounmask_level and autounmask_level.allow_use_changes \ |
264 |
+ and not pkg.built: |
265 |
+ target_use = self.change_required_use(pkg) |
266 |
+ if not target_use is None: |
267 |
+ use = self._pkg_use_enabled(pkg, target_use) |
268 |
+ |
269 |
if atom.use: |
270 |
matched_pkgs_ignore_use.append(pkg) |
271 |
if autounmask_level and autounmask_level.allow_use_changes and not pkg.built: |