summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-07-23 11:46:41 -0700
committerZac Medico <zmedico@gentoo.org>2011-07-23 11:46:41 -0700
commit87df7332c631b96a2d238abd2526eb5bb1a6e4f6 (patch)
treee34fe3fdbc6255cbf5765971e11594a6e290d60f
parentf0ef754b7dafe892ce58725b32e2146904414b7e (diff)
downloadportage-87df7332c631b96a2d238abd2526eb5bb1a6e4f6.tar.gz
portage-87df7332c631b96a2d238abd2526eb5bb1a6e4f6.tar.bz2
portage-87df7332c631b96a2d238abd2526eb5bb1a6e4f6.zip
merge: handle symlink replacing dir
Previously, these symlinks would trigger a file collision message and would then be silently dropped in cases when the file collsion did not cause emerge to bail out due to FEATURES=protect-owned or collision-protect. Now, if emerge doesn't bail out due to a file collision, it will trigger an eerror message and merge the symlink with a .backup.XXXX extension appended to the file name, similar to handling of regular files in commit 740f71301ed3daf44c0e77df5d5de39fe1438fb1. This will fix bug 326685.
-rw-r--r--pym/portage/dbapi/vartree.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index d61f7390e..c70341558 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -3824,12 +3824,20 @@ class dblink(object):
myrealto = normalize_path(os.path.join(destroot, myabsto))
if mydmode!=None:
#destination exists
- if not stat.S_ISLNK(mydmode):
- if stat.S_ISDIR(mydmode):
- # directory in the way: we can't merge a symlink over a directory
- # we won't merge this, continue with next file...
- continue
+ if stat.S_ISDIR(mydmode):
+ # we can't merge a symlink over a directory
+ newdest = self._new_backup_path(mydest)
+ msg = []
+ msg.append("")
+ msg.append(_("Installation of a symlink is blocked by a directory:"))
+ msg.append(" '%s'" % mydest)
+ msg.append(_("This symlink will be merged with a different name:"))
+ msg.append(" '%s'" % newdest)
+ msg.append("")
+ self._eerror("preinst", msg)
+ mydest = newdest
+ elif not stat.S_ISLNK(mydmode):
if os.path.exists(mysrc) and stat.S_ISDIR(os.stat(mysrc)[stat.ST_MODE]):
# Kill file blocking installation of symlink to dir #71787
pass