1 |
commit: 1989cc809b67b8f847d58c096fb70fe89a961a3e |
2 |
Author: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com> |
3 |
AuthorDate: Tue Feb 1 00:12:40 2011 +0000 |
4 |
Commit: Thomas Sachau <tommy <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Feb 1 00:17:42 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1989cc80 |
7 |
|
8 |
put main code in a private func() to remove near duplicated code |
9 |
|
10 |
--- |
11 |
pym/portage/package/ebuild/_config/MaskManager.py | 43 ++++++++++++++------- |
12 |
1 files changed, 29 insertions(+), 14 deletions(-) |
13 |
|
14 |
diff --git a/pym/portage/package/ebuild/_config/MaskManager.py b/pym/portage/package/ebuild/_config/MaskManager.py |
15 |
index be7a212..c438eb7 100644 |
16 |
--- a/pym/portage/package/ebuild/_config/MaskManager.py |
17 |
+++ b/pym/portage/package/ebuild/_config/MaskManager.py |
18 |
@@ -112,7 +112,7 @@ class MaskManager(object): |
19 |
for k, v in d.items(): |
20 |
d[k] = tuple(v) |
21 |
|
22 |
- def getMaskAtom(self, cpv, slot, repo): |
23 |
+ def _getMaskAtom(self, cpv, slot, repo, unmask_atoms=None): |
24 |
""" |
25 |
Take a package and return a matching package.mask atom, or None if no |
26 |
such atom exists or it has been cancelled by package.unmask. PROVIDE |
27 |
@@ -122,6 +122,10 @@ class MaskManager(object): |
28 |
@type cpv: String |
29 |
@param slot: The package's slot |
30 |
@type slot: String |
31 |
+ @param repo: The package's repository [optional] |
32 |
+ @type repo: String |
33 |
+ @param unmask_atoms: if desired pass in self._punmaskdict.get(cp) |
34 |
+ @type unmask_atoms: list |
35 |
@rtype: String |
36 |
@return: A matching atom string or None if one is not found. |
37 |
""" |
38 |
@@ -133,7 +137,6 @@ class MaskManager(object): |
39 |
if repo: |
40 |
pkg = "".join((pkg, _repo_separator, repo)) |
41 |
pkg_list = [pkg] |
42 |
- unmask_atoms = self._punmaskdict.get(cp) |
43 |
for x in mask_atoms: |
44 |
if not match_from_list(x, pkg_list): |
45 |
continue |
46 |
@@ -144,6 +147,27 @@ class MaskManager(object): |
47 |
return x |
48 |
return None |
49 |
|
50 |
+ |
51 |
+ def getMaskAtom(self, cpv, slot, repo): |
52 |
+ """ |
53 |
+ Take a package and return a matching package.mask atom, or None if no |
54 |
+ such atom exists or it has been cancelled by package.unmask. PROVIDE |
55 |
+ is not checked, so atoms will not be found for old-style virtuals. |
56 |
+ |
57 |
+ @param cpv: The package name |
58 |
+ @type cpv: String |
59 |
+ @param slot: The package's slot |
60 |
+ @type slot: String |
61 |
+ @param repo: The package's repository [optional] |
62 |
+ @type repo: String |
63 |
+ @rtype: String |
64 |
+ @return: A matching atom string or None if one is not found. |
65 |
+ """ |
66 |
+ |
67 |
+ cp = cpv_getkey(cpv) |
68 |
+ return self._getMaskAtom(cpv, slot, repo, self._punmaskdict.get(cp)) |
69 |
+ |
70 |
+ |
71 |
def getRawMaskAtom(self, cpv, slot, repo): |
72 |
""" |
73 |
Take a package and return a matching package.mask atom, or None if no |
74 |
@@ -155,19 +179,10 @@ class MaskManager(object): |
75 |
@type cpv: String |
76 |
@param slot: The package's slot |
77 |
@type slot: String |
78 |
+ @param repo: The package's repository [optional] |
79 |
+ @type repo: String |
80 |
@rtype: String |
81 |
@return: A matching atom string or None if one is not found. |
82 |
""" |
83 |
|
84 |
- cp = cpv_getkey(cpv) |
85 |
- mask_atoms = self._pmaskdict_raw.get(cp) |
86 |
- if mask_atoms: |
87 |
- pkg = "".join((cpv, _slot_separator, slot)) |
88 |
- if repo: |
89 |
- pkg = "".join((pkg, _repo_separator, repo)) |
90 |
- pkg_list = [pkg] |
91 |
- for x in mask_atoms: |
92 |
- if not match_from_list(x, pkg_list): |
93 |
- continue |
94 |
- return x |
95 |
- return None |
96 |
+ return self._getMaskAtom(cpv, slot, repo) |