From 87df7332c631b96a2d238abd2526eb5bb1a6e4f6 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 23 Jul 2011 11:46:41 -0700 Subject: 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. --- pym/portage/dbapi/vartree.py | 18 +++++++++++++----- 1 file 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 -- cgit v1.2.3-1-g7c22