Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/
Date: Sat, 23 Jul 2011 19:03:02
Message-Id: 87df7332c631b96a2d238abd2526eb5bb1a6e4f6.zmedico@gentoo
1 commit: 87df7332c631b96a2d238abd2526eb5bb1a6e4f6
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Sat Jul 23 18:46:41 2011 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Sat Jul 23 18:46:41 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=87df7332
7
8 merge: handle symlink replacing dir
9
10 Previously, these symlinks would trigger a file collision message and
11 would then be silently dropped in cases when the file collsion did not
12 cause emerge to bail out due to FEATURES=protect-owned or
13 collision-protect.
14
15 Now, if emerge doesn't bail out due to a file collision, it will
16 trigger an eerror message and merge the symlink with a .backup.XXXX
17 extension appended to the file name, similar to handling of regular
18 files in commit 740f71301ed3daf44c0e77df5d5de39fe1438fb1. This will
19 fix bug 326685.
20
21 ---
22 pym/portage/dbapi/vartree.py | 20 ++++++++++++++------
23 1 files changed, 14 insertions(+), 6 deletions(-)
24
25 diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
26 index d61f739..c703415 100644
27 --- a/pym/portage/dbapi/vartree.py
28 +++ b/pym/portage/dbapi/vartree.py
29 @@ -3824,12 +3824,20 @@ class dblink(object):
30 myrealto = normalize_path(os.path.join(destroot, myabsto))
31 if mydmode!=None:
32 #destination exists
33 - if not stat.S_ISLNK(mydmode):
34 - if stat.S_ISDIR(mydmode):
35 - # directory in the way: we can't merge a symlink over a directory
36 - # we won't merge this, continue with next file...
37 - continue
38 + if stat.S_ISDIR(mydmode):
39 + # we can't merge a symlink over a directory
40 + newdest = self._new_backup_path(mydest)
41 + msg = []
42 + msg.append("")
43 + msg.append(_("Installation of a symlink is blocked by a directory:"))
44 + msg.append(" '%s'" % mydest)
45 + msg.append(_("This symlink will be merged with a different name:"))
46 + msg.append(" '%s'" % newdest)
47 + msg.append("")
48 + self._eerror("preinst", msg)
49 + mydest = newdest
50
51 + elif not stat.S_ISLNK(mydmode):
52 if os.path.exists(mysrc) and stat.S_ISDIR(os.stat(mysrc)[stat.ST_MODE]):
53 # Kill file blocking installation of symlink to dir #71787
54 pass