public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download: 
* [gentoo-portage-dev] [PATCH 3/3] portage.dbapi.vartree: Support exclusions in INSTALL_MASK
  @ 2016-05-22  6:56 99% ` Michał Górny
  0 siblings, 0 replies; 1+ results
From: Michał Górny @ 2016-05-22  6:56 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Michał Górny

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 8e5ac43..d02d850 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -3690,19 +3690,21 @@ class dblink(object):
 	def _is_install_masked(self, relative_path):
 		ret = False
 		for pattern in self.settings.install_mask:
+			# if pattern starts with -, possibly exclude this path
+			pat_res = not pattern.startswith('-')
+			if not pat_res:
+				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 = pat_res
 			# filename
 			else:
 				if fnmatch.fnmatch(os.path.basename(relative_path), pattern):
-					ret = True
-					break
+					ret = pat_res
 		return ret
 
 	def treewalk(self, srcroot, destroot, inforoot, myebuild, cleanup=0,
-- 
2.8.3



^ permalink raw reply related	[relevance 99%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2016-05-22  6:56     [gentoo-portage-dev] [PATCH 0/3] INSTALL_MASK redesign, part I Michał Górny
2016-05-22  6:56 99% ` [gentoo-portage-dev] [PATCH 3/3] portage.dbapi.vartree: Support exclusions in INSTALL_MASK Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox