1 |
Allow INSTALL_MASK patterns to start with '-' to indicate that |
2 |
a specific match is to be excluded from being masked. In this case, |
3 |
the last matching pattern determines whether the file is actually |
4 |
filtered out or kept. |
5 |
--- |
6 |
pym/portage/dbapi/vartree.py | 10 ++++++---- |
7 |
1 file changed, 6 insertions(+), 4 deletions(-) |
8 |
|
9 |
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py |
10 |
index 12137a0a4..360677824 100644 |
11 |
--- a/pym/portage/dbapi/vartree.py |
12 |
+++ b/pym/portage/dbapi/vartree.py |
13 |
@@ -3702,19 +3702,21 @@ class dblink(object): |
14 |
def _is_install_masked(self, relative_path, install_mask): |
15 |
ret = False |
16 |
for pattern in install_mask: |
17 |
+ # if pattern starts with -, possibly exclude this path |
18 |
+ is_inclusive = not pattern.startswith('-') |
19 |
+ if not is_inclusive: |
20 |
+ pattern = pattern[1:] |
21 |
# absolute path pattern |
22 |
if pattern.startswith('/'): |
23 |
# match either exact path or one of parent dirs |
24 |
# the latter is done via matching pattern/* |
25 |
if (fnmatch.fnmatch(relative_path, pattern[1:]) |
26 |
or fnmatch.fnmatch(relative_path, pattern[1:] + '/*')): |
27 |
- ret = True |
28 |
- break |
29 |
+ ret = is_inclusive |
30 |
# filename |
31 |
else: |
32 |
if fnmatch.fnmatch(os.path.basename(relative_path), pattern): |
33 |
- ret = True |
34 |
- break |
35 |
+ ret = is_inclusive |
36 |
return ret |
37 |
|
38 |
def treewalk(self, srcroot, destroot, inforoot, myebuild, cleanup=0, |
39 |
-- |
40 |
2.16.2 |