Allow INSTALL_MASK patterns to start with '-' to indicate that
a specific match is to be excluded from being masked. In this case,
the last matching pattern determines whether the file is actually
filtered out or kept.
---
pym/portage/dbapi/vartree.py | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 12137a0a4..360677824 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -3702,19 +3702,21 @@ class dblink(object):
def _is_install_masked(self, relative_path, install_mask):
ret = False
for pattern in install_mask:
+ # if pattern starts with -, possibly exclude this path
+ is_inclusive = not pattern.startswith('-')
+ if not is_inclusive:
+ pattern = pattern[1:]
# absolute path pattern
if pattern.startswith('/'):
# match either exact path or one of parent dirs
# the latter is done via matching pattern/*
if (fnmatch.fnmatch(relative_path, pattern[1:])
or
fnmatch.fnmatch(relative_path, pattern[1:] + '/*')):
- ret = True
- break
+ ret = is_inclusive
# filename
else:
if
fnmatch.fnmatch(os.path.basename(relative_path), pattern):
- ret = True
- break
+ ret = is_inclusive
return ret
def treewalk(self, srcroot, destroot, inforoot, myebuild, cleanup=0,
--
2.16.2