1 |
commit: d2447ceada5e2e56ced9cfe25c15a88ba8074969 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Aug 27 19:28:44 2013 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Aug 27 19:30:45 2013 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d2447cea |
7 |
|
8 |
grabdict_package: use recursive name for errors |
9 |
|
10 |
This will fix bug #482650. |
11 |
|
12 |
--- |
13 |
pym/portage/util/__init__.py | 43 +++++++++++++++++++++++++++---------------- |
14 |
1 file changed, 27 insertions(+), 16 deletions(-) |
15 |
|
16 |
diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py |
17 |
index 92a2187..264e093 100644 |
18 |
--- a/pym/portage/util/__init__.py |
19 |
+++ b/pym/portage/util/__init__.py |
20 |
@@ -428,24 +428,35 @@ def grabdict_package(myfilename, juststrings=0, recursive=0, allow_wildcard=Fals |
21 |
verify_eapi=False, eapi=None): |
22 |
""" Does the same thing as grabdict except it validates keys |
23 |
with isvalidatom()""" |
24 |
- pkgs=grabdict(myfilename, juststrings, empty=1, recursive=recursive) |
25 |
- if not pkgs: |
26 |
- return pkgs |
27 |
- if verify_eapi and eapi is None: |
28 |
- eapi = read_corresponding_eapi_file(myfilename) |
29 |
|
30 |
- # We need to call keys() here in order to avoid the possibility of |
31 |
- # "RuntimeError: dictionary changed size during iteration" |
32 |
- # when an invalid atom is deleted. |
33 |
+ if recursive: |
34 |
+ file_list = _recursive_file_list(myfilename) |
35 |
+ else: |
36 |
+ file_list = [myfilename] |
37 |
+ |
38 |
atoms = {} |
39 |
- for k, v in pkgs.items(): |
40 |
- try: |
41 |
- k = Atom(k, allow_wildcard=allow_wildcard, allow_repo=allow_repo, eapi=eapi) |
42 |
- except InvalidAtom as e: |
43 |
- writemsg(_("--- Invalid atom in %s: %s\n") % (myfilename, e), |
44 |
- noiselevel=-1) |
45 |
- else: |
46 |
- atoms[k] = v |
47 |
+ for filename in file_list: |
48 |
+ d = grabdict(filename, juststrings=False, |
49 |
+ empty=True, recursive=False, incremental=True) |
50 |
+ if not d: |
51 |
+ continue |
52 |
+ if verify_eapi and eapi is None: |
53 |
+ eapi = read_corresponding_eapi_file(myfilename) |
54 |
+ |
55 |
+ for k, v in d.items(): |
56 |
+ try: |
57 |
+ k = Atom(k, allow_wildcard=allow_wildcard, |
58 |
+ allow_repo=allow_repo, eapi=eapi) |
59 |
+ except InvalidAtom as e: |
60 |
+ writemsg(_("--- Invalid atom in %s: %s\n") % (filename, e), |
61 |
+ noiselevel=-1) |
62 |
+ else: |
63 |
+ atoms.setdefault(k, []).extend(v) |
64 |
+ |
65 |
+ if juststrings: |
66 |
+ for k, v in atoms.items(): |
67 |
+ atoms[k] = " ".join(v) |
68 |
+ |
69 |
return atoms |
70 |
|
71 |
def grabfile_package(myfilename, compatlevel=0, recursive=0, allow_wildcard=False, allow_repo=False, |