COLLISION_IGNORE: support fnmatch patterns
authorZac Medico <zmedico@gentoo.org>
Tue, 8 May 2012 06:23:40 +0000 (23:23 -0700)
committerZac Medico <zmedico@gentoo.org>
Tue, 8 May 2012 06:23:40 +0000 (23:23 -0700)
This allows it to be combined with the COLLISION_IGNORE_UNOWNED
variable from commit 33545ea18e8816addb3c54bb26a0cc788b8512e6, so only
one variable is needed.

cnf/make.globals
man/make.conf.5
pym/portage/dbapi/vartree.py
pym/portage/package/ebuild/_config/special_env_vars.py

index fa76c09eecae0a82c3e53e64f48d0937c3c189f6..975726ab6dfc1de465e36e4fdfae47db0d8825ed 100644 (file)
@@ -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.
index 7b1d4c0469fcb3414210a4c58744c04f565999a2..39c3f8e4847bf1ab3bc39deb206dbf11b61b65d5 100644 (file)
@@ -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"
index ee77fac4fecda079d9f471a0be8dd5f952d5e084..158fc4a02b56ad922433cc8d1f394efaaa24371f 100644 (file)
@@ -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
index 8eac3803431e2b04ae9465d60d44f7f8ea0fa6df..763237d8540b9c4b82cc0c958ba5757e0659f8ec 100644 (file)
@@ -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",