aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2016-05-22 08:40:13 +0200
committerZac Medico <zmedico@gentoo.org>2018-03-27 23:28:17 -0700
commit8f9cff73321b3ee5957357448819b505932e0e5c (patch)
tree0d4950aa3744d3f1f3f043118efa6aa00333eaae
parent{,PKG_}INSTALL_MASK: python implementation (diff)
downloadportage-8f9cff73321b3ee5957357448819b505932e0e5c.tar.gz
portage-8f9cff73321b3ee5957357448819b505932e0e5c.tar.bz2
portage-8f9cff73321b3ee5957357448819b505932e0e5c.zip
{,PKG_}INSTALL_MASK: Support exclusions (bug 651214)
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. Bug: https://bugs.gentoo.org/651214
-rw-r--r--pym/portage/util/install_mask.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/pym/portage/util/install_mask.py b/pym/portage/util/install_mask.py
index 506e63c1f..1667d883a 100644
--- a/pym/portage/util/install_mask.py
+++ b/pym/portage/util/install_mask.py
@@ -35,19 +35,21 @@ class InstallMask(object):
"""
ret = False
for pattern in self._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(path, pattern[1:])
or fnmatch.fnmatch(path, pattern[1:] + '/*')):
- ret = True
- break
+ ret = is_inclusive
# filename
else:
if fnmatch.fnmatch(os.path.basename(path), pattern):
- ret = True
- break
+ ret = is_inclusive
return ret