Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r14468 - main/trunk/pym/portage/dbapi
Date: Wed, 30 Sep 2009 06:19:51
Message-Id: E1MssXV-0003v9-Nj@stork.gentoo.org
1 Author: zmedico
2 Date: 2009-09-30 06:19:49 +0000 (Wed, 30 Sep 2009)
3 New Revision: 14468
4
5 Modified:
6 main/trunk/pym/portage/dbapi/vartree.py
7 Log:
8 Bug #286895 - Generate an eerror message when a directory blocks merge
9 of a regular file and the file is merged using a 'config protect' filename
10 even though the path may not be among those covered by CONFIG_PROTECT.
11
12
13 Modified: main/trunk/pym/portage/dbapi/vartree.py
14 ===================================================================
15 --- main/trunk/pym/portage/dbapi/vartree.py 2009-09-30 05:52:03 UTC (rev 14467)
16 +++ main/trunk/pym/portage/dbapi/vartree.py 2009-09-30 06:19:49 UTC (rev 14468)
17 @@ -4161,12 +4161,20 @@
18 protected = self.isprotected(mydest)
19 if mydmode != None:
20 # destination file exists
21 - cfgprot = 0
22 +
23 if stat.S_ISDIR(mydmode):
24 # install of destination is blocked by an existing directory with the same name
25 - cfgprot = 1
26 - showMessage("!!! %s\n" % mydest,
27 - level=logging.ERROR, noiselevel=-1)
28 + newdest = new_protect_filename(mydest, newmd5=mymd5)
29 + msg = []
30 + msg.append("")
31 + msg.append("Installation of a regular file is blocked by a directory:")
32 + msg.append(" '%s'" % mydest)
33 + msg.append("This file will be merged with a different name:")
34 + msg.append(" '%s'" % newdest)
35 + msg.append("")
36 + self._eerror("preinst", msg)
37 + mydest = newdest
38 +
39 elif stat.S_ISREG(mydmode) or (stat.S_ISLNK(mydmode) and os.path.exists(mydest) and stat.S_ISREG(os.stat(mydest)[stat.ST_MODE])):
40 # install of destination is blocked by an existing regular file,
41 # or by a symlink to an existing regular file;
42 @@ -4174,6 +4182,7 @@
43 # we only need to tweak mydest if cfg file management is in play.
44 if protected:
45 # we have a protection path; enable config file management.
46 + cfgprot = 0
47 destmd5 = perform_md5(mydest, calc_prelink=1)
48 if mymd5 == destmd5:
49 #file already in place; simply update mtimes of destination
50 @@ -4198,9 +4207,10 @@
51 """A previously remembered update has been
52 accepted, so it is removed from confmem."""
53 del cfgfiledict[myrealdest]
54 - if cfgprot:
55 - mydest = new_protect_filename(mydest, newmd5=mymd5)
56
57 + if cfgprot:
58 + mydest = new_protect_filename(mydest, newmd5=mymd5)
59 +
60 # whether config protection or not, we merge the new file the
61 # same way. Unless moveme=0 (blocking directory)
62 if moveme: