Hello,

I've added a new variable to portage named
COLLISION_UNOWNED_IGNORE_PATTERNS. It works similar to COLLISION_IGNORE, it
specifies shell patterns for unowned files that can be overwritten (will not
cause collision-protect or protect-owned to go off).

I'm not convinced about the name - if anyone has better idea I'd be more than
happy to change it :)

Attached patch adds code to vartree, documents new variable in manual page and
adds a default to make.globals.

-- 
Krzysztof Pawlik  <nelchael at gentoo.org>  key id: 0xF6A80E46
desktop-misc, java, vim, kernel, python, apache...
diff -r 216c6f63069e cnf/make.globals
--- a/cnf/make.globals	Wed May 02 18:32:33 2012 -0700
+++ b/cnf/make.globals	Thu May 03 09:59:04 2012 +0200
@@ -61,6 +61,11 @@ FEATURES="assume-digests binpkg-logs dis
 # 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_UNOWNED_IGNORE_PATTERNS="*.pyc *.pyo"
+
 # Enable preserve-libs for testing with portage versions that support it.
 # This setting is commented out for portage versions that don't support it.
 FEATURES="${FEATURES} preserve-libs"
diff -r 216c6f63069e man/make.conf.5
--- a/man/make.conf.5	Wed May 02 18:32:33 2012 -0700
+++ b/man/make.conf.5	Thu May 03 09:59:04 2012 +0200
@@ -134,6 +134,13 @@ This variable allows the user to disable
 .br
 Defaults to /lib/modules.
 .TP
+\fBCOLLISION_UNOWNED_IGNORE_PATTERNS\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.
+.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"
 enabled for them. See the \fBCONFIGURATION FILES\fR section
diff -r 216c6f63069e pym/portage/dbapi/vartree.py
--- a/pym/portage/dbapi/vartree.py	Wed May 02 18:32:33 2012 -0700
+++ b/pym/portage/dbapi/vartree.py	Thu May 03 09:59:04 2012 +0200
@@ -63,6 +63,7 @@ from _emerge.PollScheduler import PollSc
 from _emerge.MiscFunctionsProcess import MiscFunctionsProcess
 
 import errno
+import fnmatch
 import gc
 import grp
 import io
@@ -3080,6 +3081,9 @@ class dblink(object):
 				portage.util.shlex_split(
 				self.settings.get("COLLISION_IGNORE", ""))])
 
+			unowned_ignore_patterns = self.settings.get(
+				"COLLISION_UNOWNED_IGNORE_PATTERNS", "").split()
+
 			# For collisions with preserved libraries, the current package
 			# will assume ownership and the libraries will be unregistered.
 			if self.vartree.dbapi._plib_registry is None:
@@ -3188,6 +3192,10 @@ class dblink(object):
 								if f.startswith(myignore + os.path.sep):
 									stopmerge = False
 									break
+					for pattern in unowned_ignore_patterns:
+						if fnmatch.fnmatch(full_path, pattern):
+							stopmerge = False
+							break
 					if stopmerge:
 						collisions.append(f)
 			return collisions, symlink_collisions, plib_collisions
diff -r 216c6f63069e pym/portage/package/ebuild/_config/special_env_vars.py
--- a/pym/portage/package/ebuild/_config/special_env_vars.py	Wed May 02 18:32:33 2012 -0700
+++ b/pym/portage/package/ebuild/_config/special_env_vars.py	Thu May 03 09:59:04 2012 +0200
@@ -134,8 +134,9 @@ environ_filter += [
 # portage config variables and variables set directly by portage
 environ_filter += [
 	"ACCEPT_CHOSTS", "ACCEPT_KEYWORDS", "ACCEPT_PROPERTIES", "AUTOCLEAN",
-	"CLEAN_DELAY", "COLLISION_IGNORE", "CONFIG_PROTECT",
-	"CONFIG_PROTECT_MASK", "EGENCACHE_DEFAULT_OPTS", "EMERGE_DEFAULT_OPTS",
+	"CLEAN_DELAY", "COLLISION_IGNORE", "COLLISION_UNOWNED_IGNORE_PATTERNS",
+	"CONFIG_PROTECT", "CONFIG_PROTECT_MASK",
+	"EGENCACHE_DEFAULT_OPTS", "EMERGE_DEFAULT_OPTS",
 	"EMERGE_LOG_DIR",
 	"EMERGE_WARNING_DELAY",
 	"FETCHCOMMAND", "FETCHCOMMAND_FTP",

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to