From bc18e1e7c3af475412e997489058c58942ebfdcb Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 7 May 2012 23:23:40 -0700 Subject: COLLISION_IGNORE: support fnmatch patterns This allows it to be combined with the COLLISION_IGNORE_UNOWNED variable from commit 33545ea18e8816addb3c54bb26a0cc788b8512e6, so only one variable is needed. --- cnf/make.globals | 4 +--- man/make.conf.5 | 15 +++++--------- pym/portage/dbapi/vartree.py | 23 ++++++++-------------- .../package/ebuild/_config/special_env_vars.py | 2 +- 4 files changed, 15 insertions(+), 29 deletions(-) diff --git a/cnf/make.globals b/cnf/make.globals index fa76c09ee..975726ab6 100644 --- a/cnf/make.globals +++ b/cnf/make.globals @@ -59,12 +59,10 @@ FEATURES="assume-digests binpkg-logs distlocks ebuild-locks # Ignore file collisions in /lib/modules since files inside this directory # are never unmerged, and therefore collisions must be ignored in order for # FEATURES=protect-owned to operate smoothly in all cases. -COLLISION_IGNORE="/lib/modules" - # Ignore file collisions for unowned *.pyo and *.pyc files, this helps during # transition from compiling python modules in live file system to compiling # them in src_install() function. -COLLISION_IGNORE_UNOWNED="*.py[co]" +COLLISION_IGNORE="/lib/modules/* *.py[co]" # Enable preserve-libs for testing with portage versions that support it. # This setting is commented out for portage versions that don't support it. diff --git a/man/make.conf.5 b/man/make.conf.5 index 7b1d4c046..39c3f8e48 100644 --- a/man/make.conf.5 +++ b/man/make.conf.5 @@ -128,18 +128,13 @@ Determines how long the countdown delay will be after running .br Defaults to 5 seconds. .TP -\fBCOLLISION_IGNORE\fR = \fI[space delimited list of files and/or directories]\fR +\fBCOLLISION_IGNORE\fR = \fI[space delimited list of shell patterns]\fR This variable allows the user to disable \fIcollision\-protect\fR and -\fIprotect\-owned\fR for specific files and/or directories. +\fIprotect\-owned\fR for specific shell patterns. For backward +compatibility, directories that are listed without a shell pattern will +automatically have /* appended to them. .br -Defaults to /lib/modules. -.TP -\fBCOLLISION_IGNORE_UNOWNED\fR = \fI[space delimited list of shell patterns]\fR -This variable allows the user to disable \fIcollision\-protect\fR and -\fIprotect\-owned\fR for specific shell patterns for files that are -not owned by any packages. -.br -Defaults to *.pyc and *.pyo patterns. +Defaults to "/lib/modules/* *.py[co]". .TP \fBCONFIG_PROTECT\fR = \fI[space delimited list of files and/or directories]\fR All files and/or directories that are defined here will have "config file protection" diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index ee77fac4f..158fc4a02 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -3077,12 +3077,13 @@ class dblink(object): os = _os_merge - collision_ignore = set([normalize_path(myignore) for myignore in \ - portage.util.shlex_split( - self.settings.get("COLLISION_IGNORE", ""))]) - - unowned_ignore_patterns = self.settings.get( - "COLLISION_IGNORE_UNOWNED", "").split() + collision_ignore = [] + for x in portage.util.shlex_split( + self.settings.get("COLLISION_IGNORE", "")): + if os.path.isdir(os.path.join(self._eroot, x.lstrip(os.sep))): + x = normalize_path(x) + x += "/*" + collision_ignore.append(x) # For collisions with preserved libraries, the current package # will assume ownership and the libraries will be unregistered. @@ -3185,15 +3186,7 @@ class dblink(object): if not isowned: f_match = full_path[len(self._eroot)-1:] stopmerge = True - if collision_ignore: - if f_match in collision_ignore: - stopmerge = False - else: - for myignore in collision_ignore: - if f_match.startswith(myignore + os.path.sep): - stopmerge = False - break - for pattern in unowned_ignore_patterns: + for pattern in collision_ignore: if fnmatch.fnmatch(f_match, pattern): stopmerge = False break diff --git a/pym/portage/package/ebuild/_config/special_env_vars.py b/pym/portage/package/ebuild/_config/special_env_vars.py index 8eac38034..763237d85 100644 --- a/pym/portage/package/ebuild/_config/special_env_vars.py +++ b/pym/portage/package/ebuild/_config/special_env_vars.py @@ -134,7 +134,7 @@ environ_filter += [ # portage config variables and variables set directly by portage environ_filter += [ "ACCEPT_CHOSTS", "ACCEPT_KEYWORDS", "ACCEPT_PROPERTIES", "AUTOCLEAN", - "CLEAN_DELAY", "COLLISION_IGNORE", "COLLISION_IGNORE_UNOWNED", + "CLEAN_DELAY", "COLLISION_IGNORE", "CONFIG_PROTECT", "CONFIG_PROTECT_MASK", "EGENCACHE_DEFAULT_OPTS", "EMERGE_DEFAULT_OPTS", "EMERGE_LOG_DIR", -- cgit v1.2.3-1-g7c22