summaryrefslogtreecommitdiffstats
path: root/pym/portage.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-10-12 21:10:50 +0000
committerZac Medico <zmedico@gentoo.org>2007-10-12 21:10:50 +0000
commit3f95b9b0e452a95812bf7691d09a2d3c78af1dfe (patch)
tree9b5bf2d8bf38c29bfef1f99d6c60dd3dce3b53df /pym/portage.py
parenta7c1a3e94298b5bdad93a0307d32ca9e3895aba9 (diff)
downloadportage-3f95b9b0e452a95812bf7691d09a2d3c78af1dfe.tar.gz
portage-3f95b9b0e452a95812bf7691d09a2d3c78af1dfe.tar.bz2
portage-3f95b9b0e452a95812bf7691d09a2d3c78af1dfe.zip
Bug #195527 - Unconditionally detect file collisions and log
them as eerror messages via elog. This will allow us to collect more file collision data but it won't be quite as annoying as enabling collision-protect by default would be. (trunk r8085:8087) svn path=/main/branches/2.1.2/; revision=8088
Diffstat (limited to 'pym/portage.py')
-rw-r--r--pym/portage.py41
1 files changed, 37 insertions, 4 deletions
diff --git a/pym/portage.py b/pym/portage.py
index e58188f7d..dfd7ed033 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -7863,7 +7863,7 @@ class dblink:
self._installed_instance = max_dblnk
# check for package collisions
- if "collision-protect" in self.settings.features:
+ if True:
collision_ignore = set([normalize_path(myignore) for myignore in \
self.settings.get("COLLISION_IGNORE", "").split()])
myfilelist = listdir(srcroot, recursive=1, filesonly=1, followSymlinks=False)
@@ -7938,7 +7938,6 @@ class dblink:
isowned = True
break
if not isowned:
- collisions.append(f)
stopmerge=True
if collision_ignore:
if f in collision_ignore:
@@ -7948,8 +7947,9 @@ class dblink:
if f.startswith(myignore + os.path.sep):
stopmerge = False
break
- #print green("*")+" spent "+str(time.time()-starttime)+" seconds checking for file collisions"
- if stopmerge:
+ if stopmerge:
+ collisions.append(f)
+ if stopmerge and "collision-protect" in self.settings.features:
print red("*")+" This package is blocked because it wants to overwrite"
print red("*")+" files belonging to other packages (see list below)."
print red("*")+" If you have no clue what this is all about report it "
@@ -8023,6 +8023,39 @@ class dblink:
use_cache=0, tree=self.treetype, mydbapi=mydbapi,
vartree=self.vartree)
+ if collisions:
+ msg = "This package wants to overwrite one or more files that" + \
+ " may belong to other packages (see list below)." + \
+ " Add \"collision-protect\" to FEATURES in make.conf" + \
+ " if you would like the merge to abort in cases like this." + \
+ " If you have determined that one or more of the files" + \
+ " actually belong to another installed package then" + \
+ " go to http://bugs.gentoo.org and report it as a bug." + \
+ " Be sure to identify both this package and the other" + \
+ " installed package in the bug report. Use a command such as " + \
+ " \\`equery belongs <filename>\\` to identify the installed" + \
+ " package that owns a file. Do NOT file a bug without" + \
+ " reporting exactly which two packages install the same file(s)."
+
+ self.settings["EBUILD_PHASE"] = "preinst"
+ cmd = "source '%s/isolated-functions.sh' ; " % PORTAGE_BIN_PATH
+ from textwrap import wrap
+ msg = wrap(msg, 70)
+ for line in msg:
+ cmd += "eerror \"%s\" ; " % line
+ cmd += "eerror ; "
+ cmd += "eerror \"Detected file collision(s):\" ; "
+ cmd += "eerror ; "
+
+ from output import colorize
+ for f in collisions:
+ cmd += "eerror \" '%s'\" ; " % colorize("INFORM",
+ os.path.join(destroot, f.lstrip(os.path.sep)))
+
+ portage_exec.spawn(["bash", "-c", cmd],
+ env=self.settings.environ())
+ elog_process(self.settings.mycpv, self.settings)
+
# XXX: Decide how to handle failures here.
if a != os.EX_OK:
writemsg("!!! FAILED preinst: "+str(a)+"\n", noiselevel=-1)