1 |
Author: zmedico |
2 |
Date: 2008-08-30 21:43:52 +0000 (Sat, 30 Aug 2008) |
3 |
New Revision: 11479 |
4 |
|
5 |
Modified: |
6 |
main/trunk/cnf/make.globals |
7 |
main/trunk/man/make.conf.5 |
8 |
main/trunk/pym/portage/dbapi/vartree.py |
9 |
Log: |
10 |
Add support for FEATURES="protect-owned" which is identical to the |
11 |
collision-protect feature except that files may be overwritten if they are |
12 |
not explicitly listed in the contents of a currently installed package. |
13 |
This is particularly useful on systems that have lots of orphan files that |
14 |
have been left behind by older versions of portage that did not support the |
15 |
unmerge-orphans feature. |
16 |
|
17 |
The additional tolerance makes this feature more suitable than |
18 |
collision-protect for being enabled by default. In order to ensure smooth |
19 |
operation of protect-owned in all cases, we also have to set |
20 |
COLLISION_IGNORE="/lib/modules" since files inside this directory are |
21 |
never unmerge. By enabling protect-owned by default, users are protected |
22 |
from problems that may occur due interactions with file collisions and the |
23 |
unmerge-orphans feature which is also enabled by default. |
24 |
|
25 |
|
26 |
Modified: main/trunk/cnf/make.globals |
27 |
=================================================================== |
28 |
--- main/trunk/cnf/make.globals 2008-08-30 06:10:22 UTC (rev 11478) |
29 |
+++ main/trunk/cnf/make.globals 2008-08-30 21:43:52 UTC (rev 11479) |
30 |
@@ -38,8 +38,14 @@ |
31 |
RESUMECOMMAND="/usr/bin/wget -c -t 5 -T 60 --passive-ftp -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\"" |
32 |
|
33 |
# Default user options |
34 |
-FEATURES="distlocks parallel-fetch sandbox sfperms strict unmerge-orphans userfetch" |
35 |
+FEATURES="distlocks parallel-fetch protect-owned sandbox |
36 |
+ sfperms strict unmerge-orphans userfetch" |
37 |
|
38 |
+# Ignore file collisions in /lib/modules since files inside this directory |
39 |
+# are never unmerged, and therefore collisions must be ignored in order for |
40 |
+# FEATURES=protect-owned to operate smoothly in all cases. |
41 |
+COLLISION_IGNORE="/lib/modules" |
42 |
+ |
43 |
# Enable for global testing |
44 |
FEATURES="${FEATURES} preserve-libs" |
45 |
|
46 |
|
47 |
Modified: main/trunk/man/make.conf.5 |
48 |
=================================================================== |
49 |
--- main/trunk/man/make.conf.5 2008-08-30 06:10:22 UTC (rev 11478) |
50 |
+++ main/trunk/man/make.conf.5 2008-08-30 21:43:52 UTC (rev 11479) |
51 |
@@ -82,8 +82,10 @@ |
52 |
Defaults to 5 seconds. |
53 |
.TP |
54 |
\fBCOLLISION_IGNORE\fR = \fI[space delimited list of files and/or directories]\fR |
55 |
-This variable allows the user to disable \fIcollision\-protect\fR for specific |
56 |
-files and/or directories. |
57 |
+This variable allows the user to disable \fIcollision\-protect\fR and |
58 |
+\fIprotect\-owned\fR for specific files and/or directories. |
59 |
+.br |
60 |
+Defaults to /lib/modules. |
61 |
.TP |
62 |
\fBCONFIG_PROTECT\fR = \fI[space delimited list of files and/or directories]\fR |
63 |
All files and/or directories that are defined here will have "config file protection" |
64 |
@@ -171,7 +173,7 @@ |
65 |
.B collision\-protect |
66 |
A QA\-feature to ensure that a package doesn't overwrite files it doesn't own. |
67 |
The \fICOLLISION_IGNORE\fR variable can be used to selectively disable this |
68 |
-feature. |
69 |
+feature. Also see the related \fIprotect\-owned\fR feature. |
70 |
.TP |
71 |
.B digest |
72 |
Autogenerate digests for packages when running the \fBemerge\fR(1) command. If |
73 |
@@ -267,6 +269,20 @@ |
74 |
`tail \-f /var/log/emerge\-fetch.log` in a |
75 |
terminal to view parallel-fetch progress. |
76 |
.TP |
77 |
+.B protect\-owned |
78 |
+This is identical to the \fIcollision\-protect\fR feature except that files |
79 |
+may be overwritten if they are not explicitly listed in the contents of a |
80 |
+currently installed package. This is particularly useful on systems that |
81 |
+have lots of orphan files that have been left behind by older versions |
82 |
+of portage that did not support the \fIunmerge\-orphans\fR feature. Like |
83 |
+\fIcollision\-protect\fR, the \fICOLLISION_IGNORE\fR variable can be used to |
84 |
+selectively disable this feature. It is recommended to leave either |
85 |
+\fIprotect\-owned\fR or \fIcollision\-protect\fR enabled at all times, |
86 |
+since otherwise file collisions between packages may result in files being |
87 |
+overwritten or uninstalled at inappropriate times. |
88 |
+If \fIcollision\-protect\fR is enabled then it takes precedence over |
89 |
+\fIprotect\-owned\fR. |
90 |
+.TP |
91 |
.B sandbox |
92 |
Enable sandbox\-ing when running \fBemerge\fR(1) and \fBebuild\fR(1). |
93 |
.TP |
94 |
@@ -321,7 +337,7 @@ |
95 |
and \fIsrc_test()\fR in \fBebuild\fR(5). This feature implies the "test" |
96 |
\fBUSE\fR flag. |
97 |
.TP |
98 |
-.B unmerge-orphans |
99 |
+.B unmerge\-orphans |
100 |
If a file is not claimed by another package in the same slot and it is not |
101 |
protected by \fICONFIG_PROTECT\fR, unmerge it even if the modification time or |
102 |
checksum differs from the file that was originally installed. |
103 |
|
104 |
Modified: main/trunk/pym/portage/dbapi/vartree.py |
105 |
=================================================================== |
106 |
--- main/trunk/pym/portage/dbapi/vartree.py 2008-08-30 06:10:22 UTC (rev 11478) |
107 |
+++ main/trunk/pym/portage/dbapi/vartree.py 2008-08-30 21:43:52 UTC (rev 11479) |
108 |
@@ -2918,12 +2918,15 @@ |
109 |
|
110 |
if collisions: |
111 |
collision_protect = "collision-protect" in self.settings.features |
112 |
+ protect_owned = "protect-owned" in self.settings.features |
113 |
msg = "This package will overwrite one or more files that" + \ |
114 |
" may belong to other packages (see list below)." |
115 |
- if not collision_protect: |
116 |
- msg += " Add \"collision-protect\" to FEATURES in" + \ |
117 |
+ if not (collision_protect or protect_owned): |
118 |
+ msg += " Add either \"collision-protect\" or" + \ |
119 |
+ " \"protect-owned\" to FEATURES in" + \ |
120 |
" make.conf if you would like the merge to abort" + \ |
121 |
- " in cases like this." |
122 |
+ " in cases like this. See the make.conf man page for" + \ |
123 |
+ " more information about these features." |
124 |
if self.settings.get("PORTAGE_QUIET") != "1": |
125 |
msg += " You can use a command such as" + \ |
126 |
" `portageq owners / <filename>` to identify the" + \ |
127 |
@@ -2991,6 +2994,9 @@ |
128 |
if collision_protect: |
129 |
msg = "Package '%s' NOT merged due to file collisions." % \ |
130 |
self.settings.mycpv |
131 |
+ elif protect_owned and owners: |
132 |
+ msg = "Package '%s' NOT merged due to file collisions." % \ |
133 |
+ self.settings.mycpv |
134 |
else: |
135 |
msg = "Package '%s' merged despite file collisions." % \ |
136 |
self.settings.mycpv |
137 |
@@ -2998,7 +3004,7 @@ |
138 |
"messages for the whole content of the above message." |
139 |
eerror(wrap(msg, 70)) |
140 |
|
141 |
- if collision_protect: |
142 |
+ if collision_protect or (protect_owned and owners): |
143 |
return 1 |
144 |
|
145 |
# The merge process may move files out of the image directory, |