diff options
-rw-r--r-- | cnf/make.globals | 8 | ||||
-rw-r--r-- | man/make.conf.5 | 24 | ||||
-rw-r--r-- | pym/portage/dbapi/vartree.py | 14 |
3 files changed, 37 insertions, 9 deletions
diff --git a/cnf/make.globals b/cnf/make.globals index f379fb1c1..8b9db7a04 100644 --- a/cnf/make.globals +++ b/cnf/make.globals @@ -38,7 +38,13 @@ FETCHCOMMAND="/usr/bin/wget -t 5 -T 60 --passive-ftp -O \"\${DISTDIR}/\${FILE}\" RESUMECOMMAND="/usr/bin/wget -c -t 5 -T 60 --passive-ftp -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\"" # Default user options -FEATURES="distlocks parallel-fetch sandbox sfperms strict unmerge-orphans userfetch" +FEATURES="distlocks parallel-fetch protect-owned sandbox + sfperms strict unmerge-orphans userfetch" + +# 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" # Enable for global testing FEATURES="${FEATURES} preserve-libs" diff --git a/man/make.conf.5 b/man/make.conf.5 index 6eab4b2dd..4f8d3cdf0 100644 --- a/man/make.conf.5 +++ b/man/make.conf.5 @@ -82,8 +82,10 @@ Determines how long the countdown delay will be after running `emerge clean`. Defaults to 5 seconds. .TP \fBCOLLISION_IGNORE\fR = \fI[space delimited list of files and/or directories]\fR -This variable allows the user to disable \fIcollision\-protect\fR for specific -files and/or directories. +This variable allows the user to disable \fIcollision\-protect\fR and +\fIprotect\-owned\fR for specific files and/or directories. +.br +Defaults to /lib/modules. .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" @@ -171,7 +173,7 @@ ${PORTAGE_TMPDIR}/ccache. .B collision\-protect A QA\-feature to ensure that a package doesn't overwrite files it doesn't own. The \fICOLLISION_IGNORE\fR variable can be used to selectively disable this -feature. +feature. Also see the related \fIprotect\-owned\fR feature. .TP .B digest Autogenerate digests for packages when running the \fBemerge\fR(1) command. If @@ -267,6 +269,20 @@ Fetch in the background while compiling. Run `tail \-f /var/log/emerge\-fetch.log` in a terminal to view parallel-fetch progress. .TP +.B protect\-owned +This is identical to the \fIcollision\-protect\fR feature except that files +may be overwritten if they are not explicitly listed in the contents of a +currently installed package. This is particularly useful on systems that +have lots of orphan files that have been left behind by older versions +of portage that did not support the \fIunmerge\-orphans\fR feature. Like +\fIcollision\-protect\fR, the \fICOLLISION_IGNORE\fR variable can be used to +selectively disable this feature. It is recommended to leave either +\fIprotect\-owned\fR or \fIcollision\-protect\fR enabled at all times, +since otherwise file collisions between packages may result in files being +overwritten or uninstalled at inappropriate times. +If \fIcollision\-protect\fR is enabled then it takes precedence over +\fIprotect\-owned\fR. +.TP .B sandbox Enable sandbox\-ing when running \fBemerge\fR(1) and \fBebuild\fR(1). .TP @@ -321,7 +337,7 @@ the package compiled properly. See \fItest\fR in \fBebuild\fR(1) and \fIsrc_test()\fR in \fBebuild\fR(5). This feature implies the "test" \fBUSE\fR flag. .TP -.B unmerge-orphans +.B unmerge\-orphans If a file is not claimed by another package in the same slot and it is not protected by \fICONFIG_PROTECT\fR, unmerge it even if the modification time or checksum differs from the file that was originally installed. diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 8d5d33d35..56e084028 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -2918,12 +2918,15 @@ class dblink(object): if collisions: collision_protect = "collision-protect" in self.settings.features + protect_owned = "protect-owned" in self.settings.features msg = "This package will overwrite one or more files that" + \ " may belong to other packages (see list below)." - if not collision_protect: - msg += " Add \"collision-protect\" to FEATURES in" + \ + if not (collision_protect or protect_owned): + msg += " Add either \"collision-protect\" or" + \ + " \"protect-owned\" to FEATURES in" + \ " make.conf if you would like the merge to abort" + \ - " in cases like this." + " in cases like this. See the make.conf man page for" + \ + " more information about these features." if self.settings.get("PORTAGE_QUIET") != "1": msg += " You can use a command such as" + \ " `portageq owners / <filename>` to identify the" + \ @@ -2991,6 +2994,9 @@ class dblink(object): if collision_protect: msg = "Package '%s' NOT merged due to file collisions." % \ self.settings.mycpv + elif protect_owned and owners: + msg = "Package '%s' NOT merged due to file collisions." % \ + self.settings.mycpv else: msg = "Package '%s' merged despite file collisions." % \ self.settings.mycpv @@ -2998,7 +3004,7 @@ class dblink(object): "messages for the whole content of the above message." eerror(wrap(msg, 70)) - if collision_protect: + if collision_protect or (protect_owned and owners): return 1 # The merge process may move files out of the image directory, |